Learn to Use ITensor

main / classes / spinhalf C++v3 | C++v2

SpinHalf and SpinHalfSite

The SpinHalf class is a specialization of SiteSet which initializes its sites to be of type SpinHalfSite, representing a S=1/2 spin.

The SpinHalfSite class can also be used to create custom SiteSets which mix SpinHalfSites with other types of sites.

SpinHalf and SpinHalfSite are defined in the file "itensor/mps/sites/spinhalf.h"

Synopsis

//Make a spinhalf site with no QNs
auto s = SpinHalfSite({"ConserveQNs=",false});

//Make an Sz operator
auto Sz = op(s,"Sz");

//Get the Index of the site
auto i = index(s);

Print(hasInds(Sz,{i,prime(i)}));

//Make a set of SpinHalfSites
auto sites = SpinHalf(100);

auto Sz3 = op(sites,"Sz",3);

auto Sp4 = op(sites,"S+",4);

//Use IndexVals to get the +,+ element of the Sz operator
auto Szpp = elt(Sz3,sites(3,"Up"),prime(sites(3,"Up")));

Args of a SpinHalfSite

States of a SpinHalfSite

Operators Provided by SpinHalfSite


Back to Classes
Back to Main