QMCPACK
Backflow_eI< FT > Class Template Reference
+ Inheritance diagram for Backflow_eI< FT >:
+ Collaboration diagram for Backflow_eI< FT >:

Public Member Functions

 Backflow_eI (ParticleSet &ions, ParticleSet &els)
 
 Backflow_eI (ParticleSet &ions, ParticleSet &els, FT *RF)
 
std::unique_ptr< BackflowFunctionBase > makeClone (ParticleSet &tqp) const override
 
void reportStatus (std::ostream &os) override
 
void resetParameters (const opt_variables_type &active) override
 
void checkInVariables (opt_variables_type &active) override
 
void checkOutVariables (const opt_variables_type &active) override
 
bool isOptimizable () override
 
int indexOffset () override
 
void acceptMove (int iat, int UpdateMode) override
 
void restore (int iat, int UpdateType) override
 
void registerData (WFBufferType &buf) override
 
void evaluate (const ParticleSet &P, ParticleSet &QP) override
 calculate quasi-particle coordinates only More...
 
void evaluate (const ParticleSet &P, ParticleSet &QP, GradVector &Bmat, HessMatrix &Amat)
 
void evaluate (const ParticleSet &P, ParticleSet &QP, GradMatrix &Bmat_full, HessMatrix &Amat) override
 calculate quasi-particle coordinates, Bmat and Amat More...
 
void evaluatePbyP (const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index) override
 calculate quasi-particle coordinates after pbyp move More...
 
void evaluatePbyP (const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP) override
 calculate quasi-particle coordinates after pbyp move More...
 
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 More...
 
void evaluatePbyP (const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP, HessMatrix &Amat) override
 calculate quasi-particle coordinates and Amat after pbyp move More...
 
void evaluatePbyP (const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index, GradMatrix &Bmat_full, HessMatrix &Amat) override
 calculate quasi-particle coordinates, Bmat and Amat after pbyp move More...
 
void evaluatePbyP (const ParticleSet &P, int iat, ParticleSet::ParticlePos &newQP, GradMatrix &Bmat_full, HessMatrix &Amat) override
 calculate quasi-particle coordinates, Bmat and Amat after pbyp move More...
 
void evaluateBmatOnly (const ParticleSet &P, GradMatrix &Bmat_full) override
 calculate only Bmat This is used in pbyp moves, in updateBuffer() More...
 
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 parameters More...
 
- Public Member Functions inherited from BackflowFunctionBase
 BackflowFunctionBase (ParticleSet &ions, ParticleSet &els)
 
void resize (int NT, int NC)
 
virtual ~BackflowFunctionBase ()
 
int setParamIndex (int n)
 
void updateBuffer (WFBufferType &buf)
 
void copyFromBuffer (WFBufferType &buf)
 

Public Attributes

std::vector< FT * > RadFun
 
std::vector< std::unique_ptr< FT > > uniqueRadFun
 
std::vector< int > offsetPrms
 
- Public Attributes inherited from BackflowFunctionBase
ParticleSet & CenterSys
 Reference to the center. More...
 
int NumCenters
 number of centers, e.g., ions More...
 
int NumTargets
 number of quantum particles More...
 
int numParams
 
int indexOfFirstParam
 
std::vector< TinyVector< RealType, 3 > > derivs
 
Matrix< PosType > UIJ
 
Vector< PosType > UIJ_temp
 
HessMatrix AIJ
 
HessVector AIJ_temp
 
GradMatrix BIJ
 
GradVector BIJ_temp
 
RealType * FirstOfU
 
RealType * LastOfU
 
RealType * FirstOfA
 
RealType * LastOfA
 
RealType * FirstOfB
 
RealType * LastOfB
 
bool uniqueFunctions
 
opt_variables_type myVars
 

Private Attributes

const int myTableIndex_
 distance table index More...
 

Additional Inherited Members

- Public Types inherited from BackflowFunctionBase
enum  { DIM = OHMMS_DIM }
 
enum  {
  ORB_PBYP_RATIO, ORB_PBYP_ALL, ORB_PBYP_PARTIAL, ORB_WALKER,
  ORB_ALLWALKER
}
 enum for a update mode More...
 
