Learn to Use ITensor

main / classes / initstate

InitState

A class for initializing matrix product states.

An InitState is constructed by providing a type of SiteSet such as a SpinHalf or Fermion site set. In the documentation below, the allowed "state" strings depend on the SiteSet class used. For example, for the SpinOne siteset allowed state strings are "Up","Z0", and "Dn". For the Electron SiteSet they are "Emp","Up","Dn", and "UpDn". See the documentation for each SiteSet class for further details.

One an InitState object is constructed and all sites are set, it can be used in an MPS constructor to initialize that wavefunction to a specific product state.

Example

const int N = 100;
auto sites = SpinHalf(N);
//First set all spins to be "Up"
auto state = InitState(sites,"Up");
//Now set every other spin to be "Dn" (down)
for(int j = 2; j <= N; j += 2)
    {
    state.set(j,"Dn");
    }

auto neel_state = MPS(state);

Constructors

Accessor Methods


Back to Classes
Back to Main