GithubHelp home page GithubHelp logo

yomichi / spinmontecarlo.jl Goto Github PK

View Code? Open in Web Editor NEW
42.0 3.0 7.0 719 KB

Markov chain Monte Carlo solver for lattice spin systems implemented in Julialang

Home Page: https://yomichi.github.io/SpinMonteCarlo.jl/latest/

License: MIT License

Julia 100.00%
julialang spin lattice monte-carlo physics statistical-physics mcmc quantum-physics ising-model

spinmontecarlo.jl's Introduction

SpinMonteCarlo.jl

Markov chain Monte Carlo solver for finite temperature problem of lattie spin system implemented by Julia language.

Online manual

Install

Pkg> add SpinMonteCarlo

Simple example

The following program calculates temperature v.s. specific heat of the ferromagnetic Ising model on a $16\times 16$ square lattice by Swendsen-Wang algorithm.

using SpinMonteCarlo
using Printf

const model = Ising
const lat = "square lattice"
const L = 16
const update = SW_update!

const Tc = 2.0/log1p(sqrt(2))
const Ts = Tc*range(0.85, stop=1.15, length=31)
const MCS = 8192
const Therm = MCS >> 3

for T in Ts
    params = Dict{String,Any}("Model"=>model, "Lattice"=>lat,
                              "L"=>L, "T"=>T, "J"=>1.0,
                              "Update Method"=>update,
                              "MCS"=>MCS, "Thermalization"=>Therm,
                             )
    result = runMC(params)
    @printf("%f %.15f %.15f\n",
            T, mean(result["Specific Heat"]), stderror(result["Specific Heat"]))
end

Implemented

Model

  • Classical spin model
    • Ising model
    • Q state Potts model
      • order parameter defined as $M = n_1(Q-1)/Q - (1-n_1)/Q$, where $n_1$ is the number density of $q=1$ spins.
    • XY model
    • Q state Clock model
    • AshkinTeller model
  • Quantum spin model
    • spin-S QuantumXXZ model
      • $\mathcal{H} = \sum_{ij} [ Jz_{ij} S_i^z S_j^z + \frac{Jxy_{ij}}{2} (S_i^+ S_j^- + S_i^-S_j^+) ] - \sum_i \Gamma_i S_i^x$

Lattice

  • chain lattice
    • L
  • bond-alternating chain lattice
    • L
  • square lattice
    • L * W
  • J1J2 square lattice
    • L * W
  • triangular lattice
    • L * W
  • cubic lattice
    • L * W * H
  • fully connected graph
    • N

Update algorithm

  • Classical spin
    • local_update!
    • SW_update!
    • Wolff_update!
  • Quantum spin
    • loop_update!

Physical quantities

  • Ising, Potts
    • Magnetization
      • $\braket{m} := \braket{ M_\text{total}/N_\text{site} }$
    • |Magnetization|
      • $\braket{|m|} := \braket{|M_\text{total}/N_\text{site}|}$
    • Magnetization^2
      • $\braket{m^2} := \braket{(M_\text{total}/N_\text{site})^2}$
    • Magnetization^4
      • $\braket{m^4} := \braket{(M_\text{total}/N_\text{site})^4 }$
    • Binder Ratio
      • $U_{4,2} := \braket{m^4}/\braket{m^2}^2$
    • Susceptibility
      • $\chi := \partial_h \braket{m} = (N/T)(\braket{m^2} - \braket{m}^2)$
    • Connected Susceptibility
      • $\chi := (N/T)(\braket{m^2} - \braket{|m|}^2)$
    • Energy
      • $E := \braket{\mathcal{H}} = \braket{E_\text{total}}/N_\text{site}$
    • Energy^2
      • $E^2 := \braket{\mathcal{H}^2}$
    • Specific Heat
      • $C := \partial_\beta \braket{\mathcal{H}} = (N/T^2)(\braket{\mathcal{H}^2} - \braket{\mathcal{H}}^2)$
  • XY, Clock
    • |Magnetization|
    • |Magnetization|^2
    • |Magnetization|^4
    • Binder Ratio
    • Susceptibility
    • Connected Susceptibility
    • Magnetization x
    • |Magnetization x|
    • Magnetization x^2
    • Magnetization x^4
    • Binder Ratio x
    • Susceptibility x
    • Connected Susceptibility x
    • Magnetization y
    • |Magnetization y|
    • Magnetization y^2
    • Magnetization y^4
    • Binder Ratio y
    • Susceptibility y
    • Connected Susceptibility y
    • Helicity Modulus x
    • Helicity Modulus y
    • Energy
    • Energy^2
    • Specific Heat
  • QuantumXXZ
    • Magnetization
      • $\braket{m} := \braket{\sum_i S_i^z } / N_\text{site}$
    • Magnetization^2
      • $\braket{m^2}:= \braket{(\sum_i S_i^z)^2 } / N_\text{site}^2$
    • Magnetization^4
      • $\braket{m^4}:= \braket{(\sum_i S_i^z)^4 } / N_\text{site}^4$
    • Binder Ratio
      • $U_{4,2} := \braket{m^4}/\braket{m^2}^2$
    • Susceptibility
      • $\chi := \partial_h \braket{m} = (N/T)(\braket{m^2} - \braket{m}^2)$
    • Energy
      • $E := \braket{\mathcal{H}}$
    • Energy^2
      • $E^2 := \braket{\mathcal{H}^2}$
    • Specific Heat
      • $C := \partial_\beta \braket{\mathcal{H}} = (N/T^2)(\braket{\mathcal{H}^2} - \braket{\mathcal{H}}^2)$

Future work

  • Model
    • Classical model
      • Heisenberg model
      • antiferro interaction
      • magnetic field
    • Quantum model
      • SU(N) model
  • Update Method
    • worm algorithm
  • Others
    • random number parallelization
      • NOTE: parameter parallelization can be realized simply by using @parallel for or pmap.
    • write algorithmic note
      • especially, Foutuin-Kasteleyn representaion and improved estimators

Author

Yuichi Motoyama, the University of Tokyo, 2016-

This package is distributed under the MIT license.

spinmontecarlo.jl's People

Contributors

github-actions[bot] avatar juliatagbot avatar mortenpi avatar stefankarpinski avatar yomichi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spinmontecarlo.jl's Issues

v1.1.0

@JuliaRegistrator register

Release notes:

  • New lattice, "J1J2 square lattice"
    • J1-J2 Square lattice (J2 means next-nearest neighbor interaction)
  • Custom post-process function of the observables can be passed as "Post Process" parameter
  • Update CI/CD environments: migrate to GitHub Actions

release v1.0.0

@JuliaRegistrator register

Release notes:

  • change source tree structure
  • change some APIs
    • for example, param["Lattice"] is a String, not a Function
  • generalize how to definite lattice
  • added some lattice
  • added some models

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.