double SpinAdapted::det_energy (const Slater& s) { // energy of a single slater determinant, used in truncation double energy = 0; Slater bra; Slater ket; for (int i = 0; i < s.size (); ++i) { ket = s; bra = s; energy += ket.trace (bra.d(i).c(i)) * v_1 (i,i); } // diagonal for (int i = 0; i < s.size (); ++i) for (int j = 0; j < s.size (); ++j) { ket = s; bra = s; energy += .5 * ket.trace (bra.d(j).d(i).c(j).c(i)) * (v_2 (i,j,j,i) - v_2 (i,j,i,j)); } return energy; }
void SpinAdapted::Csf::applyRowminus(Csf& output, int irrep) { map<Slater, double>::iterator itout, it = det_rep.begin(); map<Slater, double> detsout; for ( ; it!= det_rep.end(); it++) for (int i=0; i<dmrginp.last_site(); i++) { if (SymmetryOfSpatialOrb(i).getirrep() != irrep) continue; int I = dmrginp.spatial_to_spin()[i]; for (int j=0; j<2; j++) { Slater s = (*it).first; int sign = s.getSign(); s.d(I+2+j).c(I+j); s.setSign(sign); //This is a hack. if ( !s.isempty()) { itout = detsout.find(s); if (itout == detsout.end()) detsout[s] = (*it).second; else detsout[s] += (*it).second; } } } output.set_det_rep(detsout, S, IrrepVector(this->irrep.getirrep(), 0)); }
void SpinAdapted::Csf::applySminus(Csf& output) { map<Slater, double>::iterator itout, it = det_rep.begin(); map<Slater, double> detsout; for ( ; it!= det_rep.end(); it++) for (int i=0; i<Slater().size(); i+=2) { Slater s = (*it).first; s.d(i).c(i+1); if ( !s.isempty()) { itout = detsout.find(s); if (itout == detsout.end()) detsout[s] = (*it).second; else detsout[s] += (*it).second; } } output.set_det_rep(detsout, S, irrep); output.set_S(S); output.set_Sz(Sz-2); output.set_n(n); output.normalize(); }