void Backflow_pf_wf::getLap(Wavefunction_data * wfdata, int e, Wf_return & lap) { getVal(wfdata,e,lap); for(int d=0; d< ndim+1; d++) { lap.amp(0,d+1)=gradlap(e,d); //cout <<"lap.amp(0,d+1) "<<lap.amp(0,d+1)<<endl; lap.phase(0,d+1)=0; } }
//----------------------------------------------------------------------- void Backflow_pf_wf::getSymmetricVal(Wavefunction_data * wfdata, int e, Wf_return & val){ Array1 <doublevar> si(1, 0.0); Array2 <doublevar> vals(1,1,0.0); val.setVals(vals, si); }
void BCS_wf::getLap(Wavefunction_data * wfdata, int e, Wf_return & lap) { getVal(wfdata,e,lap); for(int d=1; d< 5; d++) { if(spin(e)==0) { for(int det=0; det < ndet; det++) { doublevar temp=0; for(int j=0; j< nelectrons(1); j++) { temp+=derivatives(e,j,d-1) *inverse(det)(e,j); } // // unpaired electrons go into extra one-body orbitals, this // functionality will be resurrected later // //for(int j=nelectrons(1); j < nelectrons(0); j++) { // //error("need to do spin-polarized derivatives"); // temp+=moVal(e,parent->occupation(det,0)(j),d) // *inverse(det)(e,j); //} if(ndet > 1) error("update BCS::getLap() for ndet > 1"); lap.amp(0,d)=parent->magnification_factor*temp; } } else { for(int det=0; det < ndet; det++) { doublevar temp=0; int red=parent->rede(e); for(int i=0; i< nelectrons(0); i++) { temp+=derivatives(i+nelectrons(0),red,d-1) *inverse(det)(i,red); } lap.amp(0,d)=parent->magnification_factor*temp; } } } for(int d=1; d< 5; d++) { lap.phase(0,d)=0.0; } }
void BCS_wf::getVal(Wavefunction_data * wfdata, int e, Wf_return & val) { assert(val.amp.GetDim(0) >=1); assert(val.amp.GetDim(1) >= 1); doublevar funcval=0; for(int det=0; det < ndet; det++) { funcval += detVal(det); } if(fabs(funcval) > 0) val.amp(0,0)=log(fabs(funcval)); else val.amp(0,0)=-1e3; double si=sign(funcval); if(si>0) val.phase(0,0)=0; else val.phase(0,0)=pi; }
void Slat_Jastrow::getVal(Wavefunction_data * wfdata, int e, Wf_return & val) { assert(val.amp.GetDim(0) >= nfunc_); Wf_return slat_val(nfunc_, 2); Wf_return jast_val(nfunc_, 2); Slat_Jastrow_data * dataptr; recast(wfdata, dataptr); assert(dataptr != NULL); slater_wf->getVal(dataptr->slater, e, slat_val); jastrow_wf->getVal(dataptr->jastrow, e, jast_val); if ( slat_val.is_complex==1 || jast_val.is_complex==1 ) val.is_complex=1; for(int i=0; i< nfunc_; i++) { val.phase(i,0)=slat_val.phase(i,0)+jast_val.phase(i,0); val.amp(i,0)=slat_val.amp(i,0)+jast_val.amp(i,0); //add the logarithm } }
// JK: complex wavefunctions still behave weird, let's try to rewrite even // this one, not touching cvals now, though // The most important is setting is_complex, but I do differ at other places // too. void Slat_Jastrow::getLap(Wavefunction_data * wfdata, int e, Wf_return & lap) { //cout << "getLap\n"; assert(lap.amp.GetDim(0) >= nfunc_); assert(lap.amp.GetDim(1) >= 5); Slat_Jastrow_data * dataptr; recast(wfdata, dataptr); assert(dataptr != NULL); Wf_return slat_lap(nfunc_,5); Wf_return jast_lap(nfunc_,5); slater_wf->getLap(dataptr->slater, e, slat_lap); jastrow_wf->getLap(dataptr->jastrow, e, jast_lap); if ( slat_lap.is_complex==1 || jast_lap.is_complex==1 ) lap.is_complex=1; for(int i=0; i< nfunc_; i++) { lap.phase(i,0)=slat_lap.phase(i,0)+jast_lap.phase(i,0); lap.amp(i,0)=slat_lap.amp(i,0)+jast_lap.amp(i,0); doublevar dotproduct=0; dcomplex dot(0.0, 0.0); for(int d=1; d<4; d++) { lap.amp(i,d)=slat_lap.amp(i,d)+jast_lap.amp(i,d); lap.phase(i,d)=slat_lap.phase(i,d)+jast_lap.phase(i,d); dotproduct+=slat_lap.amp(i,d)*jast_lap.amp(i,d); lap.cvals(i,d)=slat_lap.cvals(i,d)+jast_lap.cvals(i,d); dot+=slat_lap.cvals(i,d)*jast_lap.cvals(i,d); } lap.amp(i,4)=slat_lap.amp(i,4)+jast_lap.amp(i,4) +2*dotproduct; lap.phase(i,4)=slat_lap.phase(i,4)+jast_lap.phase(i,4); lap.cvals(i,4)=slat_lap.cvals(i,4)+jast_lap.cvals(i,4) +2.0*dot; } }
void Slat_Jastrow::getSymmetricVal(Wavefunction_data * wfdata, int e, Wf_return & val){ Wf_return slat_val(nfunc_, 2); Wf_return jast_val(nfunc_, 2); Slat_Jastrow_data * dataptr; recast(wfdata, dataptr); assert(dataptr != NULL); slater_wf->getSymmetricVal(dataptr->slater, e, slat_val); jastrow_wf->getSymmetricVal(dataptr->jastrow, e, jast_val); //cout <<"slat_val.amp(0,0) "<<slat_val.amp(0,0)<<" jast_val.amp(0,0) "<<jast_val.amp(0,0)<<endl; for(int i=0; i< nfunc_; i++) { val.amp(i,0)=slat_val.amp(i,0)+jast_val.amp(i,0); //add the logarithm } }
void Backflow_pf_wf::getVal(Wavefunction_data * wfdata, int e, Wf_return & val) { Array1 <doublevar> si(1, 0.0); Array2 <doublevar> vals(1,1,0.0); assert(val.amp.GetDim(0) >=1); assert(val.amp.GetDim(1) >= 1); doublevar funcval=0; for (int pf=0;pf<npf;pf++) funcval += parent->pfkeeper.pfwt(pf)*pfaffVal(pf); if(fabs(funcval) > 0) vals(0,0)=log(fabs(funcval)); else vals(0,0)=-1e3; si(0)=sign(funcval); val.setVals(vals, si); }