TRExMC.jl
Documentation for TRExMC.
TRExMC.Models.Lattices
TRExMC.TRExMC
TRExMC.Models.Hamiltonians.AbstractDoF
TRExMC.Models.Hamiltonians.AbstractHamiltonian
TRExMC.Models.Hamiltonians.AbstractHamiltonianIterator
TRExMC.Models.Lattices.AbstractLattice
TRExMC.Models.Model
TRExMC.Models.Observables.AbstractObservables
TRExMC.Models.Observables.NullObservable
TRExMC.Models.Hamiltonians.hamiltonian
TRExMC.Models.Lattices.construct_lattice!
TRExMC.Models.Lattices.nearest_neighbors
TRExMC.Models.Lattices.num_sites
TRExMC.Models.Lattices.parameters
TRExMC.Models.Lattices.site_index
TRExMC.Models.Observables._observables
TRExMC.Models.Observables.measure!
TRExMC.Models.iterate_DoFs
TRExMC.Models.lattice
TRExMC.Models.observables
TRExMC.Models.rng
TRExMC.Simulations.monte_carlo!
TRExMC.Simulations.monte_carlo_run!
TRExMC.Simulations.run_and_record!
TRExMC.Simulations.thermalize!
TRExMC.Algorithms.@algorithm
TRExMC.Models.Observables.@observables
TRExMC.TRExMC
— ModuleTRExMC
: Thermodynamics via Replica-Exchange Monte Carlo
TRExMC.Models.Model
— TypeModel{L, H[, O]}
The main container used for simulations. The type parameters are given by
R <: Random.AbstractRNG
L <:
AbstractLattice
H <:
AbstractHamiltonian
O <:
AbstractObservable
- If no observable is provided, then the
NullObservable
is used.
- If no observable is provided, then the
TRExMC.Models.Hamiltonians.hamiltonian
— Methodhamiltonian(::Model)
Convenience function to access the <:
AbstractHamiltonian
of a Model
.
TRExMC.Models.Observables.measure!
— Methodmeasure!(m::Model)
Convenience function to take measurements in a Model
.
TRExMC.Models.iterate_DoFs
— Methoditerate_DoFs(m::AbstractModel)
Wrapper to extract the Hamiltonian
from the Model
and iterate.
TRExMC.Models.lattice
— Methodlattice(::Model)
Convenience function to access the <:
AbstractLattice
of a Model
.
TRExMC.Models.observables
— Methodobservables(::Model)
Convenience function to access the <:
AbstractObservables
of a Model
.
TRExMC.Models.rng
— Methodrng(::Model)
Convenience function to access the Random Number Generator a Model
.
TRExMC.Models.Lattices
— Modulemodule Lattices
Main entry point for any simulated model to access an underlying geometrical structure. Currently comprised of the following subfiles:
- [
AbstractLattices.jl
]:- Interface module that defines the `AbstractLattice as the supertype for all lattices
- [
CubicLattices.jl
]:- Defines the
AbstractCubicLattice
subtype - Implements the
CubicLattice2D
<: AbstractCubicLattice
and theCubicLattice2DParams
- Defines the
TRExMC.Models.Lattices.AbstractLattice
— Typeabstract type AbstractLattice end
The supertype
for all Type
s of lattices one can dream of.
Required Interface Methods
One must define the following methods
for each new (non-abstract
) AbstractLattice
:
Default Interface Methods
The following represent the default methods
for AbstractLattice
s. One may still overload them for any peculiar subtype
.
TRExMC.Models.Lattices.construct_lattice!
— Methodconstruct_lattice!(::AbstractLattice)
Build a lattice and its geometry. Meant to be used in a constructor.
TRExMC.Models.Lattices.nearest_neighbors
— Methodnearest_neighbors(::AbstractLattice, site)
Return the set of nearest_neighbors
for a given site
in the AbstractLattice
.
Example
julia> latt = Lattices.CubicLattice2D(4, 4);
julia> Lattices.nearest_neighbors(latt, 1)
4-element view(::Matrix{Int32}, 1, :) with eltype Int32:
13
4
2
5
TRExMC.Models.Lattices.num_sites
— Methodnum_sites(::AbstractLattice)
Return the number of sites that an AbstractLattice
contains.
Example
julia> latt = Lattices.CubicLattice2D(4, 4);
julia> Lattices.num_sites(latt)
16
TRExMC.Models.Lattices.parameters
— Methodparameters(::AbstractLattice)
Return the parameters
used to define the AbstractLattice
.
Example
julia> latt = Lattices.CubicLattice2D(4, 4);
julia> Lattices.parameters(latt)
TRExMC.Models.Lattices.CubicLattice2DParams(4, 4)
TRExMC.Models.Lattices.site_index
— Methodsite_index(::AbstractLattice, indices::itr)
Calculate the flattened index from an iterable set of indices
in an AbstractLattice
.
Example
julia> latt = Lattices.CubicLattice2D(4, 4);
julia> Lattices.site_index(latt, (1, 2))
5
TRExMC.Models.Hamiltonians.AbstractDoF
— Typeabstract type AbstractDoF end
Parent type for all degrees of freedom used in the simulations.
The required interface for all DoF types is the following:
DoF_location
: Defines the in-memory identification for where the DoF is.DoF_value
: Defines what the value of the DoF is (its current state).
TRExMC.Models.Hamiltonians.AbstractHamiltonian
— Typeabstract type AbstractHamiltonian end
Parent type for all Hamiltonians in the simulation.
The required interface that all Hamiltonians must satisfy are specified by the following functions:
DoF
: theAbstractDoF
stored at a given memory locationenergy
: total energy of the HamiltonianDoF_energy
: energy associated with a singleAbstractDoF
TRExMC.Models.Hamiltonians.AbstractHamiltonianIterator
— Typeabstract type AbstractHamiltonianIterator end
Iterface for iteration through a given Hamiltonian.
TRExMC.Models.Observables.AbstractObservables
— Typeabstract type AbstractObservables end
Parent type for all observables.
Required Interface
The following methods must be implemented for all subtypes:
* [`measure!`](@ref): how one should take measurements of a system for a given system configuration.
TRExMC.Models.Observables.NullObservable
— TypeNullObservable <: AbstractObservables
Empty observable used for testing purposes.
TRExMC.Models.Observables._observables
— Method_observables(name, symbol_funcs::AbstractDict)
_observables(name, symbols, funcs)
Return an Expr
ession used by the @observables
macro.
TRExMC.Models.Observables.@observables
— Macro@observables name symbol_funcs::AbstractDict
@observables name symbols funcs
Generate an AbstractObservables
subtype with the given name
whose fields will be denoted by the given symbols
iterable. The measure!
method will also be implemented with the supplied [funcs
] iterable.
Alternatively one can supply a Dict
ionary of symbol-function pairs as a single argument.
length(symbols) == length(funcs)
by construction.
TRExMC.Algorithms.@algorithm
— Macro@algorithm
TRExMC.Simulations.monte_carlo!
— Methodmonte_carlo!(models, algorithm, mcparams)
A single sweep of the Monte Carlo simulation. It's an internal function that is supposed to be used by the monte_carlo_run!
function.
TRExMC.Simulations.monte_carlo_run!
— Methodmonte_carlo_run!(models, algorithm, mcparams; kwargs...)
Main Monte Carlo function that performs a certain simulation algorithm
on the systems defined by the given models
. The parameters for the simulation are contained with mcparams
.
Currently, the available keyword arguments (kwargs
) are:
procedure::AbstractMCProcedure = MonteCarloSimulation()
: defines the type of simulation to be runverbose = false
: whether to dump the progress for run during the simulation
TRExMC.Simulations.run_and_record!
— Methodrun_and_record!(models, algorithm, mcparams; [kwargs...])
Monte Carlo simulation for a set of models
to be simulated in parallel according to the specified algorithm
with respect to the given parameters, mcparams
.
This is a wrapper around monte_carlo_run!
with procedure = MonteCarloSimulation()
.
TRExMC.Simulations.thermalize!
— Methodthermalize(models, algorithm, mcparams; [kwargs...])
Thermalization process for a given set of models
to be thermalized in parallel according to the specified algorithm
with respect to the given parameters, mcparams
.
This is a wrapper around monte_carlo_run!
with procedure = Thermalization()
.