Internal APIs

Documentation for SpinMonteCarlo.jl's internals (not exported).

Driver

SpinMonteCarlo.postprocFunction
postproc(model::Model, param::Parameter, obs::MCObservableSet)

Post process of observables. For example, Specific heat will be calculated from energy, energy^2, and temperature.

source
SpinMonteCarlo.postprocMethod
postproc(model::Ising, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $m$ is total magnetization per site and $\epsilon$ is total energy per site.

  • "Binder Ratio"
    • \[R := \frac{\left \langle m^4 \right \rangle}{\left \langle m^2 \right\rangle^2}\]

  • "Susceptibility"
    • \[\chi := \frac{N}{T}\left(\left\langle m^2\right\rangle\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle m^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source
SpinMonteCarlo.postprocMethod
postproc(model::Potts, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $m$ is total magnetization per site and $\epsilon$ is total energy per site.

  • "Binder Ratio"
    • \[R := \frac{\left \langle m^4 \right \rangle}{\left \langle m^2 \right\rangle^2}\]

  • "Susceptibility"
    • \[\chi := \frac{N}{T}\left(\left\langle m^2\right\rangle\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle m^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source
SpinMonteCarlo.postprocMethod
postproc(model::Clock, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $m$ is total magnetization per site and $\epsilon$ is total energy per site.

  • "Binder Ratio x"
    • \[\frac{\left \langle m_x^4 \right \rangle}{\left \langle m_x^2 \right\rangle^2}\]

  • "Binder Ratio y"
    • \[\frac{\left \langle m_y^4 \right \rangle}{\left \langle m_y^2 \right\rangle^2}\]

  • "Binder Ratio"
    • \[\frac{\left \langle |m|^4 \right \rangle}{\left \langle |m|^2 \right\rangle^2}\]

  • "Susceptibility x"
    • \[\frac{N}{T}\left(\left\langle m_x^2\right\rangle\right)\]

  • "Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle m_y^2\right\rangle\right)\]

  • "Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle |m|^2\right\rangle\right)\]

  • "Connected Susceptibility x"
    • \[\frac{N}{T}\left(\left\langle m_x^2\right\rangle - \left\langle |m_x| \right\rangle^2\right)\]

  • "Connected Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle m_y^2\right\rangle - \left\langle |m_y| \right\rangle^2\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle |m|^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source
SpinMonteCarlo.postprocMethod
postproc(model::XY, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $m$ is total magnetization per site and $\epsilon$ is total energy per site.

  • "Binder Ratio x"
    • \[\frac{\left \langle m_x^4 \right \rangle}{\left \langle m_x^2 \right\rangle^2}\]

  • "Binder Ratio y"
    • \[\frac{\left \langle m_y^4 \right \rangle}{\left \langle m_y^2 \right\rangle^2}\]

  • "Binder Ratio"
    • \[\frac{\left \langle |m|^4 \right \rangle}{\left \langle |m|^2 \right\rangle^2}\]

  • "Susceptibility x"
    • \[\frac{N}{T}\left(\left\langle m_x^2\right\rangle\right)\]

  • "Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle m_y^2\right\rangle\right)\]

  • "Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle |m|^2\right\rangle\right)\]

  • "Connected Susceptibility x"
    • \[\frac{N}{T}\left(\left\langle m_x^2\right\rangle - \left\langle |m_x| \right\rangle^2\right)\]

  • "Connected Susceptibility y"
    • \[\frac{N}{T}\left(\left\langle m_y^2\right\rangle - \left\langle |m_y| \right\rangle^2\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle |m|^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source
SpinMonteCarlo.postprocMethod
postproc(model::AshkinTeller, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $m$ is total magnetization per site and $\epsilon$ is total energy per site.

  • "Binder Ratio"
    • \[R := \frac{\left \langle m^4 \right \rangle}{\left \langle m^2 \right\rangle^2}\]

  • "Susceptibility"
    • \[\chi := \frac{N}{T}\left(\left\langle m^2\right\rangle\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle m^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Binder Ratio sigma"
    • Binder ratio with respct to $\sigma$
  • "Susceptibility sigma"
    • Susceptibility with respct to $\sigma$
  • "Connected Susceptibility sigma"
    • Connected susceptibility with respct to $\sigma$
  • "Binder Ratio tau"
    • Binder ratio with respct to $\tau$
  • "Susceptibility tau"
    • Susceptibility with respct to $\tau$
  • "Connected Susceptibility tau"
    • Connected susceptibility with respct to $\tau$
  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source
SpinMonteCarlo.postprocMethod
postproc(model::QuantumXXZ, param::Parameter, obs::MCObservableSet)

Observables to be calculated

In the following, $s$ is sign of weight, $m$ is total magnetization per site, and $\epsilon$ is total energy per site.

  • "Magnetization"
    • \[\left\langle m s\right\rangle\Big/\left\langle s \right\rangle\]

  • "|Magnetization|"
    • \[\left\langle |m| s\right\rangle\Big/\left\langle s \right\rangle\]

  • "Magnetization^2"
    • \[\left\langle m^2 s\right\rangle\Big/\left\langle s \right\rangle\]

  • "Magnetization^4"
    • \[\left\langle m^4 s\right\rangle\Big/\left\langle s \right\rangle\]

  • "Energy"
    • \[\left\langle \epsilon s\right\rangle\Big/\left\langle s \right\rangle\]

  • "Energy^2"
    • \[\left\langle \epsilon^2 s\right\rangle\Big/\left\langle s \right\rangle\]

  • "Binder Ratio"
    • \[\frac{\left \langle m^4 \right \rangle}{\left \langle m^2 \right\rangle^2}\]

  • "Susceptibility"
    • \[\frac{N}{T}\left(\left\langle m^2\right\rangle\right)\]

  • "Connected Susceptibility"
    • \[\frac{N}{T}\left(\left\langle m^2\right\rangle - \left\langle |m| \right\rangle^2\right)\]

  • "Specific Heat"
    • \[\frac{N}{T^2}\left(\left\langle \epsilon^2\right\rangle - \left\langle \epsilon \right\rangle^2\right)\]

source

Lattice

Model

SpinMonteCarlo.LocalLoopOperatorType

(Imaginary-temporary and spatial) local operator as a perturbation with assigned loop element.

Fields

  • let_type : assigned loop element
  • isdiagonal : operator is diagonal or not
    • in other words, two states connecting this perturbation are equivalent to each other or not.
  • time : imaginary time ($\tau/\beta \in [0,1)$) which this perturbation acts on.
  • space : spin or bond which this perturbation acts on. denotes space spin if space <= nspins or space - nspins bond otherwise.
  • subspace : subspin(s) index
  • bottom_id :: index of node of union find assigned to a loop
  • top_id :: index of node of union find assigned to the other loop
source

Utility

SpinMonteCarlo.@gen_convert_parameterMacro
@gen_convert_parameter(model_typename, (keyname, size_fn, default)...)

Generates convert_parameter(model::model_typename, param::Parameter).

Example

@gen_convert_parameter(A, ("A", numbondtypes, 1.0), ("B", 1, 1))

generates a function equivalent to the following:

doc"""
    convert_parameter(model::A, param::Parameter)

# Keynames

- "A": a vector with `numbondtypes(model)` elements (default: 1)
- "B": a scalar (default: 1.0)

"""
function convert_parameter(model::A, param::Parameter)
    ## if `size_fn` is a `Function`,
    ## result is a vector whose size is `size_fn(model)`.
    ## `param["A"]` can take a scalar or a vector.
    a = get(param, "A", 1.0)
    as = zeros(Float64, numbondtypes(model))
    as .= a

    ## otherwise,
    ## result is a scalar.
    b = convert(Int, get(param, "B", 1))

    return as, b
end
source
SpinMonteCarlo.SWInfoType

Information of clusters in Swendsen-Wang algorithm.

Fields

  • activated_bonds : The number of activated (connected) bonds of each cluster.
  • clustersize : The number of sites in each cluster.
  • clusterspin : Spin variable of each cluster (e.g., 1 or -1 for Ising).
source
SpinMonteCarlo.root!Function
root!(u::UnionFind, n::Integer)

Returns the root node of the cluster where n belongs. This may changes graph connection by "Path halving" method.

source
SpinMonteCarlo.root_path_halving!Function
root_path_halving!(u::UnionFind, n::Integer)

Returns the root node of the cluster where n belongs. This may changes graph connection by "Path halving" method.

source
SpinMonteCarlo.root_path_splitting!Function
root_path_splitting!(u::UnionFind, n::Integer)

Returns the root node of the cluster where n belongs. This may changes graph connection by "Path splitting" method.

source