double HeliumJastrowAnalytical::localEnergy(const mat &r, VMCSolver *solver) { double localEnergy1 = 0; double localEnergy2 = 0; //Grabbing all the necessary constants stored in the solver double charge = solver->getCharge(); double alpha = solver->getAlpha(); double beta = solver->getBeta(); //Precalculating the distances double r1 = norm(r.row(0)); double r2 = norm(r.row(1)); double r12 = norm(r.row(0) - r.row(1)); //The part of the local Energy that was the same as for the first simple case localEnergy1 = (alpha - charge)*(1./r1+1./r2) + 1./(r12) - pow(alpha,2); //The second contribution to the local Energy, I think there is an error here localEnergy2 = 0.5*pow((1+beta*r12),-2) * (alpha*(r1+r2)/r12 * (1. - norm_dot(r.row(0),r.row(1))) - 0.5*pow((1+beta*r12),-2) - 2./r12 + 2.*beta/(1 + beta * r12) ); // cout << endl << "In JastrowAnalytical" << endl; // cout << "LocalEnergy1 is " <<localEnergy1 << endl; // cout << "LocalEnergy2 is " <<localEnergy2 << endl; return localEnergy1 + localEnergy2; }
/*! Angle \theta between \p a and \p b. * \see https://en.wikipedia.org/wiki/Dot_product#Geometric_interpretation */ template<class C> inline pure typename C::value_type angle(const C& a, const C& b) { return std::acos(norm_dot(a, b)); }