Learn to Use ITensor

main / formulas / correlator_mps C++v2 | C++v3

Measure a correlator from an MPS wavefunction

See this in a diagrammatic form here.

Sample code:

//Given an MPS or IQMPS called "psi",
//constructed from a SiteSet "sites"

//Replace "Op1" and "Op2" with the actual names
//of the operators you want to measure
auto op_i = sites.op("Op1",i);
auto op_j = sites.op("Op2",j);

//below we will assume j > i

//'gauge' the MPS to site i
//any 'position' between i and j, inclusive, would work here

//psi.Anc(1) *= psi.A(0); //Uncomment if doing iDMRG calculation

//index linking i to i+1:
auto ir = commonIndex(psi.A(i),psi.A(i+1),Link);

auto C = psi.A(i)*op_i*dag(prime(psi.A(i),Site,ir));
for(int k = i+1; k < j; ++k)
    C *= psi.A(k);
    C *= dag(prime(psi.A(k),Link));
C *= psi.A(j);
C *= op_j;
//index linking j to j-1:
auto jl = commonIndex(psi.A(j),psi.A(j-1),Link);
C *= dag(prime(psi.A(j),jl,Site));

auto result = C.real(); //or C.cplx() if expecting complex


Back to Formulas
Back to Main