Internal APIs
Documentation for SpinMonteCarlo.jl
's internals (not exported).
Driver
SpinMonteCarlo.accumulateObservables!
— FunctionaccumulateObservables!(model, obs::MCObservableSet, localobs::Dict)
Accumulates localobs
into obs
. For example, obs["Energy"] << localobs["Energy"]
.
SpinMonteCarlo.postproc
— Functionpostproc(model::Model, param::Parameter, obs::MCObservableSet)
Post process of observables. For example, Specific heat will be calculated from energy, energy^2, and temperature.
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
SpinMonteCarlo.postproc
— Methodpostproc(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)\]
Lattice
SpinMonteCarlo.generatelattice
— Functiongeneratelattice(param::Parameter)
generates Lattice
from Parameter
.
SpinMonteCarlo.numsitetypes
— Functionnumsitetypes(lat::Lattice)
numsitetypes(model::Model)
Returns the number of sitetypes.
SpinMonteCarlo.numbondtypes
— Functionnumbondtypes(lat::Lattice)
numbondtypes(model::Model)
Returns the number of bondtypes.
Model
SpinMonteCarlo.LoopElementType
— TypeEnumtype including LET_*
SpinMonteCarlo.LET_Cut
— ConstantLoop element depicted as
|
o
|
or matrix
1 1 |+>
1 1 |->
SpinMonteCarlo.LET_FMLink
— ConstantLoop element depicted as
| |
|--|
| |
or matrix
1 0 0 0 |++>
0 0 0 0 |+->
0 0 0 0 |-+>
0 0 0 1 |-->
SpinMonteCarlo.LET_AFLink
— ConstantLoop element depicted as
| |
|~~|
| |
or matrix
0 0 0 0 |++>
0 1 0 0 |+->
0 0 1 0 |-+>
0 0 0 0 |-->
SpinMonteCarlo.LET_Vertex
— ConstantLoop element depicted as
| |
~~~~
~~~~
| |
or matrix
0 0 0 0 |++>
0 1 1 0 |+->
0 1 1 0 |-+>
0 0 0 0 |-->
SpinMonteCarlo.LET_Cross
— ConstantLoop element depicted as
| |
\/
/\
| |
or matrix
1 0 0 0 |++>
0 0 1 0 |+->
0 1 0 0 |-+>
0 0 0 1 |-->
SpinMonteCarlo.LocalLoopOperator
— Type(Imaginary-temporary and spatial) local operator as a perturbation with assigned loop element.
Fields
let_type
: assigned loop elementisdiagonal
: 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. denotesspace
spin if space <= nspins orspace - nspins
bond otherwise.subspace
: subspin(s) indexbottom_id
:: index of node of union find assigned to a looptop_id
:: index of node of union find assigned to the other loop
Utility
SpinMonteCarlo.default_estimator
— Functiondefault_estimator(model, updatemethod!)
Determines estimator to be used when param["Estimator"]
is not set.
SpinMonteCarlo.@gen_convert_parameter
— Macro@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
SpinMonteCarlo.SWInfo
— TypeInformation 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 forIsing
).
SpinMonteCarlo.UnionFind
— TypeUnion-find algorithm.
SpinMonteCarlo.addnode!
— Functionaddnode!(u::UnionFind)
Adds a new node into u
and returns the number of nodes including the added node.
SpinMonteCarlo.unify!
— Functionunify!(u, n1, n2)
Connects n1
and n2
nodes and returns the root.
SpinMonteCarlo.clusterize!
— Functionclusterize!(u::UnionFind)
Assigns cluster ID to each node and returns the number of clusters.
SpinMonteCarlo.clusterid
— Functionclusterid(u::UnionFind, i::Integer)
Returns the index of the cluster where i
node belongs.
SpinMonteCarlo.root!
— Functionroot!(u::UnionFind, n::Integer)
Returns the root node of the cluster where n
belongs. This may changes graph connection by "Path halving" method.
SpinMonteCarlo.root_path_halving!
— Functionroot_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.
SpinMonteCarlo.root_path_splitting!
— Functionroot_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.