QMCPACK
test_force.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: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
8 //
9 // File created by: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include "OhmmsData/Libxml2Doc.h"
16 #include "OhmmsPETE/OhmmsMatrix.h"
17 #include "Particle/ParticleSet.h"
27 
28 #include <stdio.h>
29 #include <string>
30 
31 using std::string;
32 
33 namespace qmcplusplus
34 {
35 TEST_CASE("Bare Force", "[hamiltonian]")
36 {
38 
39  const SimulationCell simulation_cell;
40  ParticleSet ions(simulation_cell);
41  ParticleSet elec(simulation_cell);
42 
43  ions.setName("ion");
44  ions.create({1});
45  ions.R[0] = {0.0, 0.0, 0.0};
46  elec.setName("elec");
47  elec.create({2});
48  elec.R[0] = {0.0, 1.0, 0.0};
49  elec.R[1] = {0.4, 0.3, 0.0};
50  SpeciesSet& tspecies = elec.getSpeciesSet();
51  int upIdx = tspecies.addSpecies("u");
52  //int chargeIdx = tspecies.addAttribute("charge");
53  int massIdx = tspecies.addAttribute("mass");
54  int eChargeIdx = tspecies.addAttribute("charge");
55  tspecies(eChargeIdx, upIdx) = -1.0;
56  tspecies(massIdx, upIdx) = 1.0;
57 
58 
59  // The call to resetGroups is needed transfer the SpeciesSet
60  // settings to the ParticleSet
61  elec.resetGroups();
62 
63  SpeciesSet& ion_species = ions.getSpeciesSet();
64  int pIdx = ion_species.addSpecies("H");
65  int pChargeIdx = ion_species.addAttribute("charge");
66  ion_species(pChargeIdx, pIdx) = 1;
67 
68  ions.resetGroups();
69  // Must update ions first in SoA so ions.coordinates_ is valid
70  ions.update();
71 
72  elec.addTable(ions);
73  elec.update();
74 
75  BareForce force(ions, elec);
76  force.setAddIonIon(false);
77 
78  force.evaluate(elec);
79 
80  //std::cout << " Force = " << force.getForces() << std::endl;
81  CHECK(force.getForces()[0][0] == Approx(3.2));
82  CHECK(force.getForces()[0][1] == Approx(3.4));
83  CHECK(force.getForces()[0][2] == Approx(0.0));
84 }
85 
87 {
88  CHECK(force2.Rcut == Approx(force.Rcut));
89  REQUIRE(force2.m_exp == force.m_exp);
90  REQUIRE(force2.N_basis == force.N_basis);
91  REQUIRE(force2.getAddIonIon() == force.getAddIonIon());
92  REQUIRE(force2.Sinv.size() == force.Sinv.size());
93  std::cout << force.Sinv << std::endl;
94  std::cout << force2.Sinv << std::endl;
95  for (int i = 0; i < force2.Sinv.rows(); i++)
96  {
97  for (int j = 0; j < force2.Sinv.cols(); j++)
98  {
99  //std::cout << "Sinv " << i << " " << j << " " << force2.Sinv(i,j) << " " << force.Sinv(i,j) << std::endl;
100  CHECK(force2.Sinv(i, j) == Approx(force.Sinv(i, j)));
101  }
102  }
103 
104  REQUIRE(force2.h.size() == force.h.size());
105  for (int i = 0; i < force2.h.size(); i++)
106  {
107  CHECK(force2.h[i] == Approx(force.h[i]));
108  }
109 
110  REQUIRE(force2.c.size() == force.c.size());
111  for (int i = 0; i < force2.h.size(); i++)
112  {
113  CHECK(force2.c[i] == Approx(force.c[i]));
114  }
115 
117  REQUIRE(force2.NumSpeciesA == force.NumSpeciesA);
118  REQUIRE(force2.NumSpeciesB == force.NumSpeciesB);
119  REQUIRE(force2.NptclA == force.NptclA);
120  REQUIRE(force2.NptclB == force.NptclB);
121  REQUIRE(force2.Zat.size() == force.Zat.size());
122  REQUIRE(force2.Qat.size() == force.Qat.size());
123  REQUIRE(force2.Zspec.size() == force.Zspec.size());
124  REQUIRE(force2.Qspec.size() == force.Qspec.size());
125 
126  REQUIRE(force2.getForcesIonIon().size() == force.getForcesIonIon().size());
127 }
128 
129 // PBC case
130 TEST_CASE("Chiesa Force", "[hamiltonian]")
131 {
133  lattice.BoxBConds = true; // periodic
134  lattice.R.diagonal(5.0);
135  lattice.LR_dim_cutoff = 25;
136  lattice.reset();
138 
139  const SimulationCell simulation_cell(lattice);
140  ParticleSet ions(simulation_cell);
141  ParticleSet elec(simulation_cell);
142 
143  ions.setName("ion");
144  ions.create({2});
145  ions.R[0] = {0.0, 0.0, 0.0};
146  ions.R[1] = {2.0, 0.0, 0.0};
147  elec.setName("elec");
148  elec.create({2});
149  elec.R[0] = {0.0, 1.0, 0.0};
150  elec.R[1] = {0.4, 0.3, 0.0};
151  SpeciesSet& tspecies = elec.getSpeciesSet();
152  int upIdx = tspecies.addSpecies("u");
153  int massIdx = tspecies.addAttribute("mass");
154  int eChargeIdx = tspecies.addAttribute("charge");
155  tspecies(eChargeIdx, upIdx) = -1.0;
156  tspecies(massIdx, upIdx) = 1.0;
157 
158  elec.createSK();
159 
160  SpeciesSet& ion_species = ions.getSpeciesSet();
161  int pIdx = ion_species.addSpecies("H");
162  int pChargeIdx = ion_species.addAttribute("charge");
163  ion_species(pChargeIdx, pIdx) = 1;
164  ions.createSK();
165 
166  ions.resetGroups();
167 
168  // The call to resetGroups is needed transfer the SpeciesSet
169  // settings to the ParticleSet
170  elec.resetGroups();
171 
172 
173  ForceChiesaPBCAA force(ions, elec);
174  force.setAddIonIon(false);
175  force.InitMatrix();
176 
177  elec.update();
178  force.evaluate(elec);
179  std::cout << " Force = " << force.getForces() << std::endl;
180  std::cout << " Forces_IonIon = " << force.getForcesIonIon() << std::endl;
181 
182  // Unvalidated externally
183  CHECK(force.getForces()[0][0] == Approx(3.186559306));
184  CHECK(force.getForces()[0][1] == Approx(3.352572459));
185  CHECK(force.getForces()[0][2] == Approx(0.0));
186  CHECK(force.getForcesIonIon()[0][0] == Approx(-0.1478626893));
187  CHECK(force.getForcesIonIon()[0][1] == Approx(0.0));
188  CHECK(force.getForcesIonIon()[0][2] == Approx(0.0));
189  CHECK(force.getForcesIonIon()[1][0] == Approx(0.1478626893));
190  CHECK(force.getForcesIonIon()[1][1] == Approx(0.0));
191  CHECK(force.getForcesIonIon()[1][2] == Approx(0.0));
192 
193  // Let's test CoulombPBCAA and CoulombPBCAB forces, too; Unvalidated externally
194  CoulombPBCAA ionForce(ions, false, true, false);
195  CHECK(ionForce.getForces()[0][0] == Approx(-0.1478626893));
196  CHECK(ionForce.getForces()[1][0] == Approx(0.1478626893));
197 
198  CoulombPBCAB elecIonForce(ions, elec, true);
199  elecIonForce.evaluate(elec); // Not computed upon construction
200  std::cout << " CoulombElecIon = " << elecIonForce.getForces() << std::endl;
201  CHECK(elecIonForce.getForces()[0][0] == Approx(3.186558296));
202  CHECK(elecIonForce.getForces()[0][1] == Approx(3.352572459));
203  CHECK(elecIonForce.getForces()[1][0] == Approx(-0.3950094326));
204  CHECK(elecIonForce.getForces()[1][1] == Approx(0.142639218));
205 
206  // The following crafty test is supposed to crash if some checks are out of place
207  // This imitates an actual simulation, where Nelec ~= Nnuc that would also crash
208 
209  // ParticleSet with 3 ions
210  ParticleSet ions3(simulation_cell);
211  ions3.setName("ion");
212  ions3.create({3});
213  ions3.R[0] = {0, 0, 0};
214  ions3.R[1] = {1, 1, 1};
215  ions3.R[2] = {2, 2, 2};
216  SpeciesSet& ion3_species = ions3.getSpeciesSet();
217  int p3Idx = ion3_species.addSpecies("H");
218  int p3ChargeIdx = ion3_species.addAttribute("charge");
219  ion3_species(p3ChargeIdx, p3Idx) = 1;
220  ions3.createSK();
221  ions3.resetGroups();
222 
223  // Namely, sending in incompatible force arrays to evaluateWithIonDerivs is not
224  // supposed to do harm, IF
225  // 1) forces are not enabled
226  CoulombPBCAA noIonForce(ions3, false, false, false);
227  // 2) The species is active
228  CoulombPBCAA noElecForce(elec, true, true, false);
229 
230  RuntimeOptions runtime_options;
231  TrialWaveFunction psi(runtime_options);
232  // Making local copies here in refactoring attempt to disallow modifying
233  // ForceBase members directly...
234  // Probably fine for a test but if this type of behavior was needed in
235  // production code in the future, a different solution would be needed.
236  auto noElecForces = noElecForce.getForces();
237  noIonForce.evaluateWithIonDerivs(ions3, ions3, psi, noElecForces, noElecForces);
238  auto noIonForces = noIonForce.getForces();
239  noElecForce.evaluateWithIonDerivs(elec, ions3, psi, noIonForces, noIonForces);
240 
241  // It seems a bit silly to test the makeClone method
242  // but this class does not use the compiler's copy constructor and
243  // there was a bug where the add_ion_ion_ member did not get
244  // copied. Would be nice if there were a better way than inspection
245  // to ensure all the members are copied/set up/tested.
246 
247  std::unique_ptr<OperatorBase> base_force2 = force.makeClone(elec, psi);
248  ForceChiesaPBCAA* force2 = dynamic_cast<ForceChiesaPBCAA*>(base_force2.get());
249  REQUIRE(force2 != nullptr);
250 
251  check_force_copy(*force2, force);
252 }
253 
254 // Open BC case
255 TEST_CASE("Ceperley Force", "[hamiltonian]")
256 {
257  const SimulationCell simulation_cell;
258  ParticleSet ions(simulation_cell);
259  ParticleSet elec(simulation_cell);
260 
261  ions.setName("ion");
262  ions.create({2});
263  ions.R[0] = {0.0, 0.0, 0.0};
264  ions.R[1] = {2.0, 0.0, 0.0};
265  elec.setName("elec");
266  elec.create({2});
267  elec.R[0] = {0.0, 1.0, 0.0};
268  elec.R[1] = {0.2, 0.3, 0.0};
269  SpeciesSet& tspecies = elec.getSpeciesSet();
270  int upIdx = tspecies.addSpecies("u");
271  int massIdx = tspecies.addAttribute("mass");
272  int eChargeIdx = tspecies.addAttribute("charge");
273  tspecies(eChargeIdx, upIdx) = -1.0;
274  tspecies(massIdx, upIdx) = 1.0;
275  //elec.createSK();
276 
277  SpeciesSet& ion_species = ions.getSpeciesSet();
278  int pIdx = ion_species.addSpecies("H");
279  int pChargeIdx = ion_species.addAttribute("charge");
280  ion_species(pChargeIdx, pIdx) = 1;
281  //ions.createSK();
282  ions.resetGroups();
283 
284  // The call to resetGroups is needed transfer the SpeciesSet
285  // settings to the ParticleSet
286  elec.resetGroups();
287 
288  ForceCeperley force(ions, elec);
289  force.InitMatrix();
290 
291  /// From the 'Force.ipynb' Jupyter notebook
292  // for m_exp=2, N_basis=4, Rcut=0.4
293  double coeff[4] = {4375, -44296.9, 147656, -161133};
294  for (int i = 0; i < 4; i++)
295  {
296  CHECK(force.c[i] == Approx(coeff[i]));
297  }
298 
299  ions.update();
300  elec.update();
301 
302  force.setAddIonIon(true); // is true by default
303  force.evaluate(elec);
304  std::cout << " Force ionion = " << force.getForcesIonIon() << std::endl;
305  std::cout << " Force = " << force.getForces() << std::endl;
306  CHECK(force.getForces()[0][0] == Approx(8.99061106).epsilon(1e-4));
307  CHECK(force.getForces()[0][1] == Approx(14.86091659).epsilon(1e-4));
308  CHECK(force.getForces()[0][2] == Approx(0.0));
309  CHECK(force.getForces()[1][0] == Approx(-0.2250998297).epsilon(1e-4));
310  CHECK(force.getForces()[1][1] == Approx(0.1388117844).epsilon(1e-4));
311  CHECK(force.getForces()[1][2] == Approx(0.0));
312 
313  force.N_basis = 6;
314  force.Rcut = 0.8;
315  force.InitMatrix();
316  // for m_exp=2, N_basis=6, Rcut=0.800000
317  double coeff2[6] = {3281.25, -33837.9, 135352, -261841, 245476, -89496.4};
318  for (int i = 0; i < 6; i++)
319  {
320  CHECK(force.c[i] == Approx(coeff2[i]));
321  }
322 }
323 
324 // Test construction of Coulomb forces in OBC
325 TEST_CASE("Ion-ion Force", "[hamiltonian]")
326 {
327  const SimulationCell simulation_cell;
328  ParticleSet ions(simulation_cell);
329  ParticleSet elec(simulation_cell);
330 
331  ions.setName("ions");
332  ions.create({3});
333  ions.R[0] = {0.0, 0.0, 0.0};
334  ions.R[1] = {2.0, 0.0, 0.0};
335  ions.R[2] = {1.0, 1.0, 0.0};
336  elec.setName("elec");
337  elec.create({3});
338  elec.R[0] = {0.0, 1.0, 0.0};
339  elec.R[1] = {2.0, 1.0, 0.0};
340  elec.R[2] = {1.0, 0.0, 0.0};
341  SpeciesSet& ionSpecies = ions.getSpeciesSet();
342  int HIdx = ionSpecies.addSpecies("H");
343  int HChargeIdx = ionSpecies.addAttribute("charge");
344  ionSpecies(HChargeIdx, HIdx) = 1;
345  ions.resetGroups();
346 
347  SpeciesSet& elecSpecies = elec.getSpeciesSet();
348  int upIdx = elecSpecies.addSpecies("u");
349  int massIdx = elecSpecies.addAttribute("mass");
350  int eChargeIdx = elecSpecies.addAttribute("charge");
351  elecSpecies(eChargeIdx, upIdx) = -1.0;
352  elecSpecies(massIdx, upIdx) = 1.0;
353  elec.resetGroups();
354 
355  CoulombPotential<OperatorBase::Return_t> ionForce(ions, false, true);
356  CoulombPotential<OperatorBase::Return_t> elecIonForce(elec, ions, true); // Should be zero
357  CoulombPotential<OperatorBase::Return_t> elecForce(elec, true, true); // Should be zero
358 
359  double coeff0[3] = {-0.60355339059, -0.35355339059, 0.0};
360  double coeff1[3] = {0.60355339059, -0.35355339059, 0.0};
361  double coeff2[3] = {0.00000000000, 0.70710678119, 0.0};
362  for (int i = 0; i < 3; i++)
363  {
364  CHECK(ionForce.getForces()[0][i] == Approx(coeff0[i]));
365  CHECK(ionForce.getForces()[1][i] == Approx(coeff1[i]));
366  CHECK(ionForce.getForces()[2][i] == Approx(coeff2[i]));
367  CHECK(elecIonForce.getForces()[0][i] == Approx(0.0));
368  CHECK(elecIonForce.getForces()[1][i] == Approx(0.0));
369  CHECK(elecIonForce.getForces()[2][i] == Approx(0.0));
370  CHECK(elecForce.getForces()[0][i] == Approx(0.0));
371  CHECK(elecForce.getForces()[1][i] == Approx(0.0));
372  CHECK(elecForce.getForces()[2][i] == Approx(0.0));
373  }
374 }
375 
376 TEST_CASE("AC Force", "[hamiltonian]")
377 {
378  using Real = QMCTraits::RealType;
379  const SimulationCell simulation_cell;
380  ParticleSet ions(simulation_cell);
381  ParticleSet elec(simulation_cell);
382 
383  ions.setName("ion");
384  ions.create({1});
385  ions.R[0] = {0.0, 0.0, 0.0};
386  elec.setName("elec");
387  elec.create({2});
388  elec.R[0] = {0.0, 1.0, 0.0};
389  elec.R[1] = {0.4, 0.3, 0.0};
390  SpeciesSet& tspecies = elec.getSpeciesSet();
391  int upIdx = tspecies.addSpecies("u");
392  //int chargeIdx = tspecies.addAttribute("charge");
393  int massIdx = tspecies.addAttribute("mass");
394  int eChargeIdx = tspecies.addAttribute("charge");
395  tspecies(eChargeIdx, upIdx) = -1.0;
396  tspecies(massIdx, upIdx) = 1.0;
397 
398 
399  // The call to resetGroups is needed transfer the SpeciesSet
400  // settings to the ParticleSet
401  elec.resetGroups();
402 
403  SpeciesSet& ion_species = ions.getSpeciesSet();
404  int pIdx = ion_species.addSpecies("H");
405  int pChargeIdx = ion_species.addAttribute("charge");
406  ion_species(pChargeIdx, pIdx) = 1;
407 
408  ions.resetGroups();
409  // Must update ions first in SoA so ions.coordinates_ is valid
410  ions.update();
411 
412  elec.addTable(ions);
413  elec.update();
414 
415  // defaults
416  RuntimeOptions runtime_options;
417  TrialWaveFunction psi(runtime_options);
418  QMCHamiltonian qmcHamiltonian;
419 
420  //This is redundant code, but necessary to avoid adding API's to
421  //modify internal state. Avoid constructor+put() complexities for now.
422  //Revisit in future.
423  //
424  //Old algorithm is the legacy force path, new is the fast force derivative path.
425  ACForce force_old(ions, elec, psi, qmcHamiltonian);
426  ACForce force_new(ions, elec, psi, qmcHamiltonian);
427  const std::string acforceXMLold = R"(<tmp>
428  <acforce spacewarp="no" swpow="2." delta="1.e-3">
429  </acforce>
430  </tmp>
431  )";
432 
433  const std::string acforceXMLnew = R"(<tmp>
434  <acforce spacewarp="no" swpow="2." delta="1.e-3" fast_derivatives="yes">
435  </acforce>
436  </tmp>
437  )";
438 
440  //Let magnitude be 1
441  g[0][0] = std::sqrt(1.0 / 2.0);
442  g[1][2] = std::sqrt(1.0 / 2.0);
443 
444  //Epsilon = 2 places this within the regularizer threshold of x < 1.
445  Real regval = ACForce::compute_regularizer_f(g, 2);
446  CHECK(regval == Approx(1.421875));
447  //Epsilon = 0.001 places this way outside of regularizer threshold.
448  //Should return 1.
449  regval = ACForce::compute_regularizer_f(g, 0.001);
450  CHECK(regval == Approx(1.0));
451  //Epsilon = 0.0 indicates the regularizer is not used. Return 1.
452  regval = ACForce::compute_regularizer_f(g, 0.0);
453  CHECK(regval == Approx(1.0));
454 
455  Libxml2Document olddoc;
456  Libxml2Document newdoc;
457  bool oldokay = olddoc.parseFromString(acforceXMLold);
458  REQUIRE(oldokay);
459  bool newokay = newdoc.parseFromString(acforceXMLnew);
460  REQUIRE(newokay);
461 
462  xmlNodePtr oldroot = olddoc.getRoot();
463  xmlNodePtr oldh1 = xmlFirstElementChild(oldroot);
464  xmlNodePtr newroot = newdoc.getRoot();
465  xmlNodePtr newh1 = xmlFirstElementChild(newroot);
466 
467  force_old.put(oldh1);
468  force_new.put(newh1);
469  const auto vold = force_old.evaluate(elec);
470  const auto vnew = force_new.evaluate(elec);
471  force_old.resetTargetParticleSet(elec); // does nothing?
472 
473  CHECK(vold == Approx(0));
474  CHECK(vnew == Approx(0));
475  REQUIRE(force_old.get(std::cout) == true);
476 
477  force_old.add2Hamiltonian(elec, psi, qmcHamiltonian);
478 
479  auto clone = force_old.makeClone(elec, psi, qmcHamiltonian);
480  REQUIRE(clone);
481 }
482 
483 } // namespace qmcplusplus
a class that defines a supercell in D-dimensional Euclean space.
void setName(const std::string &aname)
Definition: ParticleSet.h:237
static RealType compute_regularizer_f(const ParticleGradient &G, const RealType epsilon)
Computes multiplicative regularizer f(G,epsilon) according to Pathak-Wagner arXiv:2002.01434 .
Definition: ACForce.cpp:196
class that handles xmlDoc
Definition: Libxml2Doc.h:76
Return_t evaluate(ParticleSet &P) final
Evaluate.
Definition: ACForce.cpp:101
Calculates the AA Coulomb potential using PBCs.
Definition: CoulombPBCAA.h:38
Return_t evaluateWithIonDerivs(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms) override
Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase...
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
Definition: SpeciesSet.cpp:33
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Calculates the AA Coulomb potential using PBCs.
Definition: CoulombPBCAB.h:38
QTBase::RealType RealType
Definition: Configuration.h:58
size_t getTotalNum() const
Definition: ParticleSet.h:493
int NptclA
number of particles of A
TEST_CASE("complex_helper", "[type_traits]")
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Collection of Local Energy Operators.
bool get(std::ostream &os) const final
write about the class
Definition: ACForce.cpp:90
void update(bool skipSK=false)
update the internal data
Attaches a unit to a Vector for IO.
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
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
size_type cols() const
Definition: OhmmsMatrix.h:78
Wrapping information on parallelism.
Definition: Communicate.h:68
int NumSpeciesB
number of species of B particle set
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
void check_force_copy(ForceChiesaPBCAA &force, ForceChiesaPBCAA &force2)
Definition: test_force.cpp:86
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
size_type size() const
Definition: OhmmsMatrix.h:76
size_type size() const
return the current size
Definition: OhmmsVector.h:162
int NptclB
number of particles of B
REQUIRE(std::filesystem::exists(filename))
bool put(xmlNodePtr cur) final
I/O Routines.
Definition: ACForce.cpp:63
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
ParticlePos R
Position.
Definition: ParticleSet.h:79
size_type rows() const
Definition: OhmmsMatrix.h:77
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
void create(const std::vector< int > &agroup)
create grouped particles
Declaration of a TrialWaveFunction.
std::vector< RealType > Qat
Qat[iat] charge for the iat-th particle of B.
int NumSpeciesA
number of species of A particle set
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
const ParticleSet::ParticlePos & getForcesIonIon() const noexcept
Definition: ForceBase.h:68
Class to represent a many-body trial wave function.
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
Definition: BareForce.cpp:54
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void add2Hamiltonian(ParticleSet &qp, TrialWaveFunction &psi, QMCHamiltonian &targetH) final
Since we store a reference to QMCHamiltonian, the baseclass method add2Hamiltonian isn&#39;t sufficient...
Definition: ACForce.cpp:92
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
void createSK()
create Structure Factor with PBCs
void resetTargetParticleSet(ParticleSet &P) final
Initialization/assignment.
Definition: ACForce.cpp:137
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
bool getAddIonIon() const noexcept
Definition: ForceBase.h:61
Declaration of ACForce, Assaraf-Caffarel ZVZB style force estimation.
std::vector< RealType > Zspec
Zspec[spec] charge for the spec-th species of A.
void setAddIonIon(bool val) noexcept
Definition: ForceBase.h:62
Vector< FullPrecRealType > c
Definition: ForceCeperley.h:40
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
Cloning.
Definition: ACForce.cpp:46
std::vector< RealType > Qspec
Qspec[spec] charge for the spec-th species of B.
const ParticleSet::ParticlePos & getForces() const noexcept
Definition: ForceBase.h:64