Learn to Use ITensor

main / classes / siteset


Class for specifying the local Hilbert space of each site of a lattice by storing the associated site index. A SiteSet does not store any information about the topology of the lattice, just the number of sites and information about each site.

ITensor comes with specialized subclasses of SiteSet, such as the SpinHalf and SpinOne classes, which provide facilities to create sites of a certain type (S=1/2 or S=1 spins, for example). However, these classes differ from SiteSet mainly in their constructors and read/write methods; after creating a specialized SiteSet type (such as SpinHalf) it can be safely converted to the base SiteSet type (for example, in the following code: SiteSet sites = SpinHalf(N);) without losing information about the underlying site type.


SiteSet sites = SpinHalf(100);

Print(sites.N()); //prints: sites.N() = 100

sites(3); //retrieve the IQIndex defining site number 3

sites(3,"Up"); //obtain the IQIndexVal defining the "Up" state at site number 3

sites.op("Sz",3); //obtain the "Sz" operator at site number 3

SiteSet Interface

Operators Defined Automatically for all site types

Regardless of the specialized operators defined by each custom site type (such as the SpinHalfSite site type), the SiteSet class automatically provides the following operators which can be retrived as described from the .op method.

Back to Classes
Back to Main