Skip to content

Spinhalf

A block in a spin \(S=1/2\) Hilbert space.

Sources: spinhalf.hpp · spinhalf.cpp

Constructors

Spinhalf(nsites::Int64)
Spinhalf(nsites::Int64, nup::Int64)
Spinhalf(nsites::Int64, irrep::Representation, backend::String="auto")
Spinhalf(nsites::Int64, nup::Int64, irrep::Representation, backend::String="auto")
Spinhalf(int64_t nsites);
Spinhalf(int64_t nsites, int64_t nup);
Spinhalf(int64_t nsites, Representation const &irrep, std::string backend = "auto");
Spinhalf(int64_t nsites, int64_t nup, Representation const &irrep, std::string backend = "auto");
Name Description Default
nsites number of sites (integer)
nup number of "up" spin setting spin (integer)
irrep Irreducible Representation of the symmetry group
backend backend used for coding the basis states auto

The parameter backend chooses how the block is coded internally. By using the default parameter auto the backend is chosen automatically. Alternatives are 1sublattice, 2sublattice, 3sublattice, 4sublattice, and 5sublattice. The backends xsublattice implement the sublattice coding algorithm described in Wietek, Läuchli, Phys. Rev. E 98, 033309 (2018). The sublattice coding algorithms impose certain constraints on the symmetries used, as described in the reference.

Local configurations

Each site of a Spinhalf block carries a local dimension \(d=2\). In a ProductState, the local configuration of every site is given by an integer with the following meaning:

Integer Configuration Symbol
0 down-spin
1 up-spin

Operators

The following operator types can be used on a Spinhalf block. Here \(\mathbf{S}_i = (S^x_i, S^y_i, S^z_i)\) are the spin-\(1/2\) operators on site \(i\) and \(S^\pm_i = S^x_i \pm i S^y_i\).

Type Description Formula No. of sites
Sz local magnetic moment (\(z\)) \(S^z_i\) 1
Sx local magnetic moment (\(x\)) \(S^x_i\) 1
Sy local magnetic moment (\(y\)) \(S^y_i\) 1
S+ spin raising operator \(S^+_i\) 1
S- spin lowering operator \(S^-_i\) 1
SdotS Heisenberg interaction \(\mathbf{S}_i \cdot \mathbf{S}_j\) 2
SzSz Ising interaction \(S^z_i S^z_j\) 2
Exchange spin exchange interaction \(\frac{1}{2}(S^+_i S^-_j + S^-_i S^+_j)\) 2
ExchangeAsym antisymmetric exchange \(\frac{1}{2}(S^+_i S^-_j - S^-_i S^+_j)\) 2
ScalarChirality scalar chirality \(\mathbf{S}_i \cdot (\mathbf{S}_j \times \mathbf{S}_k)\) 3
TotalSz total magnetization \(\sum_i S^z_i\) 0
Matrix generic spin interaction user-defined matrix on the \(2^n\)-dimensional space of \(n\) sites any
Id identity \(\mathbb{1}\) 0

For a full description of all operator types, see the operator types page.

Iteration

An Spinhalf block can be iterated over, where at each iteration a ProductState representing the corresponding basis state is returned.

block = Spinhalf(4, 2)
for pstate in block
    @show pstate, index(block, pstate) 
end
auto block = Spinhalf(4, 2);
for (auto pstate : block) {
  Log("{} {}", to_string(pstate), block.index(pstate));
}

Methods

index

Returns the index of a given ProductState in the basis of the Spinhalf block.

index(block::Spinhalf, pstate::ProductState)::Int64
int64_t Spinhalf::index(ProductState const &pstate);

1-indexing

In the C++ version, the index count starts from "0" whereas in Julia the index count starts from "1".

nsites

Returns the number of sites of the block.

nsites(block::Spinhalf)::Int64
int64_t nsites(Spinhalf const &block);

size

Returns the size of the block, i.e. its dimension.

size(block::Spinhalf)::Int64
int64_t size(Spinhalf const &block) const;

dim

Returns the dimension of the block, same as "size" for non-distributed blocks.

dim(block::Spinhalf)::Int64
int64_t dim(Spinhalf const &block) const;

isreal

Returns whether the block can be used with real arithmetic. Complex arithmetic is needed when a Representation is genuinely complex.

isreal(block::Spinhalf)::Bool
bool isreal(Spinhalf const &block);

Usage Example

N = 4
nup = 2

# without Sz conservation
block = Spinhalf(N)
@show block

# with Sz conservation
block_sz = Spinhalf(N, nup)
@show block_sz

# with symmetries, without Sz
p = Permutation([2, 3, 4, 1])
group = PermutationGroup([p^0, p^1, p^2, p^3])
rep = Representation(group, [1.0, -1.0, 1.0, -1.0])
block_sym = Spinhalf(N, rep)
@show block_sym

# with symmetries and Sz
block_sym_sz = Spinhalf(N, nup, rep)
@show block_sym_sz
@show nsites(block_sym_sz)
@show size(block_sym_sz)

# Iteration
for pstate in block_sym_sz
    @show pstate, index(block_sym_sz, pstate)
end
int N = 4;
int nup = 2;

// without Sz conservation
auto block = Spinhalf(N);
XDIAG_SHOW(block);

// with Sz conservation
auto block_sz = Spinhalf(N, nup);
XDIAG_SHOW(block_sz);

// with symmetries, without Sz
Permutation p1 = {0, 1, 2, 3};
Permutation p2 = {1, 2, 3, 0};
Permutation p3 = {2, 3, 0, 1};
Permutation p4 = {3, 0, 1, 2};
auto group = PermutationGroup({p1, p2, p3, p4});
auto irrep = Representation(group, arma::vec({1, -1, 1, -1}));
auto block_sym = Spinhalf(N, irrep);
XDIAG_SHOW(block_sym);

// with symmetries and Sz
auto block_sym_sz = Spinhalf(N, nup, irrep);
XDIAG_SHOW(block_sym_sz);

XDIAG_SHOW(block_sym_sz.nsites());
XDIAG_SHOW(block_sym_sz.size());

// Iteration
for (auto pstate : block_sym_sz) {
  Log("{} {}", to_string(pstate), block_sym_sz.index(pstate));
}