QMCPACK
RadialJastrowBuilder.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Luke Shulenburger, lshulen@sandia.gov, Sandia National Laboratories
8 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
9 //
10 // File created by: Luke Shulenburger, lshulen@sandia.gov, Sandia National Laboratories
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 #include "RadialJastrowBuilder.h"
14 #include <type_traits>
15 #include <PlatformSelector.hpp>
30 #include <iostream>
31 
32 
33 namespace qmcplusplus
34 {
35 // quick helper class to allow use of RPA
37 {};
38 
39 // helper class to simplify and localize ugly ifdef stuff for types
40 template<class RadFuncType, unsigned Implementation = RadialJastrowBuilder::detail::CPU>
42 {
43 public:
47 };
48 
49 template<>
50 class JastrowTypeHelper<BsplineFunctor<RadialJastrowBuilder::RealType>, RadialJastrowBuilder::detail::OMPTARGET>
51 {
52 public:
55 };
56 
58  : WaveFunctionComponentBuilder(comm, target), SourcePtcl(&source)
59 {
60  ClassName = "RadialJastrowBuilder";
61  NameOpt = "0";
62  TypeOpt = "unknown";
63  Jastfunction = "unknown";
64  SpinOpt = "no";
65 }
66 
68  : WaveFunctionComponentBuilder(comm, target), SourcePtcl(NULL)
69 {
70  ClassName = "RadialJastrowBuilder";
71  NameOpt = "0";
72  TypeOpt = "unknown";
73  Jastfunction = "unknown";
74  SpinOpt = "no";
75 }
76 
77 // helper method for dealing with functor incompatible with Open Boundaries
79 {
80  if (targetPtcl.getLattice().SuperCellEnum == SUPERCELL_OPEN)
81  {
82  app_error() << Jastfunction << " relies on the total density for its form\n";
83  app_error() << "but open boundary conditions are requested. Please choose other forms of Jastrow\n";
84  }
85 }
86 
87 // helper method for dealing with functor incompatible with PBC
89 {
90  if (targetPtcl.getLattice().SuperCellEnum != SUPERCELL_OPEN)
91  {
92  app_error() << Jastfunction << " does not support a cutoff, but is requested with\n";
93  app_error() << "periodic boundary conditions, please choose other forms of Jastrow\n";
94  }
95 }
96 
97 template<class RadFuncType>
98 void RadialJastrowBuilder::initTwoBodyFunctor(RadFuncType& functor, double fac)
99 {}
100 
101 template<>
103 {
104  if (targetPtcl.getLattice().SuperCellEnum == SUPERCELL_OPEN) // for open systems, do nothing
105  {
106  return;
107  }
108  app_log() << " Initializing Two-Body with RPA Jastrow " << std::endl;
109  std::vector<RealType> rpaValues;
110  int npts = bfunc.NumParams;
111  if (rpaValues.empty())
112  {
113  rpaValues.resize(npts);
115  rpa.Breakup(targetPtcl, -1.0);
116  RealType dr = bfunc.cutoff_radius / static_cast<RealType>(npts);
117  RealType r = 0;
118  for (int i = 0; i < npts; i++)
119  {
120  rpaValues[i] = rpa.evaluate(r, 1.0 / r); //y[i]=fac*rpa.evaluate(r,1.0/r);
121  r += dr;
122  }
123  }
124  RealType last = rpaValues[npts - 1];
125 
126  for (int i = 0; i < npts; i++)
127  bfunc.Parameters[i] = fac * (rpaValues[i] - last);
128  bfunc.reset();
129 }
130 
131 
132 template<class RadFuncType, unsigned Implementation>
133 std::unique_ptr<WaveFunctionComponent> RadialJastrowBuilder::createJ2(xmlNodePtr cur)
134 {
135  ReportEngine PRE(ClassName, "createJ2(xmlNodePtr)");
136  using Real = typename RadFuncType::real_type;
138 
139  std::string input_name(getXMLAttributeValue(cur, "name"));
140  std::string j2name = input_name.empty() ? "J2_" + Jastfunction : input_name;
141  const size_t ndim = targetPtcl.getLattice().ndim;
142  SpeciesSet& species(targetPtcl.getSpeciesSet());
143  auto J2 = std::make_unique<J2Type>(j2name, targetPtcl, Implementation == RadialJastrowBuilder::detail::OMPTARGET);
144 
145  std::string init_mode("0");
146  {
147  OhmmsAttributeSet hAttrib;
148  hAttrib.add(init_mode, "init");
149  hAttrib.put(cur);
150  }
151 
152  cur = cur->xmlChildrenNode;
153  while (cur != NULL)
154  {
155  std::string cname((const char*)cur->name);
156  if (cname == "correlation")
157  {
158  OhmmsAttributeSet rAttrib;
159  RealType cusp = -1e10;
160  std::string spA(species.speciesName[0]);
161  std::string spB(species.speciesName[0]);
162  std::string pairType("0");
163  rAttrib.add(spA, "speciesA");
164  rAttrib.add(spB, "speciesB");
165  rAttrib.add(pairType, "pairType");
166  rAttrib.add(cusp, "cusp");
167 
168  rAttrib.put(cur);
169  if (pairType[0] == '0')
170  {
171  pairType = spA + spB;
172  }
173  else
174  {
175  PRE.warning("pairType is deprecated. Use speciesA/speciesB");
176  //overwrite the species
177  spA = pairType[0];
178  spB = pairType[1];
179  }
180 
181  int ia = species.findSpecies(spA);
182  int ib = species.findSpecies(spB);
183  int chargeInd = species.addAttribute("charge");
184  int massInd = species.addAttribute("mass");
185  std::string illegal_species;
186  if (ia == species.size())
187  illegal_species = spA;
188  if (ib == species.size())
189  {
190  if (illegal_species.size())
191  illegal_species += " and ";
192  illegal_species += spB;
193  }
194  if (illegal_species.size())
195  PRE.error("species " + illegal_species + " requested for Jastrow " + j2name +
196  " does not exist in ParticleSet " + targetPtcl.getName(),
197  true);
198  if (ia == ib && (targetPtcl.last(ia) - targetPtcl.first(ia) == 1))
199  PRE.error("Failed to add " + spA + spB + " correlation for only 1 " + spA +
200  " particle. Please remove it from two-body Jastrow.",
201  true);
202  if (cusp < -1e6)
203  { // see eq. (9) in https://arxiv.org/abs/2003.06506
204  RealType qq = species(chargeInd, ia) * species(chargeInd, ib);
205  RealType red_mass = species(massInd, ia) * species(massInd, ib) / (species(massInd, ia) + species(massInd, ib));
206  RealType dim_factor = (ia == ib) ? 1.0 / (ndim + 1) : 1.0 / (ndim - 1);
207  if (ndim == 1)
208  dim_factor = 1.0 / (ndim + 1);
209  cusp = -2 * qq * red_mass * dim_factor;
210  }
211  app_summary() << " Radial function for species: " << spA << " - " << spB << std::endl;
212  app_debug() << " RadialJastrowBuilder adds a functor with cusp = " << cusp << std::endl;
213 
214  const auto coef_id = extractCoefficientsID(cur);
215  auto functor = std::make_unique<RadFuncType>(coef_id.empty() ? j2name + "_" + spA + spB : coef_id);
216  functor->setCusp(cusp);
217  functor->setPeriodic(targetPtcl.getLattice().SuperCellEnum != SUPERCELL_OPEN);
218  functor->cutoff_radius = targetPtcl.getLattice().WignerSeitzRadius;
219  bool functor_initialized = functor->put(cur);
220  if (!functor_initialized && init_mode == "rpa")
221  {
222  initTwoBodyFunctor(*functor, -cusp / 0.5);
223  }
224 
225  app_summary() << std::endl;
226 
228  {
229  std::array<char, 32> fname;
230  if (std::snprintf(fname.data(), fname.size(), "J2.%s.%s.g%03d.dat", NameOpt.c_str(), pairType.c_str(),
231  getGroupID()) < 0)
232  throw std::runtime_error("Error generating filename");
233  std::ofstream os(fname.data());
234  print(*functor, os);
235  }
236 
237  J2->addFunc(ia, ib, std::move(functor));
238  }
239  cur = cur->next;
240  }
241 
242  // compute Chiesa Correction based on the current J2 parameters
243  J2->ChiesaKEcorrection();
244 
245  // Ye: actually don't know what uk.dat is used for
246  if (targetPtcl.getLattice().SuperCellEnum)
247  computeJ2uk(J2->getPairFunctions());
248 
249  // sanity check before returning the constructed J2
250  J2->checkSanity();
251 
252  return J2;
253 }
254 
255 
256 template<class RadFuncType>
257 void RadialJastrowBuilder::computeJ2uk(const std::vector<RadFuncType*>& functors)
258 {
259  const int numPoints = 1000;
260  RealType vol = targetPtcl.getLattice().Volume;
261  int nsp = targetPtcl.groups();
262  FILE* fout = nullptr;
264  {
265  std::array<char, 16> fname;
266  if (std::snprintf(fname.data(), fname.size(), "uk.%s.g%03d.dat", NameOpt.c_str(), getGroupID()) < 0)
267  throw std::runtime_error("Error generating filename");
268  fout = fopen(fname.data(), "w");
269  }
270  for (int iG = 0; iG < targetPtcl.getSimulationCell().getKLists().ksq.size(); iG++)
271  {
272  RealType Gmag = std::sqrt(targetPtcl.getSimulationCell().getKLists().ksq[iG]);
273  RealType sum = 0.0;
274  RealType uk = 0.0;
275  for (int i = 0; i < targetPtcl.groups(); i++)
276  {
277  int Ni = targetPtcl.last(i) - targetPtcl.first(i);
278  RealType aparam = 0.0;
279  for (int j = 0; j < targetPtcl.groups(); j++)
280  {
281  int Nj = targetPtcl.last(j) - targetPtcl.first(j);
282  if (functors[i * nsp + j])
283  {
284  auto& ufunc = *functors[i * nsp + j];
285  RealType radius = ufunc.cutoff_radius;
286  RealType k = Gmag;
287  RealType dr = radius / (RealType)(numPoints - 1);
288  for (int ir = 0; ir < numPoints; ir++)
289  {
290  RealType r = dr * (RealType)ir;
291  RealType u = ufunc.evaluate(r);
292  aparam += (1.0 / 4.0) * k * k * 4.0 * M_PI * r * std::sin(k * r) / k * u * dr;
293  uk += 0.5 * 4.0 * M_PI * r * std::sin(k * r) / k * u * dr * (RealType)Nj / (RealType)(Ni + Nj);
294  }
295  }
296  }
297  //app_log() << "A = " << aparam << std::endl;
298  sum += Ni * aparam / vol;
299  }
300  if (fout)
301  fprintf(fout, "%1.8f %1.12e %1.12e\n", Gmag, uk, sum);
302  }
303  if (fout)
304  fclose(fout);
305 }
306 
307 // specialiation for J2 RPA jastrow.
308 template<>
309 std::unique_ptr<WaveFunctionComponent> RadialJastrowBuilder::createJ2<RPAFunctor>(xmlNodePtr cur)
310 {
311  auto rpajastrow = std::make_unique<RPAJastrow>(targetPtcl);
312  rpajastrow->put(cur);
313  return rpajastrow;
314 }
315 
316 template<class RadFuncType, bool SPIN, unsigned Implementation>
317 std::unique_ptr<WaveFunctionComponent> RadialJastrowBuilder::createJ1(xmlNodePtr cur)
318 {
319  ReportEngine PRE(ClassName, "createJ1(xmlNodePtr)");
320  using Real = typename RadFuncType::real_type;
322  using J1Type = typename std::conditional<SPIN, typename TH::J1SpinType, typename TH::J1Type>::type;
323 
324  std::string input_name(getXMLAttributeValue(cur, "name"));
325  std::string jname = input_name.empty() ? Jastfunction : input_name;
326 
327  std::string useGPU;
328  OhmmsAttributeSet attr;
329  attr.add(useGPU, "gpu", CPUOMPTargetSelector::candidate_values);
330  attr.put(cur);
331 
332  if (useGPU.empty())
334 
335  bool use_offload = false;
337  {
339  {
340  std::ostringstream msg;
341  msg << R"(Offload enabled Jastrow needs the gpu="yes" attribute in the ")" << SourcePtcl->getName()
342  << "\" particleset" << std::endl;
343  myComm->barrier_and_abort(msg.str());
344  }
345  app_summary() << " Running OpenMP offload code path." << std::endl;
346  use_offload = true;
347  }
348 
349  auto J1 = std::make_unique<J1Type>(jname, *SourcePtcl, targetPtcl, use_offload);
350 
351  xmlNodePtr kids = cur->xmlChildrenNode;
352 
353  // Find the number of the source species
356  bool success = false;
357  while (kids != NULL)
358  {
359  std::string kidsname(lowerCase(castXMLCharToChar(kids->name)));
360  if (kidsname == "correlation")
361  {
362  std::string speciesA;
363  std::string speciesB;
364  RealType cusp(0);
365  OhmmsAttributeSet rAttrib;
366  rAttrib.add(speciesA, "elementType");
367  rAttrib.add(speciesA, "speciesA");
368  rAttrib.add(speciesB, "speciesB");
369  rAttrib.add(cusp, "cusp");
370  rAttrib.put(kids);
371 
372  const auto coef_id = extractCoefficientsID(kids);
373  auto functor = std::make_unique<RadFuncType>(coef_id.empty() ? jname + "_" + speciesA + speciesB : coef_id);
374  functor->setPeriodic(SourcePtcl->getLattice().SuperCellEnum != SUPERCELL_OPEN);
375  functor->cutoff_radius = targetPtcl.getLattice().WignerSeitzRadius;
376  functor->setCusp(cusp);
377  const int ig = sSet.findSpecies(speciesA);
378  const int jg = speciesB.size() ? tSet.findSpecies(speciesB) : -1;
379  if (ig == sSet.getTotalNum())
380  {
381  PRE.error("species " + speciesA + " requested for Jastrow " + jname + " does not exist in ParticleSet " +
382  SourcePtcl->getName(),
383  true);
384  }
385  if (jg == tSet.getTotalNum())
386  {
387  PRE.error("species " + speciesB + " requested for Jastrow " + jname + " does not exist in ParticleSet " +
389  true);
390  }
391  app_summary() << " Radial function for element: " << speciesA << " - "
392  << (speciesB.empty() ? targetPtcl.getName() : speciesB) << std::endl;
393  functor->put(kids);
394  app_summary() << std::endl;
396  {
397  std::array<char, 128> fname;
398  int fname_len{0};
399  if (speciesB.size())
400  fname_len = std::snprintf(fname.data(), fname.size(), "%s.%s.%s%s.g%03d.dat", jname.c_str(), NameOpt.c_str(),
401  speciesA.c_str(), speciesB.c_str(), getGroupID());
402  else
403  fname_len = std::snprintf(fname.data(), fname.size(), "%s.%s.%s.g%03d.dat", jname.c_str(), NameOpt.c_str(),
404  speciesA.c_str(), getGroupID());
405  if (fname_len < 0)
406  throw std::runtime_error("Error generating filename");
407  std::ofstream os(std::string(fname.data(), fname_len));
408  if constexpr (std::is_same_v<RadFuncType, PadeFunctor<RealType>> ||
409  std::is_same_v<RadFuncType, Pade2ndOrderFunctor<RealType>>)
410  {
411  double plotextent = 10.0;
412  print(*functor.get(), os, plotextent);
413  }
414  else
415  {
416  print(*functor.get(), os);
417  }
418  }
419  J1->addFunc(ig, std::move(functor), jg);
420  success = true;
421  }
422  kids = kids->next;
423  }
424 
425  // sanity check before returning the constructed J1
426  J1->checkSanity();
427 
428  if (success)
429  return J1;
430  else
431  {
432  PRE.error("BsplineJastrowBuilder failed to add an One-Body Jastrow.");
433  return std::unique_ptr<WaveFunctionComponent>();
434  }
435 }
436 
437 // specialiation for J1 RPA jastrow. Note that the long range part is not implemented
438 template<>
439 std::unique_ptr<WaveFunctionComponent> RadialJastrowBuilder::createJ1<RPAFunctor>(xmlNodePtr cur)
440 {
441  using Real = RealType;
444  using GridType = LinearGrid<Real>;
445  using HandlerType = LRHandlerBase;
446  using J1Type = J1OrbitalSoA<RadFunctorType>;
447 
448  std::string input_name;
449  std::string rpafunc = "RPA";
451  a.add(input_name, "name");
452  a.add(rpafunc, "function");
453  a.put(cur);
454  ParameterSet params;
455  RealType Rs(-1.0);
456  RealType Kc(-1.0);
457  params.add(Rs, "rs");
458  params.add(Kc, "kc");
459  params.put(cur);
460 
461  std::string jname = input_name.empty() ? Jastfunction : input_name;
462 
463  HandlerType* myHandler = nullptr;
464  if (Rs < 0)
465  {
466  Rs = std::pow(3.0 / 4.0 / M_PI * targetPtcl.getLattice().Volume / static_cast<RealType>(targetPtcl.getTotalNum()),
467  1.0 / 3.0);
468  }
469  if (Kc < 0)
470  {
471  Kc = 1e-6;
472  }
473  if (rpafunc == "RPA")
474  {
475  myHandler = new LRRPAHandlerTemp<EPRPABreakup<RealType>, LPQHIBasis>(targetPtcl, Kc);
476  app_log() << " using e-p RPA" << std::endl;
477  }
478  else if (rpafunc == "dRPA")
479  {
480  myHandler = new LRRPAHandlerTemp<derivEPRPABreakup<RealType>, LPQHIBasis>(targetPtcl, Kc);
481  app_log() << " using e-p derivRPA" << std::endl;
482  }
483  myHandler->Breakup(targetPtcl, Rs);
484 
485  Real Rcut = myHandler->get_rc() - 0.1;
486  GridType* myGrid = new GridType;
487  int npts = static_cast<int>(Rcut / 0.01) + 1;
488  myGrid->set(0, Rcut, npts);
489 
490  //create the numerical functor
491  auto nfunc = std::make_unique<RadFunctorType>();
493  SRA->setRmax(Rcut);
494  nfunc->initialize(SRA, myGrid);
495 
496  auto J1 = std::make_unique<J1Type>(jname, *SourcePtcl, targetPtcl, false);
497 
498  SpeciesSet& sSet = SourcePtcl->getSpeciesSet();
499  for (int ig = 0; ig < sSet.getTotalNum(); ig++)
500  {
501  J1->addFunc(ig, std::move(nfunc));
502  }
503 
504  return J1;
505 }
506 
507 
508 std::unique_ptr<WaveFunctionComponent> RadialJastrowBuilder::buildComponent(xmlNodePtr cur)
509 {
510  ReportEngine PRE(ClassName, "put(xmlNodePtr)");
511  std::string useGPU;
512  OhmmsAttributeSet aAttrib;
513  aAttrib.add(NameOpt, "name");
514  aAttrib.add(TypeOpt, "type");
515  aAttrib.add(Jastfunction, "function");
516  aAttrib.add(SpinOpt, "spin", {"no", "yes"});
517  aAttrib.add(useGPU, "gpu", CPUOMPTargetSelector::candidate_values);
518  aAttrib.put(cur);
523 
524  SpeciesSet& species(targetPtcl.getSpeciesSet());
525  int chargeInd = species.addAttribute("charge");
526 
527  if (TypeOpt.find("one") < TypeOpt.size())
528  {
529  // it's a one body jastrow factor
530  if (Jastfunction == "bspline")
531  {
532  if (SpinOpt == "yes")
533  return createJ1<BsplineFunctor<RealType>, true>(cur);
534  else
535  return createJ1<BsplineFunctor<RealType>>(cur);
536  }
537  else if (Jastfunction == "pade")
538  {
539  guardAgainstPBC();
540  if (SpinOpt == "yes")
541  return createJ1<PadeFunctor<RealType>, true>(cur);
542  else
543  return createJ1<PadeFunctor<RealType>>(cur);
544  }
545  else if (Jastfunction == "pade2")
546  {
547  guardAgainstPBC();
548  return createJ1<Pade2ndOrderFunctor<RealType>>(cur);
549  }
550  else if (Jastfunction == "shortrangecusp")
551  {
552  //guardAgainstPBC(); // is this needed?
553  if (SpinOpt == "yes")
554  return createJ1<ShortRangeCuspFunctor<RealType>, true>(cur);
555  else
556  return createJ1<ShortRangeCuspFunctor<RealType>>(cur);
557  }
558  else if (Jastfunction == "user")
559  {
560  if (SpinOpt == "yes")
561  return createJ1<UserFunctor<RealType>, true>(cur);
562  else
563  return createJ1<UserFunctor<RealType>>(cur);
564  }
565  else if (Jastfunction == "rpa")
566  {
567 #if !(OHMMS_DIM == 3)
568  app_error() << "RPA for one-body jastrow is only available for 3D\n";
569 #endif
570  guardAgainstOBC();
571  app_error() << "one body RPA jastrow is not supported at the moment\n";
572  //return createJ1<RPAFunctor>(cur);
573  }
574  else
575  app_error() << "Unknown one jastrow body function: " << Jastfunction << ".\n";
576  }
577  else if (TypeOpt.find("two") < TypeOpt.size())
578  {
579  // it's a two body jastrow factor
580  if (Jastfunction == "bspline")
581  {
582  if (useGPU.empty())
584 
586  {
589  "check consistent type");
591  {
592  std::ostringstream msg;
593  msg << R"(Offload enabled Jastrow needs the gpu="yes" attribute in the ")" << targetPtcl.getName()
594  << "\" particleset" << std::endl;
595  myComm->barrier_and_abort(msg.str());
596  }
597  app_summary() << " Running OpenMP offload code path." << std::endl;
598  return createJ2<BsplineFunctor<RealType>, detail::OMPTARGET>(cur);
599  }
600  else
601  return createJ2<BsplineFunctor<RealType>>(cur);
602  }
603  else if (Jastfunction == "pade")
604  {
605  guardAgainstPBC();
606  return createJ2<PadeFunctor<RealType>>(cur);
607  }
608  else if (Jastfunction == "user")
609  {
610  return createJ2<UserFunctor<RealType>>(cur);
611  }
612  else if (Jastfunction == "rpa" || Jastfunction == "yukawa")
613  {
614 #if !(OHMMS_DIM == 3)
615  app_error() << "RPA for one-body jastrow is only available for 3D\n";
616 #else
617  guardAgainstOBC();
618  return createJ2<RPAFunctor>(cur);
619 #endif
620  }
621  else
622  app_error() << "Unknown two jastrow body function: " << Jastfunction << ".\n";
623  }
624 
625  APP_ABORT("RadialJastrowBuilder::buildComponent not able to create Jastrow!\n");
626  return nullptr;
627 }
628 
629 } // namespace qmcplusplus
std::unique_ptr< WaveFunctionComponent > createJ1(xmlNodePtr cur)
const std::string & getName() const
return the name
One-Dimensional linear-grid.
void set(T ri, T rf, int n) override
Set the grid given the parameters.
LRCoulombSingleton::GridType GridType
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
An abstract class for wave function builders.
BsplineFunctor class for the Jastrows REAL is the real type used by offload target, it is the correct type for the mw data pointers and is also used to coerce/implicitly convert the Real type inherited OptimizableFunctorBase into that buffer if offload is off this happens too but is just an implementation quirk.
Declaration of OutputManager class.
void Breakup(ParticleSet &ref, mRealType rs_ext) override
#define app_debug
Definition: OutputManager.h:75
void print(OptimizableFunctorBase &func, std::ostream &os, double extent)
evaluates a functor (value and derivative) and dumps the quantities to output
void warning(const std::string &msg)
std::ostream & app_log()
Definition: OutputManager.h:65
std::ostream & app_summary()
Definition: OutputManager.h:63
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
Functor designed to encode short-ranged structure near a nuclear cusp.
A numerical functor.
std::ostream & app_error()
Definition: OutputManager.h:67
JastrowBuilder using an analytic 1d functor Should be able to eventually handle all one and two body ...
int getGroupID() const
return the group id of the communicator
Definition: MPIObjectBase.h:38
int first(int igroup) const
return the first index of a group i
Definition: ParticleSet.h:514
bool is_same(const xmlChar *a, const char *b)
std::vector< Real > Parameters
ParticleSet * SourcePtcl
particle set for source particle
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
Definition: SpeciesSet.cpp:45
ForceBase::Real Real
Definition: ForceBase.cpp:26
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
OutputManagerClass outputManager(Verbosity::HIGH)
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
int getTotalNum() const
return the number of species
Definition: SpeciesSet.h:55
Wrapping information on parallelism.
Definition: Communicate.h:68
int groups() const
return the number of groups
Definition: ParticleSet.h:511
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
const auto & getSimulationCell() const
Definition: ParticleSet.h:250
Specialization for one-body Jastrow function using multiple functors.
Definition: J1OrbitalSoA.h:46
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
DynamicCoordinateKind getKind() const
std::string NameOpt
<jastrow name="...">
class to handle a set of parameters
Definition: ParameterSet.h:27
A derivative of LRBasis class to provide the functionality of the LPQHI basis.
Definition: LPQHIBasis.h:28
Final class and should not be derived.
Communicate * myComm
pointer to Communicate
Definition: MPIObjectBase.h:62
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
std::string lowerCase(const std::string_view s)
++17
Functors which implement Pade functions.
Specialization for one-body Jastrow function using multiple functors.
Definition: J1Spin.h:34
std::string ClassName
class Name
Definition: MPIObjectBase.h:65
char * castXMLCharToChar(xmlChar *c)
assign a value from a node. Use specialization for classes.
Definition: libxmldefs.h:62
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
int last(int igroup) const
return the last index of a group i
Definition: ParticleSet.h:517
static PlatformKind selectPlatform(std::string_view value)
RadialJastrowBuilder(Communicate *comm, ParticleSet &target, ParticleSet &source)
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...
Implements a Pade Function .
Definition: PadeFunctors.h:38
Specialization for two-body Jastrow function using multiple functors.
std::string Jastfunction
<jastrow function="...">
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
mRealType evaluate(mRealType r, mRealType rinv) const override
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
void computeJ2uk(const std::vector< RadFuncType *> &functors)
const DynamicCoordinates & getCoordinates() const
Definition: ParticleSet.h:246
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
std::unique_ptr< WaveFunctionComponent > createJ2(xmlNodePtr cur)
OHMMS_PRECISION real_type
User-defined functor.
std::string SpinOpt
<jastrow spin="...">
std::string TypeOpt
<jastrow type="...">
void error(const std::string &msg, bool fatal=false)
const auto & getLattice() const
Definition: ParticleSet.h:251
bool is_manager() const
return true if the rank == 0
Definition: MPIObjectBase.h:51
base class for LRHandlerTemp<FUNC,BASIS> and DummyLRHanlder<typename Func>
Definition: LRHandlerBase.h:30
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
int findSpecies(const std::string &name) const
if the input species is not found, add a new species
Definition: SpeciesSet.h:114
void barrier_and_abort(const std::string &msg) const
std::string extractCoefficientsID(xmlNodePtr cur)
return the id of the first coefficients. If not found, return an emtpy string
Define LRHandlerBase and DummyLRHandler<typename Func>
void initTwoBodyFunctor(RadFuncType &functor, double fac)
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42
bool isActive(Verbosity level) const
Define a LRHandler with two template parameters.
void reset() override
reset coefs from Parameters
const std::vector< std::string > candidate_values