using Walker_t = ParticleSet::Walker_t
 
using WFBufferType = Walker_t::WFBuffer_t
 
using RealType = OHMMS_PRECISION
 
using IndexType = int
 
using PosType = TinyVector< RealType, DIM >
 
using GradType = TinyVector< RealType, DIM >
 
using HessType = Tensor< RealType, DIM >
 
using IndexVector = Vector< IndexType >
 
using GradVector = Vector< GradType >
 
using GradMatrix = Matrix< GradType >
 
using HessVector = Vector< HessType >
 
using HessMatrix = Matrix< HessType >
 
using HessArray = Array< HessType, 3 >
 

Detailed Description

template<class FT>
class qmcplusplus::Backflow_eI< FT >

Definition at line 26 of file Backflow_eI.h.

Constructor & Destructor Documentation

◆ Backflow_eI() [1/2]

Backflow_eI ( ParticleSet &  ions,
ParticleSet &  els 
)
inline

Definition at line 37 of file Backflow_eI.h.

References BackflowFunctionBase::NumCenters, BackflowFunctionBase::NumTargets, and BackflowFunctionBase::resize().

37  : BackflowFunctionBase(ions, els), myTableIndex_(els.addTable(ions))
38  {
40  }
int NumTargets
number of quantum particles
int NumCenters
number of centers, e.g., ions
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30
BackflowFunctionBase(ParticleSet &ions, ParticleSet &els)

◆ Backflow_eI() [2/2]

Backflow_eI ( ParticleSet &  ions,
ParticleSet &  els,
FT *  RF 
)
inline

Definition at line 43 of file Backflow_eI.h.

References BackflowFunctionBase::NumCenters, Backflow_eI< FT >::RadFun, and Backflow_eI< FT >::uniqueRadFun.

44  : BackflowFunctionBase(ions, els), myTableIndex_(els.addTable(ions))
45  {
46  // same radial function for all centers by default
47  uniqueRadFun.push_back(RF);
48  for (int i = 0; i < NumCenters; i++)
49  RadFun.push_back(RF);
50  }
int NumCenters
number of centers, e.g., ions
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30
BackflowFunctionBase(ParticleSet &ions, ParticleSet &els)
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

Member Function Documentation

◆ acceptMove()

void acceptMove ( int  iat,
int  UpdateMode 
)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 122 of file Backflow_eI.h.

References BackflowFunctionBase::AIJ, BackflowFunctionBase::AIJ_temp, BackflowFunctionBase::BIJ, BackflowFunctionBase::BIJ_temp, Matrix< T, Alloc >::cols(), BackflowFunctionBase::ORB_PBYP_ALL, BackflowFunctionBase::ORB_PBYP_PARTIAL, BackflowFunctionBase::ORB_PBYP_RATIO, BackflowFunctionBase::UIJ, and BackflowFunctionBase::UIJ_temp.

123  {
124  int num;
125  switch (UpdateMode)
126  {
127  case ORB_PBYP_RATIO:
128  num = UIJ.cols();
129  for (int i = 0; i < num; i++)
130  UIJ(iat, i) = UIJ_temp[i];
131  break;
132  case ORB_PBYP_PARTIAL:
133  num = UIJ.cols();
134  for (int i = 0; i < num; i++)
135  UIJ(iat, i) = UIJ_temp[i];
136  num = AIJ.cols();
137  for (int i = 0; i < num; i++)
138  AIJ(iat, i) = AIJ_temp[i];
139  break;
140  case ORB_PBYP_ALL:
141  num = UIJ.cols();
142  for (int i = 0; i < num; i++)
143  UIJ(iat, i) = UIJ_temp[i];
144  num = AIJ.cols();
145  for (int i = 0; i < num; i++)
146  AIJ(iat, i) = AIJ_temp[i];
147  num = BIJ.cols();
148  for (int i = 0; i < num; i++)
149  BIJ(iat, i) = BIJ_temp[i];
150  break;
151  default:
152  num = UIJ.cols();
153  for (int i = 0; i < num; i++)
154  UIJ(iat, i) = UIJ_temp[i];
155  num = AIJ.cols();
156  for (int i = 0; i < num; i++)
157  AIJ(iat, i) = AIJ_temp[i];
158  num = BIJ.cols();
159  for (int i = 0; i < num; i++)
160  BIJ(iat, i) = BIJ_temp[i];
161  break;
162  }
163  UIJ_temp = 0.0;
164  AIJ_temp = 0.0;
165  BIJ_temp = 0.0;
166  }
size_type cols() const
Definition: OhmmsMatrix.h:78

