Lattice Documentation - andrew0796/TwistedLattice.jl GitHub Wiki
Lattice Type
The main type defined by TwistedLattice
is Lattice
which stores a four dimensional lattice (with volume $V$) of $N\times N$ matrices, as well as some more physical parameters. The fields of Lattice
are as follows
N
: This specifies the gauge group $SU(N)$, must be an integer greater than or equal to 2sites
: This is an array of the matrices of the lattice, it is a $V\times 4\times N\times N$ array with complex entriesdims
: AnNTuple
of the dimensions of the lattice, given by four integerstwists
: A $4\times 4$ antisymmetric ($\bmod{N}$) matrix of twistsaction
: The current action of the lattice, may be computed in different wayselectricAction
: The electric part of the actionmagneticAction
: The magnetic part of the actionactionDensity
: The action density stored in an array of floats_neighbours_pos
: A $V\times 4$ array of the neighbours of each site in the positive direction_neighbours_neg
: A $V\times 4$ array of the neighbours of each site in the negative direction_checkerboard_red
: A $V/2$ array of "red" sites, where the sum of all Cartesian coordinates is even_checkerboard_blk
: A $V/2$ array of "black" sites, where the sum of all Cartesian coordinates is odd_ranges_improved
: An array of sites for iterating over safely in parallel with improved cooling
Indexing
The lattice sites are stored using lexicographic indexing in the following way. To each Cartesian index there is an associated lexicographic index obtained using the following
i = 1 + \sum_{\mu=1}^4 \left[(x_\mu-1)\frac{V}{\prod_{\nu=\mu}^{4}L_\nu}\right],
where $L_\mu$ is the size of the lattice in the $\mu$ direction, and $V=L_1L_2L_3L_4$ is the volume of the lattice. Note that $i$ runs from 1 to $V$, and $x_\mu$ runs from 1 to $L_\mu$. The sites
of the lattice are stored in a $V\times 4\times N\times N$ array, where the $N\times N$ matrix at the link pointing from $i$ in the $\mu$ direction is accessed from a Lattice
L
using L[i, mu]
(preferred) or L.sites[i, mu, :,:]
. Cartesian indexing is also supported, so the link at site $(i1,i2,i3,i4)$ pointing in the $\mu$ direction is accessed by L[i1,i2,i3,i4,mu]
. Note that the cartesian indexing respects the periodicity of the lattice, so asking for L[L1+1,i2,i3,i4,mu]
, the code will recognize that the first index is greater than $L_1$ and automatically wrap it around to give you L[1,i2,i3,i4,mu]
. The action density, Lattice.actionDensity
is stored in the same way, but does not support periodic indexing.
One drawback of using lexicographic indexing is that it is not immediately obvious what the neighbours of site i
are. For this the Lattice
itself stores the neighbours in an array computed at construction. To access the neighbour of site i
in the positive mu
direction use neighbour_pos_index(i, mu, L)
, and in the negative direction use neighbour_neg_index(i, mu, L)
. This will automatically respect the periodicity of the lattice. These are stored within the Lattice
using L._neighbours_pos
and L._neighbours_neg
, so that neighbour_pos_index(i, mu, L) == L._neighbours_pos[i, mu]
and similarly for the negative direction.
To convert between lexicographic and Cartesian indices there are functions
singleindextocartesian(i::Int, L::Lattice)::Vector{Int}
and
cartesiantosingleindex(x::Vector{Int}, L::Lattice)::Int
cartesiantosingleindex(x::Vector{Int}, dimensions::NTuple{4, Int})::Int
cartesiantosingleindex(L::Lattice, x::Vararg{Int, 5})::Int
Constructors
Random initialization
To construct a Lattice
with random (or no) initialization on the sites we use
Lattice(N::Int64, dimensions::NTuple{4, Int64}, twists::Matrix{Int64}; initialization::Symbol=:random)
For example, to create an $SU(4)$ lattice of size $10\times 12\times 14\times 16$ with no twists we would do L = Lattice(4, (10,12,14,16), zeros(Int, 4,4))
From a file
To initialize a Lattice
from a datafile we use
Lattice(filename::AbstractString; use_snapshot::Bool=false)
where filename
is a path (relative to the current working directory) where the file is located (if you're unsure of what that is, use Julia
's built in function pwd()
to figure it out), and use_snapshot
specifies whether to use the most recent snapshot saved in the datafile (this is useful when the minimization procedure is interrupted but snapshots were being saved).
HDF5
object
From an For more fine grained control, you can initialize a Lattice
from either an HDF5.File
object, or an HDF5.Group
object, using
Lattice(f::Union{HDF5.File, HDF5.Group})
Only use this constructor if you're comfortable working with HDF5
files.
Utilities
Document moving, etc