16 #ifndef QMCPLUSPLUS_BACKFLOW_E_E_H 17 #define QMCPLUSPLUS_BACKFLOW_E_E_H 58 auto clone = std::make_unique<Backflow_ee<FT>>(tqp, tqp);
69 for (
int i = 0; i <
RadFun.size(); i++)
76 clone->RadFun[i] =
clone->uniqueRadFun[k].get();
81 APP_ABORT(
"Error cloning Backflow_ee object. \n");
87 void addFunc(
int ia,
int ib, std::unique_ptr<FT> rf)
92 for (
int i = 0; i <
RadFun.size(); i++)
158 for (
int i = 0; i < num; i++)
166 for (
int i = 0; i < num; i++)
172 for (
int i = 0; i < num; i++)
180 for (
int i = 0; i < num; i++)
186 for (
int i = 0; i < num; i++)
192 for (
int i = 0; i < num; i++)
200 for (
int i = 0; i < num; i++)
206 for (
int i = 0; i < num; i++)
212 for (
int i = 0; i < num; i++)
224 inline void restore(
int iat,
int UpdateType)
override 235 APP_ABORT(
"Backflow_ee.h::evaluate(P,QP) not implemented for SoA\n");
255 APP_ABORT(
"This shouldn't be called: Backflow_ee::evaluate(Bmat)");
257 APP_ABORT(
"Backflow_ee.h::evaluate(P,QP,Bmat_vec,Amat) not implemented for SoA\n");
301 for (
int iat = P.
first(ig), last = P.
last(ig); iat < last; ++iat)
304 const auto& displ = myTable.getDisplRow(iat);
305 for (
int jat = 0; jat < iat; ++jat)
313 UIJ(iat, jat) = -1.0 * u;
326 AIJ(jat, iat) = hess;
327 Amat(iat, iat) += hess;
328 Amat(jat, jat) += hess;
329 Amat(iat, jat) -= hess;
330 Amat(jat, iat) -= hess;
332 grad = (d2u + (
OHMMS_DIM + 1) * du) * displ[jat];
333 BIJ(iat, jat) = -1.0 * grad;
334 Bmat_full(iat, iat) -= grad;
335 Bmat_full(jat, jat) += grad;
336 Bmat_full(iat, jat) += grad;
337 Bmat_full(jat, iat) -= grad;
348 const std::vector<int>& index)
override 350 APP_ABORT(
"Backflow_ee.h::evaluatePbyP(P,QP,index_vec) not implemented for SoA\n");
371 for (
int i = 0; i < iat; i++)
393 const std::vector<int>& index,
396 APP_ABORT(
"Backflow_ee.h::evaluatePbyP(P,QP,index_vec,Amat) not implemented for SoA\n");
432 for (
int j = 0; j < iat; j++)
434 if (myTable.getTempDists()[j] > 0)
441 hess = (du / myTable.getTempDists()[j]) *
outerProduct(myTable.getTempDispls()[j], myTable.getTempDispls()[j]);
451 Amat(iat, iat) += dA;
459 if (myTable.getTempDists()[j] > 0)
466 hess = (du / myTable.getTempDists()[j]) *
outerProduct(myTable.getTempDispls()[j], myTable.getTempDispls()[j]);
476 Amat(iat, iat) += dA;
488 const std::vector<int>& index,
492 APP_ABORT(
"Backflow_ee.h::evaluatePbyP(P,QP,index_vec,Bmat,Amat) not implemented for SoA\n");
539 APP_ABORT(
"Backflow_ee.h::evaluatePbyP(P,iat,QP,Bmat,Amat) not implemented for SoA\n");
610 APP_ABORT(
"Backflow_ee.h::evaluateBmatOnly(P,QP,Bmat_full) not implemented for SoA\n");
643 for (
int iat = P.
first(ig), last = P.
last(ig); iat < last; ++iat)
646 const auto& displ = myTable.getDisplRow(iat);
647 for (
int jat = 0; jat < iat; ++jat)
655 std::vector<TinyVector<RealType, 3>> derivsju(numParamJU);
656 RadFun[
PairID(iat, jat)]->evaluateDerivatives(dist[jat], derivsju);
660 UIJ(iat, jat) = -1.0 * u;
674 Amat(iat, iat) += hess;
675 Amat(jat, jat) += hess;
676 Amat(iat, jat) -= hess;
677 Amat(jat, iat) -= hess;
681 grad = (d2u + (
OHMMS_DIM + 1) * du) * displ[jat];
682 BIJ(iat, jat) = -1.0 * grad;
683 Bmat_full(iat, iat) -= grad;
684 Bmat_full(jat, jat) += grad;
685 Bmat_full(iat, jat) += grad;
686 Bmat_full(jat, iat) -= grad;
689 PosType uk = displ[jat] * derivsju[prm][0];
692 Xmat(la, iat, jat) -= (derivsju[prm][1] / dist[jat]) * op;
694 Xmat(la, iat, jat)[0] -= derivsju[prm][0];
695 Xmat(la, iat, jat)[4] -= derivsju[prm][0];
696 Xmat(la, iat, jat)[8] -= derivsju[prm][0];
698 Xmat(la, iat, jat)[0] -= derivsju[prm][0];
699 Xmat(la, iat, jat)[3] -= derivsju[prm][0];
701 Xmat(la, jat, iat) += Xmat(la, iat, jat);
702 Xmat(la, iat, iat) -= Xmat(la, iat, jat);
703 Xmat(la, jat, jat) -= Xmat(la, iat, jat);
704 uk = 2.0 * (derivsju[prm][2] + (
OHMMS_DIM + 1) * derivsju[prm][1] / dist[jat]) * displ[jat];
void evaluate(const ParticleSet &P, ParticleSet &QP, GradVector &Bmat, HessMatrix &Amat)
int NumTargets
number of quantum particles
void evaluateWithDerivatives(const ParticleSet &P, ParticleSet &QP, GradMatrix &Bmat_full, HessMatrix &Amat, GradMatrix &Cmat, GradMatrix &Ymat, HessArray &Xmat) override
calculate quasi-particle coordinates, Bmat and Amat calculate derivatives wrt to variational paramete...
std::unique_ptr< BackflowFunctionBase > makeClone(ParticleSet &tqp) const override
helper functions for EinsplineSetBuilder
const DistanceTableAA & getDistTableAA(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAA
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index, GradMatrix &Bmat, HessMatrix &Amat) override
calculate quasi-particle coordinates and Amat after pbyp move
const int myTableIndex_
distance table index
For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
void acceptMove(int iat, int UpdateMode) override
Base class for backflow transformations.
int first(int igroup) const
return the first index of a group i
void resize(size_type n, size_type m)
Resize the container.
Attaches a unit to a Vector for IO.
ParticleIndex GroupID
Species ID.
void evaluatePbyP(const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP, GradMatrix &Bmat, HessMatrix &Amat) override
calculate quasi-particle coordinates and Amat after pbyp move
std::vector< std::unique_ptr< FT > > uniqueRadFun
int groups() const
return the number of groups
Specialized paritlce class for atomistic simulations.
void evaluate(const ParticleSet &P, ParticleSet &QP, GradMatrix &Bmat_full, HessMatrix &Amat) override
calculate quasi-particle coordinates, Bmat and Amat
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index, HessMatrix &Amat) override
calculate quasi-particle coordinates and Amat after pbyp move
void evaluateBmatOnly(const ParticleSet &P, GradMatrix &Bmat_full) override
calculate only Bmat This is used in pbyp moves, in updateBuffer()
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > outerProduct(const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
void reportStatus(std::ostream &os) override
int indexOffset() override
class to handle a set of variables that can be modified during optimizations
void checkOutVariables(const opt_variables_type &active) override
void evaluatePbyP(const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP) override
calculate quasi-particle coordinates after pbyp move
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
bool isOptimizable() override
void evaluate(const ParticleSet &P, ParticleSet &QP) override
calculate quasi-particle coordinates only
int last(int igroup) const
return the last index of a group i
const DistRow & getDistRow(int iel) const
return a row of distances for a given target particle
void checkInVariables(opt_variables_type &active) override
std::vector< int > offsetPrms
std::vector< FT * > RadFun
void registerData(WFBufferType &buf) override
Backflow_ee(ParticleSet &ions, ParticleSet &els)
void addFunc(int ia, int ib, std::unique_ptr< FT > rf)
std::vector< TinyVector< RealType, 3 > > derivs
void resize(int NT, int NC)
void evaluatePbyP(const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP, HessMatrix &Amat) override
calculate quasi-particle coordinates and Amat after pbyp move
void resetParameters(const opt_variables_type &active) override
void restore(int iat, int UpdateType) override
Vector< PosType > UIJ_temp
whether temporary data set on the host is updated or not when a move is proposed. ...
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index) override
calculate quasi-particle coordinates after pbyp move
void add(std::complex< T1 > &x)