◆ checkInVariables()

void checkInVariables ( opt_variables_type &  active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 99 of file Backflow_eI.h.

References Backflow_eI< FT >::uniqueRadFun.

100  {
101  for (int i = 0; i < uniqueRadFun.size(); i++)
102  uniqueRadFun[i]->checkInVariablesExclusive(active);
103  }
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ checkOutVariables()

void checkOutVariables ( const opt_variables_type &  active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 105 of file Backflow_eI.h.

References Backflow_eI< FT >::uniqueRadFun.

106  {
107  for (int i = 0; i < uniqueRadFun.size(); i++)
108  uniqueRadFun[i]->checkOutVariables(active);
109  }
void checkOutVariables(const opt_variables_type &active) override
Definition: Backflow_eI.h:105
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ evaluate() [1/3]

void evaluate ( const ParticleSet &  P,
ParticleSet &  QP 
)
inlineoverridevirtual

calculate quasi-particle coordinates only

Implements BackflowFunctionBase.

Definition at line 190 of file Backflow_eI.h.

References APP_ABORT.

191  {
192  APP_ABORT("Backflow_eI.h::evaluate(P,QP) not implemented for SoA\n");
193  //RealType du, d2u;
194  //const auto& myTable = P.getDistTableAB(myTableIndex_);
195  //for (int i = 0; i < myTable.sources(); i++)
196  //{
197  // for (int nn = myTable.M[i]; nn < myTable.M[i + 1]; nn++)
198  // {
199  // int j = myTable.J[nn];
200  // RealType uij = RadFun[i]->evaluate(myTable.r(nn), du, d2u);
201  // QP.R[j] += (UIJ(j, i) = uij * myTable.dr(nn)); // dr(ij) = r_j-r_i
202  // }
203  //}
204  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluate() [2/3]

void evaluate ( const ParticleSet &  P,
ParticleSet &  QP,
GradVector &  Bmat,
HessMatrix &  Amat 
)
inline

Definition at line 207 of file Backflow_eI.h.

References APP_ABORT.

208  {
209  APP_ABORT("Backflow_eI.h::evaluate(P,QP,Bmat_vec,Amat) not implemented for SoA\n");
210  //RealType du, d2u;
211  //const auto& myTable = P.getDistTableAB(myTableIndex_);
212  //for (int i = 0; i < myTable.sources(); i++)
213  //{
214  // for (int nn = myTable.M[i]; nn < myTable.M[i + 1]; nn++)
215  // {
216  // int j = myTable.J[nn];
217  // RealType uij = RadFun[i]->evaluate(myTable.r(nn), du, d2u);
218  // //PosType u = uij*myTable.dr(nn);
219  // du *= myTable.rinv(nn);
220  // QP.R[j] += (UIJ(j, i) = uij * myTable.dr(nn));
221  // HessType& hess = AIJ(j, i);
222  // hess = du * outerProduct(myTable.dr(nn), myTable.dr(nn));
223  // hess[0] += uij;
224  // hess[4] += uij;
225  // hess[8] += uij;
226  // Amat(j, j) += hess;
227  // //u = (d2u+4.0*du)*myTable.dr(nn);
228  // Bmat[j] += (BIJ(j, i) = (d2u + 4.0 * du) * myTable.dr(nn));
229  // }
230  //}
231  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluate() [3/3]

void evaluate ( const ParticleSet &  P,
ParticleSet &  QP,
GradMatrix &  Bmat_full,
HessMatrix &  Amat 
)
inlineoverridevirtual

calculate quasi-particle coordinates, Bmat and Amat

Implements BackflowFunctionBase.

Definition at line 236 of file Backflow_eI.h.

References BackflowFunctionBase::AIJ, BackflowFunctionBase::BIJ, DistanceTableAB::getDistRow(), ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), Backflow_eI< FT >::myTableIndex_, BackflowFunctionBase::NumCenters, qmcplusplus::outerProduct(), ParticleSet::R, Backflow_eI< FT >::RadFun, and BackflowFunctionBase::UIJ.

237  {
238  RealType du, d2u;
239  const auto& myTable = P.getDistTableAB(myTableIndex_);
240  for (int jel = 0; jel < P.getTotalNum(); jel++)
241  {
242  const auto& dist = myTable.getDistRow(jel);
243  const auto& displ = myTable.getDisplRow(jel);
244  for (int iat = 0; iat < NumCenters; iat++)
245  {
246  if (dist[iat] > 0)
247  {
248  RealType uij = RadFun[iat]->evaluate(dist[iat], du, d2u);
249  du /= dist[iat];
250  QP.R[jel] += (UIJ(jel, iat) = -uij * displ[iat]);
251  HessType& hess = AIJ(jel, iat);
252  hess = du * outerProduct(displ[iat], displ[iat]);
253  hess[0] += uij;
254  hess[4] += uij;
255  hess[8] += uij;
256  Amat(jel, jel) += hess;
257  // this will create problems with QMC_COMPLEX, because Bmat is ValueType and dr is RealType
258  //u = (d2u+4.0*du)*myTable.dr(nn);
259  Bmat_full(jel, jel) += (BIJ(jel, iat) = -(d2u + 4.0 * du) * displ[iat]);
260  }
261  }
262  }
263  }
int NumCenters
number of centers, e.g., ions
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > outerProduct(const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
Definition: TinyVector.h:211
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
QMCTraits::RealType RealType
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30

◆ evaluateBmatOnly()

void evaluateBmatOnly ( const ParticleSet &  P,
GradMatrix &  Bmat_full 
)
inlineoverridevirtual

calculate only Bmat This is used in pbyp moves, in updateBuffer()

Implements BackflowFunctionBase.

Definition at line 406 of file Backflow_eI.h.

References APP_ABORT.

407  {
408  APP_ABORT("Backflow_eI.h::evaluateBmatOnly(P,QP,Bmat) not implemented for SoA\n");
409  //RealType du, d2u;
410  //const auto& myTable = P.getDistTableAB(myTableIndex_);
411  //for (int i = 0; i < myTable.sources(); i++)
412  //{
413  // for (int nn = myTable.M[i]; nn < myTable.M[i + 1]; nn++)
414  // {
415  // int j = myTable.J[nn];
416  // RealType uij = RadFun[i]->evaluate(myTable.r(nn), du, d2u);
417  // Bmat_full(j, j) += (BIJ(j, i) = (d2u + 4.0 * du * myTable.rinv(nn)) * myTable.dr(nn));
418  // }
419  //}
420  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluatePbyP() [1/6]

void evaluatePbyP ( const ParticleSet &  P,
ParticleSet::ParticlePos &  newQP,
const std::vector< int > &  index 
)
inlineoverridevirtual

calculate quasi-particle coordinates after pbyp move

Implements BackflowFunctionBase.

Definition at line 267 of file Backflow_eI.h.

References APP_ABORT.

270  {
271  APP_ABORT("Backflow_eI.h::evaluatePbyP(P,QP,index_vec) not implemented for SoA\n");
272  //RealType du, d2u;
273  //const auto& myTable = P.getDistTableAB(myTableIndex_);
274  //int maxI = myTable.sources();
275  //int iat = index[0];
276  //for (int j = 0; j < maxI; j++)
277  //{
278  // RealType uij = RadFun[j]->evaluate(myTable.Temp[j].r1, du, d2u);
279  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
280  // newQP[iat] += u;
281  //}
282  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluatePbyP() [2/6]

void evaluatePbyP ( const ParticleSet &  P,
int  iat,
ParticleSet::ParticlePos &  newQP 
)
inlineoverridevirtual

calculate quasi-particle coordinates after pbyp move

Implements BackflowFunctionBase.

Definition at line 287 of file Backflow_eI.h.

References ParticleSet::getDistTableAB(), Backflow_eI< FT >::myTableIndex_, Backflow_eI< FT >::RadFun, DistanceTable::sources(), BackflowFunctionBase::UIJ, and BackflowFunctionBase::UIJ_temp.

288  {
289  RealType du, d2u;
290  const auto& myTable = P.getDistTableAB(myTableIndex_);
291  int maxI = myTable.sources();
292  for (int j = 0; j < maxI; j++)
293  {
294  RealType uij = RadFun[j]->evaluate(myTable.getTempDists()[j], du, d2u);
295  PosType u = (UIJ_temp[j] = -uij * myTable.getTempDispls()[j]) - UIJ(iat, j);
296  newQP[iat] += u;
297  }
298  }
QMCTraits::PosType PosType
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
QMCTraits::RealType RealType
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30

◆ evaluatePbyP() [3/6]

void evaluatePbyP ( const ParticleSet &  P,
ParticleSet::ParticlePos &  newQP,
const std::vector< int > &  index,
HessMatrix &  Amat 
)
inlineoverridevirtual

calculate quasi-particle coordinates and Amat after pbyp move

Implements BackflowFunctionBase.

Definition at line 300 of file Backflow_eI.h.

References APP_ABORT.

304  {
305  APP_ABORT("Backflow_eI.h::evaluatePbyP(P,QP,index_vec,Amat) not implemented for SoA\n");
306  //RealType du, d2u;
307  //const auto& myTable = P.getDistTableAB(myTableIndex_);
308  //int maxI = myTable.sources();
309  //int iat = index[0];
310  //for (int j = 0; j < maxI; j++)
311  //{
312  // RealType uij = RadFun[j]->evaluate(myTable.Temp[j].r1, du, d2u);
313  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
314  // newQP[iat] += u;
315  // HessType& hess = AIJ_temp[j];
316  // hess = (du * myTable.Temp[j].rinv1) * outerProduct(myTable.Temp[j].dr1, myTable.Temp[j].dr1);
317  // hess[0] += uij;
318  // hess[4] += uij;
319  // hess[8] += uij;
320  // // should I expand this??? Is the compiler smart enough???
321  // Amat(iat, iat) += (hess - AIJ(iat, j));
322  //}
323  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluatePbyP() [4/6]

void evaluatePbyP ( const ParticleSet &  P,
int  iat,
ParticleSet::ParticlePos &  newQP,
HessMatrix &  Amat 
)
inlineoverridevirtual

calculate quasi-particle coordinates and Amat after pbyp move

Implements BackflowFunctionBase.

Definition at line 325 of file Backflow_eI.h.

References BackflowFunctionBase::AIJ, BackflowFunctionBase::AIJ_temp, ParticleSet::getDistTableAB(), Backflow_eI< FT >::myTableIndex_, qmcplusplus::outerProduct(), Backflow_eI< FT >::RadFun, DistanceTable::sources(), BackflowFunctionBase::UIJ, and BackflowFunctionBase::UIJ_temp.

326  {
327  RealType du, d2u;
328  const auto& myTable = P.getDistTableAB(myTableIndex_);
329  int maxI = myTable.sources();
330  for (int j = 0; j < maxI; j++)
331  {
332  if (myTable.getTempDists()[j] > 0)
333  {
334  RealType uij = RadFun[j]->evaluate(myTable.getTempDists()[j], du, d2u);
335  PosType u = (UIJ_temp[j] = -uij * myTable.getTempDispls()[j]) - UIJ(iat, j);
336  newQP[iat] += u;
337  HessType& hess = AIJ_temp[j];
338  hess = (du / myTable.getTempDists()[j]) * outerProduct(myTable.getTempDispls()[j], myTable.getTempDispls()[j]);
339  hess[0] += uij;
340  hess[4] += uij;
341  hess[8] += uij;
342  // should I expand this??? Is the compiler smart enough???
343  Amat(iat, iat) += (hess - AIJ(iat, j));
344  }
345  }
346  }
QMCTraits::PosType PosType
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > outerProduct(const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
Definition: TinyVector.h:211
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
QMCTraits::RealType RealType
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30

◆ evaluatePbyP() [5/6]

void evaluatePbyP ( const ParticleSet &  P,
ParticleSet::ParticlePos &  newQP,
const std::vector< int > &  index,
GradMatrix &  Bmat,
HessMatrix &  Amat 
)
inlineoverridevirtual

calculate quasi-particle coordinates, Bmat and Amat after pbyp move

Implements BackflowFunctionBase.

Definition at line 348 of file Backflow_eI.h.

References APP_ABORT.

353  {
354  APP_ABORT("Backflow_eI.h::evaluatePbyP(P,QP,index_vec,Bmat,Amat) not implemented for SoA\n");
355  //RealType du, d2u;
356  //const auto& myTable = P.getDistTableAB(myTableIndex_);
357  //int maxI = myTable.sources();
358  //int iat = index[0];
359  //for (int j = 0; j < maxI; j++)
360  //{
361  // RealType uij = RadFun[j]->evaluate(myTable.Temp[j].r1, du, d2u);
362  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
363  // newQP[iat] += u;
364  // du *= myTable.Temp[j].rinv1;
365  // HessType& hess = AIJ_temp[j];
366  // hess = du * outerProduct(myTable.Temp[j].dr1, myTable.Temp[j].dr1);
367  // hess[0] += uij;
368  // hess[4] += uij;
369  // hess[8] += uij;
370  // Amat(iat, iat) += (hess - AIJ(iat, j));
371  // BIJ_temp[j] = (d2u + 4.0 * du) * myTable.Temp[j].dr1;
372  // Bmat_full(iat, iat) += (BIJ_temp[j] - BIJ(iat, j));
373  //}
374  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluatePbyP() [6/6]

void evaluatePbyP ( const ParticleSet &  P,
int  iat,
ParticleSet::ParticlePos &  newQP,
GradMatrix &  Bmat,
HessMatrix &  Amat 
)
inlineoverridevirtual

calculate quasi-particle coordinates, Bmat and Amat after pbyp move

Implements BackflowFunctionBase.

Definition at line 376 of file Backflow_eI.h.

References APP_ABORT.

381  {
382  APP_ABORT("Backflow_eI.h::evaluatePbyP(P,iat,QP,Bmat,Amat) not implemented for SoA\n");
383  //RealType du, d2u;
384  //const auto& myTable = P.getDistTableAB(myTableIndex_);
385  //int maxI = myTable.sources();
386  //for (int j = 0; j < maxI; j++)
387  //{
388  // RealType uij = RadFun[j]->evaluate(myTable.Temp[j].r1, du, d2u);
389  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
390  // newQP[iat] += u;
391  // du *= myTable.Temp[j].rinv1;
392  // HessType& hess = AIJ_temp[j];
393  // hess = du * outerProduct(myTable.Temp[j].dr1, myTable.Temp[j].dr1);
394  // hess[0] += uij;
395  // hess[4] += uij;
396  // hess[8] += uij;
397  // Amat(iat, iat) += (hess - AIJ(iat, j));
398  // BIJ_temp[j] = (d2u + 4.0 * du) * myTable.Temp[j].dr1;
399  // Bmat_full(iat, iat) += (BIJ_temp[j] - BIJ(iat, j));
400  //}
401  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ evaluateWithDerivatives()

void evaluateWithDerivatives ( const ParticleSet &  P,
ParticleSet &  QP,
GradMatrix &  Bmat_full,
HessMatrix &  Amat,
GradMatrix &  Cmat,
GradMatrix &  Ymat,
HessArray &  Xmat 
)
inlineoverridevirtual

calculate quasi-particle coordinates, Bmat and Amat calculate derivatives wrt to variational parameters

Implements BackflowFunctionBase.

Definition at line 425 of file Backflow_eI.h.

References BackflowFunctionBase::AIJ, BackflowFunctionBase::BIJ, DistanceTableAB::getDistRow(), ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), BackflowFunctionBase::indexOfFirstParam, Backflow_eI< FT >::myTableIndex_, BackflowFunctionBase::NumCenters, Backflow_eI< FT >::offsetPrms, qmcplusplus::outerProduct(), ParticleSet::R, Backflow_eI< FT >::RadFun, and BackflowFunctionBase::UIJ.

432  {
433  RealType du, d2u;
434  const auto& myTable = P.getDistTableAB(myTableIndex_);
435  for (int jel = 0; jel < P.getTotalNum(); jel++)
436  {
437  const auto& dist = myTable.getDistRow(jel);
438  const auto& displ = myTable.getDisplRow(jel);
439  for (int iat = 0; iat < NumCenters; iat++)
440  {
441  if (dist[iat] > 0)
442  {
443  RealType uij = RadFun[iat]->evaluate(dist[iat], du, d2u);
444  int NPrms = RadFun[iat]->NumParams;
445  std::vector<TinyVector<RealType, 3>> derivsju(NPrms);
446  RadFun[iat]->evaluateDerivatives(dist[iat], derivsju);
447  du /= dist[iat];
448  QP.R[jel] += (UIJ(jel, iat) = -uij * displ[iat]);
449  HessType op = outerProduct(displ[iat], displ[iat]);
450  HessType& hess = AIJ(jel, iat);
451  hess = du * op;
452  hess[0] += uij;
453  hess[4] += uij;
454  hess[8] += uij;
455  Amat(jel, jel) += hess;
456  Bmat_full(jel, jel) += (BIJ(jel, iat) = -(d2u + 4.0 * du) * displ[iat]);
457  for (int prm = 0, la = indexOfFirstParam + offsetPrms[iat]; prm < NPrms; prm++, la++)
458  {
459  Cmat(la, jel) -= displ[iat] * derivsju[prm][0];
460  Xmat(la, jel, jel) += (derivsju[prm][1] / dist[iat]) * op;
461  Xmat(la, jel, jel)[0] += derivsju[prm][0];
462  Xmat(la, jel, jel)[4] += derivsju[prm][0];
463  Xmat(la, jel, jel)[8] += derivsju[prm][0];
464  Ymat(la, jel) -= (derivsju[prm][2] + 4.0 * derivsju[prm][1] / dist[iat]) * displ[iat];
465  }
466  }
467  }
468  }
469  }
std::vector< int > offsetPrms
Definition: Backflow_eI.h:35
int NumCenters
number of centers, e.g., ions
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > outerProduct(const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
Definition: TinyVector.h:211
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
QMCTraits::RealType RealType
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30

◆ indexOffset()

int indexOffset ( )
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 119 of file Backflow_eI.h.

References Backflow_eI< FT >::RadFun.

119 { return RadFun[0]->myVars.where(0); }
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33

◆ isOptimizable()

bool isOptimizable ( )
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 111 of file Backflow_eI.h.

References Backflow_eI< FT >::uniqueRadFun.

Referenced by Backflow_eI< FT >::reportStatus().

112  {
113  for (int i = 0; i < uniqueRadFun.size(); i++)
114  if (uniqueRadFun[i]->isOptimizable())
115  return true;
116  return false;
117  }
bool isOptimizable() override
Definition: Backflow_eI.h:111
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ makeClone()

std::unique_ptr<BackflowFunctionBase> makeClone ( ParticleSet &  tqp) const
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 52 of file Backflow_eI.h.

References APP_ABORT, BackflowFunctionBase::CenterSys, qmcplusplus::clone, BackflowFunctionBase::derivs, BLAS::done, BackflowFunctionBase::indexOfFirstParam, BackflowFunctionBase::NumCenters, BackflowFunctionBase::numParams, BackflowFunctionBase::NumTargets, Backflow_eI< FT >::offsetPrms, Backflow_eI< FT >::RadFun, and Backflow_eI< FT >::uniqueRadFun.

53  {
54  auto clone = std::make_unique<Backflow_eI<FT>>(CenterSys, tqp);
55  clone->resize(NumTargets, NumCenters);
56  clone->indexOfFirstParam = indexOfFirstParam;
57  clone->offsetPrms = offsetPrms;
58  clone->numParams = numParams;
59  clone->derivs = derivs;
60  clone->uniqueRadFun.resize(uniqueRadFun.size());
61  clone->RadFun.resize(RadFun.size());
62  for (int i = 0; i < uniqueRadFun.size(); i++)
63  clone->uniqueRadFun[i] = std::make_unique<FT>(*(uniqueRadFun[i]));
64  for (int i = 0; i < RadFun.size(); i++)
65  {
66  bool done = false;
67  for (int k = 0; k < uniqueRadFun.size(); k++)
68  if (RadFun[i] == uniqueRadFun[k].get())
69  {
70  done = true;
71  clone->RadFun[i] = clone->uniqueRadFun[k].get();
72  break;
73  }
74  if (!done)
75  {
76  APP_ABORT("Error cloning Backflow_eI object. \n");
77  }
78  }
79  return clone;
80  }
int NumTargets
number of quantum particles
std::vector< int > offsetPrms
Definition: Backflow_eI.h:35
int NumCenters
number of centers, e.g., ions
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
ParticleSet & CenterSys
Reference to the center.
constexpr double done
Definition: BLAS.hpp:48
std::vector< TinyVector< RealType, 3 > > derivs
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ registerData()

void registerData ( WFBufferType &  buf)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 175 of file Backflow_eI.h.

References PooledMemory< T_scalar, Alloc >::add(), BackflowFunctionBase::AIJ, BackflowFunctionBase::BIJ, BackflowFunctionBase::FirstOfA, BackflowFunctionBase::FirstOfB, BackflowFunctionBase::FirstOfU, BackflowFunctionBase::LastOfA, BackflowFunctionBase::LastOfB, BackflowFunctionBase::LastOfU, BackflowFunctionBase::NumCenters, BackflowFunctionBase::NumTargets, OHMMS_DIM, and BackflowFunctionBase::UIJ.

176  {
177  FirstOfU = &(UIJ(0, 0)[0]);
179  FirstOfA = &(AIJ(0, 0)[0]);
181  FirstOfB = &(BIJ(0, 0)[0]);
183  buf.add(FirstOfU, LastOfU);
184  buf.add(FirstOfA, LastOfA);
185  buf.add(FirstOfB, LastOfB);
186  }
int NumTargets
number of quantum particles
int NumCenters
number of centers, e.g., ions
#define OHMMS_DIM
Definition: config.h:64

◆ reportStatus()

void reportStatus ( std::ostream &  os)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 82 of file Backflow_eI.h.

References Backflow_eI< FT >::isOptimizable(), Backflow_eI< FT >::myTableIndex_, Backflow_eI< FT >::offsetPrms, Backflow_eI< FT >::RadFun, and Backflow_eI< FT >::uniqueRadFun.

83  {
84  std::cerr << RadFun.size() << std::endl;
85  std::cerr << isOptimizable() << std::endl;
86  std::cerr << myTableIndex_ << std::endl;
87  for (int i = 0; i < offsetPrms.size(); i++)
88  std::cerr << offsetPrms[i] << std::endl;
89  for (int i = 0; i < uniqueRadFun.size(); i++)
90  uniqueRadFun[i]->reportStatus(os);
91  }
std::vector< int > offsetPrms
Definition: Backflow_eI.h:35
bool isOptimizable() override
Definition: Backflow_eI.h:111
void reportStatus(std::ostream &os) override
Definition: Backflow_eI.h:82
std::vector< FT * > RadFun
Definition: Backflow_eI.h:33
const int myTableIndex_
distance table index
Definition: Backflow_eI.h:30
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ resetParameters()

void resetParameters ( const opt_variables_type &  active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 93 of file Backflow_eI.h.

References Backflow_eI< FT >::uniqueRadFun.

94  {
95  for (int i = 0; i < uniqueRadFun.size(); i++)
96  uniqueRadFun[i]->resetParametersExclusive(active);
97  }
std::vector< std::unique_ptr< FT > > uniqueRadFun
Definition: Backflow_eI.h:34

◆ restore()

void restore ( int  iat,
int  UpdateType 
)
inlineoverridevirtual

Member Data Documentation

◆ myTableIndex_

const int myTableIndex_
private

◆ offsetPrms

std::vector<int> offsetPrms

◆ RadFun

◆ uniqueRadFun


The documentation for this class was generated from the following file: