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

Public Member Functions

 Backflow_eI_spin (ParticleSet &ions, ParticleSet &els)
 
 ~Backflow_eI_spin () override
 
void addFunc (int source_g, FT *afunc, int target_g)
 
std::unique_ptr< BackflowFunctionBasemakeClone (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

bool Spin
 
Matrix< FT * > RadFunc
 
Matrix< int > Fmask
 
Matrix< int > offsetPrms
 
std::vector< int > s_offset
 index offset for the source particles More...
 
std::vector< int > t_offset
 index offset for the target particles More...
 
- Public Attributes inherited from BackflowFunctionBase
ParticleSetCenterSys
 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< PosTypeUIJ
 
Vector< PosTypeUIJ_temp
 
HessMatrix AIJ
 
HessVector AIJ_temp
 
GradMatrix BIJ
 
GradVector BIJ_temp
 
RealTypeFirstOfU
 
RealTypeLastOfU
 
RealTypeFirstOfA
 
RealTypeLastOfA
 
RealTypeFirstOfB
 
RealTypeLastOfB
 
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_spin< FT >

Definition at line 25 of file Backflow_eI_spin.h.

Constructor & Destructor Documentation

◆ Backflow_eI_spin()

Backflow_eI_spin ( ParticleSet ions,
ParticleSet els 
)
inline

Definition at line 51 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, ParticleSet::groups(), ParticleSet::last(), BackflowFunctionBase::NumCenters, BackflowFunctionBase::NumTargets, Backflow_eI_spin< FT >::offsetPrms, Backflow_eI_spin< FT >::RadFunc, Matrix< T, Alloc >::resize(), BackflowFunctionBase::resize(), qmcplusplus::Units::time::s, Backflow_eI_spin< FT >::s_offset, Matrix< T, Alloc >::size(), and Backflow_eI_spin< FT >::t_offset.

52  : BackflowFunctionBase(ions, els), myTableIndex_(els.addTable(ions)), Spin(false)
53  {
54  throw std::runtime_error(
55  "Backflow_eI_spin is not ready for SoA! Please submit a feature request if it is needed!\n");
56  RadFunc.resize(ions.groups(), els.groups());
57  for (int i = 0; i < RadFunc.size(); ++i)
58  RadFunc(i) = 0;
59  Fmask.resize(ions.groups(), els.groups());
60  Fmask = -1;
62  s_offset.resize(ions.groups() + 1, 0);
63  t_offset.resize(els.groups() + 1, 0);
64  for (int s = 0; s < ions.groups(); ++s)
65  s_offset[s + 1] = ions.last(s);
66  for (int t = 0; t < els.groups(); ++t)
67  t_offset[t + 1] = els.last(t);
68  offsetPrms.resize(ions.groups(), els.groups());
69  offsetPrms = 0;
70  }
int NumTargets
number of quantum particles
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
int NumCenters
number of centers, e.g., ions
size_type size() const
Definition: OhmmsMatrix.h:76
const int myTableIndex_
distance table index
std::vector< int > s_offset
index offset for the source particles
std::vector< int > t_offset
index offset for the target particles
BackflowFunctionBase(ParticleSet &ions, ParticleSet &els)

◆ ~Backflow_eI_spin()

~Backflow_eI_spin ( )
inlineoverride

Definition at line 72 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

73  {
74  for (int i = 0; i < RadFunc.size(); ++i)
75  if (RadFunc[i])
76  delete RadFunc[i];
77  }
size_type size() const
Definition: OhmmsMatrix.h:76

Member Function Documentation

◆ acceptMove()

void acceptMove ( int  iat,
int  UpdateMode 
)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 175 of file Backflow_eI_spin.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.

176  {
177  int num;
178  switch (UpdateMode)
179  {
180  case ORB_PBYP_RATIO:
181  num = UIJ.cols();
182  for (int i = 0; i < num; i++)
183  UIJ(iat, i) = UIJ_temp[i];
184  break;
185  case ORB_PBYP_PARTIAL:
186  num = UIJ.cols();
187  for (int i = 0; i < num; i++)
188  UIJ(iat, i) = UIJ_temp[i];
189  num = AIJ.cols();
190  for (int i = 0; i < num; i++)
191  AIJ(iat, i) = AIJ_temp[i];
192  break;
193  case ORB_PBYP_ALL:
194  num = UIJ.cols();
195  for (int i = 0; i < num; i++)
196  UIJ(iat, i) = UIJ_temp[i];
197  num = AIJ.cols();
198  for (int i = 0; i < num; i++)
199  AIJ(iat, i) = AIJ_temp[i];
200  num = BIJ.cols();
201  for (int i = 0; i < num; i++)
202  BIJ(iat, i) = BIJ_temp[i];
203  break;
204  default:
205  num = UIJ.cols();
206  for (int i = 0; i < num; i++)
207  UIJ(iat, i) = UIJ_temp[i];
208  num = AIJ.cols();
209  for (int i = 0; i < num; i++)
210  AIJ(iat, i) = AIJ_temp[i];
211  num = BIJ.cols();
212  for (int i = 0; i < num; i++)
213  BIJ(iat, i) = BIJ_temp[i];
214  break;
215  }
216  UIJ_temp = 0.0;
217  AIJ_temp = 0.0;
218  BIJ_temp = 0.0;
219  }
size_type cols() const
Definition: OhmmsMatrix.h:78

◆ addFunc()

void addFunc ( int  source_g,
FT *  afunc,
int  target_g 
)
inline

Definition at line 79 of file Backflow_eI_spin.h.

References APP_ABORT, qmcplusplus::app_log(), Matrix< T, Alloc >::cols(), Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Backflow_eI_spin< FT >::Spin.

80  {
81  if (target_g < 0)
82  {
83  if (Spin)
84  {
85  APP_ABORT("Cannot mix spin-dependent with spin-indepdentent Jastrow");
86  }
87  int pid = source_g * RadFunc.cols();
88  for (int ig = 0; ig < RadFunc.cols(); ++ig)
89  {
90  RadFunc(source_g, ig) = afunc;
91  Fmask(source_g, ig) = pid;
92  }
93  app_log() << " Adding functor of type " << source_g << " for all the target. " << std::endl;
94  }
95  else
96  {
97  Spin = true;
98  RadFunc(source_g, target_g) = afunc;
99  Fmask(source_g, target_g) = source_g * RadFunc.cols() + target_g;
100  app_log() << " Adding functor of type " << source_g << " for the target type " << target_g << std::endl;
101  }
102  }
std::ostream & app_log()
Definition: OutputManager.h:65
size_type cols() const
Definition: OhmmsMatrix.h:78
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ checkInVariables()

void checkInVariables ( opt_variables_type active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 143 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

144  {
145  //myVars.clear();
146  for (int i = 0; i < RadFunc.size(); ++i)
147  if (Fmask(i) == i)
148  RadFunc(i)->checkInVariables(active);
149  }
size_type size() const
Definition: OhmmsMatrix.h:76

◆ checkOutVariables()

void checkOutVariables ( const opt_variables_type active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 151 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

152  {
153  for (int i = 0; i < RadFunc.size(); ++i)
154  if (Fmask(i) == i)
155  RadFunc(i)->checkOutVariables(active);
156  }
size_type size() const
Definition: OhmmsMatrix.h:76

◆ evaluate() [1/3]

void evaluate ( const ParticleSet P,
ParticleSet QP 
)
inlineoverridevirtual

calculate quasi-particle coordinates only

Implements BackflowFunctionBase.

Definition at line 243 of file Backflow_eI_spin.h.

References APP_ABORT.

244  {
245  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluate")
246  //RealType du, d2u;
247  //const auto& myTable = P.getDistTableAB(myTableIndex_);
248  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
249  //{
250  // for (int iat = s_offset[sg]; iat < s_offset[sg + 1]; ++iat)
251  // {
252  // int nn = myTable.M[iat]; //starting nn for the iat-th source
253  // for (int tg = 0; tg < RadFunc.cols(); ++tg)
254  // {
255  // FT* func = RadFunc(sg, tg);
256  // if (func)
257  // for (int jat = t_offset[tg]; jat < t_offset[tg + 1]; ++jat, ++nn)
258  // {
259  // RealType uij = func->evaluate(myTable.r(nn), du, d2u);
260  // QP.R[jat] += (UIJ(jat, iat) = uij * myTable.dr(nn)); // dr(ij) = r_j-r_i
261  // }
262  // else
263  // nn += t_offset[tg + 1] - t_offset[tg]; //move forward by the number of particles in the group tg
264  // }
265  // }
266  //}
267  }
#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 270 of file Backflow_eI_spin.h.

References APP_ABORT.

271  {
272  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluate")
273  //RealType du, d2u, temp;
274  //const auto& myTable = P.getDistTableAB(myTableIndex_);
275  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
276  //{
277  // for (int iat = s_offset[sg]; iat < s_offset[sg + 1]; ++iat)
278  // {
279  // int nn = myTable.M[iat]; //starting nn for the iat-th source
280  // for (int tg = 0; tg < RadFunc.cols(); ++tg)
281  // {
282  // FT* func = RadFunc(sg, tg);
283  // if (func)
284  // for (int jat = t_offset[tg]; jat < t_offset[tg + 1]; ++jat, ++nn)
285  // {
286  // RealType uij = func->evaluate(myTable.r(nn), du, d2u);
287  // //PosType u = uij*myTable.dr(nn);
288  // du *= myTable.rinv(nn);
289  // QP.R[jat] += (UIJ(jat, iat) = uij * myTable.dr(nn));
290  // HessType& hess = AIJ(jat, iat);
291  // hess = du * outerProduct(myTable.dr(nn), myTable.dr(nn));
292  // hess[0] += uij;
293  // hess[4] += uij;
294  // hess[8] += uij;
295  // Amat(jat, jat) += hess;
296  // //u = (d2u+4.0*du)*myTable.dr(nn);
297  // Bmat[jat] += (BIJ(jat, iat) = (d2u + 4.0 * du) * myTable.dr(nn));
298  // }
299  // else
300  // nn += t_offset[tg + 1] - t_offset[tg]; //move forward by the number of particles in the group tg
301  // }
302  // }
303  //}
304  }
#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 309 of file Backflow_eI_spin.h.

References APP_ABORT.

310  {
311  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluate")
312  //RealType du, d2u;
313  //const auto& myTable = P.getDistTableAB(myTableIndex_);
314  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
315  //{
316  // for (int iat = s_offset[sg]; iat < s_offset[sg + 1]; ++iat)
317  // {
318  // int nn = myTable.M[iat]; //starting nn for the iat-th source
319  // for (int tg = 0; tg < RadFunc.cols(); ++tg)
320  // {
321  // FT* func = RadFunc(sg, tg);
322  // if (func)
323  // for (int jat = t_offset[tg]; jat < t_offset[tg + 1]; ++jat, ++nn)
324  // {
325  // RealType uij = func->evaluate(myTable.r(nn), du, d2u);
326  // du *= myTable.rinv(nn);
327  // //PosType u = uij*myTable.dr(nn);
328  // QP.R[jat] += (UIJ(jat, iat) = uij * myTable.dr(nn));
329  // HessType& hess = AIJ(jat, iat);
330  // hess = du * outerProduct(myTable.dr(nn), myTable.dr(nn));
331  // hess[0] += uij;
332  // hess[4] += uij;
333  // hess[8] += uij;
334  // Amat(jat, jat) += hess;
335  // // this will create problems with QMC_COMPLEX, because Bmat is ValueType and dr is RealType
336  // //u = (d2u+4.0*du)*myTable.dr(nn);
337  // Bmat_full(jat, jat) += (BIJ(jat, iat) = (d2u + 4.0 * du) * myTable.dr(nn));
338  // }
339  // else
340  // nn += t_offset[tg + 1] - t_offset[tg]; //move forward by the number of particles in the group tg
341  // }
342  // }
343  //}
344  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ 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 461 of file Backflow_eI_spin.h.

References APP_ABORT.

462  {
463  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluateBmatOnly")
464  //RealType du, d2u;
465  //const auto& myTable = P.getDistTableAB(myTableIndex_);
466  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
467  //{
468  // for (int iat = s_offset[sg]; iat < s_offset[sg + 1]; ++iat)
469  // {
470  // int nn = myTable.M[iat]; //starting nn for the iat-th source
471  // for (int tg = 0; tg < RadFunc.cols(); ++tg)
472  // {
473  // FT* func = RadFunc(sg, tg);
474  // if (func)
475  // for (int jat = t_offset[tg]; jat < t_offset[tg + 1]; ++jat, ++nn)
476  // {
477  // RealType uij = func->evaluate(myTable.r(nn), du, d2u);
478  // Bmat_full(jat, jat) += (BIJ(jat, iat) = (d2u + 4.0 * du * myTable.rinv(nn)) * myTable.dr(nn));
479  // }
480  // else
481  // nn += t_offset[tg + 1] - t_offset[tg]; //move forward by the number of particles in the group tg
482  // }
483  // }
484  //}
485  }
#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 348 of file Backflow_eI_spin.h.

Referenced by Backflow_eI_spin< FT >::evaluatePbyP().

351  {
352  evaluatePbyP(P, index[0], newQP);
353  }
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index) override
calculate quasi-particle coordinates after pbyp move

◆ 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 358 of file Backflow_eI_spin.h.

References APP_ABORT.

359  {
360  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluatePbyP")
361  //RealType du, d2u;
362  //const auto& myTable = P.getDistTableAB(myTableIndex_);
363  //int tg = P.GroupID[iat]; //species of this particle
364  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
365  //{
366  // FT* func = RadFunc(sg, tg);
367  // if (func)
368  // {
369  // for (int j = s_offset[sg]; j < s_offset[sg + 1]; ++j)
370  // {
371  // RealType uij = func->evaluate(myTable.Temp[j].r1, du, d2u);
372  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
373  // newQP[iat] += u;
374  // }
375  // }
376  //}
377  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ 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 379 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::evaluatePbyP().

383  {
384  evaluatePbyP(P, index[0], newQP, Amat);
385  }
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index) override
calculate quasi-particle coordinates after pbyp move

◆ 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 387 of file Backflow_eI_spin.h.

References APP_ABORT.

388  {
389  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluatePbyP")
390  //RealType du, d2u;
391  //const auto& myTable = P.getDistTableAB(myTableIndex_);
392  //int tg = P.GroupID[iat]; //species of this particle
393  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
394  //{
395  // FT* func = RadFunc(sg, tg);
396  // if (func)
397  // {
398  // for (int j = s_offset[sg]; j < s_offset[sg + 1]; ++j)
399  // {
400  // RealType uij = func->evaluate(myTable.Temp[j].r1, du, d2u);
401  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
402  // newQP[iat] += u;
403  // HessType& hess = AIJ_temp[j];
404  // hess = (du * myTable.Temp[j].rinv1) * outerProduct(myTable.Temp[j].dr1, myTable.Temp[j].dr1);
405  // hess[0] += uij;
406  // hess[4] += uij;
407  // hess[8] += uij;
408  // // should I expand this??? Is the compiler smart enough???
409  // Amat(iat, iat) += (hess - AIJ(iat, j));
410  // }
411  // }
412  //}
413  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ 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 415 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::evaluatePbyP().

420  {
421  evaluatePbyP(P, index[0], newQP, Bmat_full, Amat);
422  }
void evaluatePbyP(const ParticleSet &P, ParticleSet::ParticlePos &newQP, const std::vector< int > &index) override
calculate quasi-particle coordinates after pbyp move

◆ 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 424 of file Backflow_eI_spin.h.

References APP_ABORT.

429  {
430  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluatePbyP")
431  //RealType du, d2u;
432  //const auto& myTable = P.getDistTableAB(myTableIndex_);
433  //int tg = P.GroupID[iat]; //species of this particle
434  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
435  //{
436  // FT* func = RadFunc(sg, tg);
437  // if (func)
438  // {
439  // for (int j = s_offset[sg]; j < s_offset[sg + 1]; ++j)
440  // {
441  // RealType uij = func->evaluate(myTable.Temp[j].r1, du, d2u);
442  // PosType u = (UIJ_temp[j] = uij * myTable.Temp[j].dr1) - UIJ(iat, j);
443  // newQP[iat] += u;
444  // du *= myTable.Temp[j].rinv1;
445  // HessType& hess = AIJ_temp[j];
446  // hess = du * outerProduct(myTable.Temp[j].dr1, myTable.Temp[j].dr1);
447  // hess[0] += uij;
448  // hess[4] += uij;
449  // hess[8] += uij;
450  // Amat(iat, iat) += (hess - AIJ(iat, j));
451  // BIJ_temp[j] = (d2u + 4.0 * du) * myTable.Temp[j].dr1;
452  // Bmat_full(iat, iat) += (BIJ_temp[j] - BIJ(iat, j));
453  // }
454  // }
455  //}
456  }
#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 490 of file Backflow_eI_spin.h.

References APP_ABORT.

497  {
498  APP_ABORT("SoA implementation needed for Backflow_eI_spin::evaluateWithDerivatives")
499  //RealType du, d2u;
500  //const auto& myTable = P.getDistTableAB(myTableIndex_);
501  //for (int sg = 0; sg < RadFunc.rows(); ++sg)
502  //{
503  // for (int iat = s_offset[sg]; iat < s_offset[sg + 1]; ++iat)
504  // {
505  // int nn = myTable.M[iat]; //starting nn for the iat-th source
506  // for (int tg = 0; tg < RadFunc.cols(); ++tg)
507  // {
508  // FT* func = RadFunc(sg, tg);
509  // if (func)
510  // for (int jat = t_offset[tg]; jat < t_offset[tg + 1]; ++jat, ++nn)
511  // {
512  // RealType uij = func->evaluate(myTable.r(nn), du, d2u);
513  // // std::fill(derivs.begin(),derivs.end(),0.0);
514  // int NPrms = func->NumParams;
515  // std::vector<TinyVector<RealType, 3>> derivsju(NPrms);
516  // func->evaluateDerivatives(myTable.r(nn), derivsju);
517  // du *= myTable.rinv(nn);
518  // //PosType u = uij*myTable.dr(nn);
519  // QP.R[jat] += (UIJ(jat, iat) = uij * myTable.dr(nn));
520  // HessType op = outerProduct(myTable.dr(nn), myTable.dr(nn));
521  // HessType& hess = AIJ(jat, iat);
522  // hess = du * op;
523  // hess[0] += uij;
524  // hess[4] += uij;
525  // hess[8] += uij;
526  // Amat(jat, jat) += hess;
527  // // this will create problems with QMC_COMPLEX, because Bmat is ValueType and dr is RealType
528  // //u = (d2u+4.0*du)*myTable.dr(nn);
529  // Bmat_full(jat, jat) += (BIJ(jat, iat) = (d2u + 4.0 * du) * myTable.dr(nn));
530  // //WARNINGL offsetPrms
531  // for (int prm = 0, la = indexOfFirstParam + offsetPrms(sg, tg); prm < NPrms; prm++, la++)
532  // {
533  // Cmat(la, jat) += myTable.dr(nn) * derivsju[prm][0];
534  // Xmat(la, jat, jat) += (derivsju[prm][1] * myTable.rinv(nn)) * op;
535  // Xmat(la, jat, jat)[0] += derivsju[prm][0];
536  // Xmat(la, jat, jat)[4] += derivsju[prm][0];
537  // Xmat(la, jat, jat)[8] += derivsju[prm][0];
538  // Ymat(la, jat) += (derivsju[prm][2] + 4.0 * derivsju[prm][1] * myTable.rinv(nn)) * myTable.dr(nn);
539  // }
540  // }
541  // else
542  // nn += t_offset[tg + 1] - t_offset[tg]; //move forward by the number of particles in the group tg
543  // }
544  // }
545  //}
546  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ indexOffset()

int indexOffset ( )
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 166 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

167  {
168  for (int i = 0; i < RadFunc.size(); ++i)
169  if (Fmask(i) == i)
170  return RadFunc(i)->myVars.where(0);
171  return -1;
172  }
size_type size() const
Definition: OhmmsMatrix.h:76

◆ isOptimizable()

bool isOptimizable ( )
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 158 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

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

159  {
160  for (int i = 0; i < RadFunc.size(); ++i)
161  if (Fmask(i) == i && RadFunc(i)->isOptimizable())
162  return true;
163  return false;
164  }
size_type size() const
Definition: OhmmsMatrix.h:76

◆ makeClone()

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

Implements BackflowFunctionBase.

Definition at line 104 of file Backflow_eI_spin.h.

References BackflowFunctionBase::CenterSys, qmcplusplus::clone, BackflowFunctionBase::derivs, BackflowFunctionBase::indexOfFirstParam, BackflowFunctionBase::NumCenters, BackflowFunctionBase::numParams, BackflowFunctionBase::NumTargets, Backflow_eI_spin< FT >::offsetPrms, Backflow_eI_spin< FT >::RadFunc, Matrix< T, Alloc >::rows(), and Backflow_eI_spin< FT >::Spin.

105  {
106  auto clone = std::make_unique<Backflow_eI_spin<FT>>(CenterSys, tqp);
107  clone->resize(NumTargets, NumCenters);
108  clone->indexOfFirstParam = indexOfFirstParam;
109  clone->offsetPrms = offsetPrms;
110  clone->numParams = numParams;
111  clone->derivs = derivs;
112  if (Spin)
113  {
114  for (int sg = 0; sg < RadFunc.rows(); ++sg)
115  for (int tg = 0; tg < RadFunc.rows(); ++tg)
116  if (RadFunc(sg, tg))
117  clone->addFunc(sg, new FT(*RadFunc(sg, tg)), tg);
118  }
119  else
120  {
121  for (int sg = 0; sg < RadFunc.rows(); ++sg)
122  if (RadFunc(sg, 0))
123  clone->addFunc(sg, new FT(*RadFunc(sg, 0)), -1);
124  }
125  return clone;
126  }
int NumTargets
number of quantum particles
int NumCenters
number of centers, e.g., ions
size_type rows() const
Definition: OhmmsMatrix.h:77
ParticleSet & CenterSys
Reference to the center.
std::vector< TinyVector< RealType, 3 > > derivs

◆ registerData()

void registerData ( WFBufferType buf)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 228 of file Backflow_eI_spin.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.

229  {
230  FirstOfU = &(UIJ(0, 0)[0]);
232  FirstOfA = &(AIJ(0, 0)[0]);
234  FirstOfB = &(BIJ(0, 0)[0]);
236  buf.add(FirstOfU, LastOfU);
237  buf.add(FirstOfA, LastOfA);
238  buf.add(FirstOfB, LastOfB);
239  }
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 128 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::isOptimizable(), Backflow_eI_spin< FT >::myTableIndex_, Backflow_eI_spin< FT >::offsetPrms, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

129  {
130  std::cerr << RadFunc.size() << std::endl;
131  std::cerr << isOptimizable() << std::endl;
132  std::cerr << myTableIndex_ << std::endl;
133  std::cerr << offsetPrms << std::endl;
134  }
size_type size() const
Definition: OhmmsMatrix.h:76
const int myTableIndex_
distance table index

◆ resetParameters()

void resetParameters ( const opt_variables_type active)
inlineoverridevirtual

Implements BackflowFunctionBase.

Definition at line 136 of file Backflow_eI_spin.h.

References Backflow_eI_spin< FT >::Fmask, Backflow_eI_spin< FT >::RadFunc, and Matrix< T, Alloc >::size().

137  {
138  for (int i = 0; i < RadFunc.size(); ++i)
139  if (Fmask(i) == i)
140  RadFunc(i)->resetParameters(active);
141  }
size_type size() const
Definition: OhmmsMatrix.h:76

◆ restore()

void restore ( int  iat,
int  UpdateType 
)
inlineoverridevirtual

Member Data Documentation

◆ Fmask

◆ myTableIndex_

const int myTableIndex_
private

distance table index

Definition at line 29 of file Backflow_eI_spin.h.

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

◆ offsetPrms

◆ RadFunc

◆ s_offset

std::vector<int> s_offset

index offset for the source particles

The loop over the particles is replaced by a double loop as for(int sg=0;sg<F.rows();++sg) for(int s=s_offset[sg]; s<s_offset[sg+1];++s)

Definition at line 42 of file Backflow_eI_spin.h.

Referenced by Backflow_eI_spin< FT >::Backflow_eI_spin().

◆ Spin

bool Spin

◆ t_offset

std::vector<int> t_offset

index offset for the target particles

The loop over the particles is replaced by a double loop as for(int tg=0;tg<F.cols();++tg) for(int t=t_offset[tg]; t<t_offset[tg+1];++t)

Definition at line 49 of file Backflow_eI_spin.h.

Referenced by Backflow_eI_spin< FT >::Backflow_eI_spin().


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