Spin-spin interactions
SpiDy.Nchain
— FunctionNchain(N, J0; boundary=nothing)
Create the spin-spin coupling matrix of a 1D chain of N
sites with nearest-neighbour interactions of strength set by J0
.
Arguments
N
: The number of sites in the chain.J0
: The nearest-neighbour coupling strength.boundary=nothing
: (Optional) Specifies the boundary condition of the chain. Default isnothing
which corresponds to a chain open at the edges. Use:periodic
for periodic boundary conditions.
Returns
An N×N
array representing the coupling matrix.
Examples
julia> J = Nchain(4, 2.0)
4×4 Matrix{Float64}:
0.0 2.0 0.0 0.0
2.0 0.0 2.0 0.0
0.0 2.0 0.0 2.0
0.0 0.0 2.0 0.0
julia> J_periodic = Nchain(4, 2.0; boundary=:periodic)
4×4 Matrix{Float64}:
0.0 2.0 0.0 2.0
2.0 0.0 2.0 0.0
0.0 2.0 0.0 2.0
2.0 0.0 2.0 0.0
SpiDy.NNlattice
— FunctionNNlattice(N, Jh, Jv; boundary=nothing)
Create the spin-spin coupling matrix of a NxN
2D lattice with nearest-neighbour interactions and specified horizontal and vertical coupling strengths, Jh
and Jv
respectively.
Arguments
N
: The size of the lattice (N x N).Jh
: The horizontal nearest-neighbour coupling strength.Jv
: The vertical nearest-neighbour coupling strength.boundary=nothing
: (Optional) Specifies the boundary condition of the lattice. Default isnothing
which corresponds to open edges. Use:periodic
for periodic boundary condition.
Returns
An N^2×N^2
array representing the coupling matrix of the lattice.
Examples
julia> J = NNlattice(3, 2.0, 1.0)
9×9 LinearAlgebra.Symmetric{Float64, Matrix{Float64}}:
0.0 2.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0
2.0 0.0 2.0 0.0 1.0 0.0 0.0 0.0 0.0
0.0 2.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0
1.0 0.0 0.0 0.0 2.0 0.0 1.0 0.0 0.0
0.0 1.0 0.0 2.0 0.0 2.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0 2.0 0.0 0.0 0.0 1.0
0.0 0.0 0.0 1.0 0.0 0.0 0.0 2.0 0.0
0.0 0.0 0.0 0.0 1.0 0.0 2.0 0.0 2.0
0.0 0.0 0.0 0.0 0.0 1.0 0.0 2.0 0.0
julia> J_periodic = NNlattice(2, 2.0, 1.0; boundary=:periodic)
9×9 LinearAlgebra.Symmetric{Float64, Matrix{Float64}}:
0.0 2.0 2.0 1.0 0.0 0.0 1.0 0.0 0.0
2.0 0.0 2.0 0.0 1.0 0.0 0.0 1.0 0.0
2.0 2.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0
1.0 0.0 0.0 0.0 2.0 2.0 1.0 0.0 0.0
0.0 1.0 0.0 2.0 0.0 2.0 0.0 1.0 0.0
0.0 0.0 1.0 2.0 2.0 0.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0 0.0 0.0 0.0 2.0 2.0
0.0 1.0 0.0 0.0 1.0 0.0 2.0 0.0 2.0
0.0 0.0 1.0 0.0 0.0 1.0 2.0 2.0 0.0