Skip to content

Commit

Permalink
Merge pull request #355 from emstoudenmire/fix_total_qn
Browse files Browse the repository at this point in the history
Fix totalQN function to always succeed if lims set
  • Loading branch information
emstoudenmire committed May 8, 2020
2 parents 26f0783 + b95625f commit 0beccc5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions itensor/mps/mpsalgs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,14 @@ checkQNs(MPS const& psi)
QN
totalQN(MPS const& psi)
{
const int center = findCenter(psi);
if(center == -1)
Error("Could not find ortho. center");
return div(psi(center));
auto tq = QN();
auto sj = psi.leftLim()+1;
auto ej = psi.rightLim()-1;
for(int j = sj; j <= ej; ++j)
{
tq += flux(psi(j));
}
return tq;
}

} //namespace itensor

0 comments on commit 0beccc5

Please sign in to comment.