QMCPACK
test_TrialWaveFunction_He.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) 2020 QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
8 // Ye Luo, yeluo@anl.gov, Argonne National Laboratory
9 //
10 // File created by: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 
14 #include "catch.hpp"
15 
16 #include "OhmmsData/Libxml2Doc.h"
17 #include "Particle/ParticleSet.h"
26 #include <ResourceCollection.h>
27 
28 namespace qmcplusplus
29 {
30 std::unique_ptr<TrialWaveFunction> setup_He_wavefunction(Communicate* c,
31  ParticleSet& elec,
32  ParticleSet& ions,
33  const WaveFunctionFactory::PSetMap& particle_set_map)
34 {
35  std::vector<int> agroup(2);
36  int nelec = 2;
37  agroup[0] = 1;
38  agroup[1] = 1;
39  elec.create(agroup);
40  elec.R[0] = {1.0, 2.0, 3.0};
41  elec.R[1] = {1.0, 2.1, 2.2};
42  SpeciesSet& tspecies = elec.getSpeciesSet();
43  int upIdx = tspecies.addSpecies("u");
44  int downIdx = tspecies.addSpecies("d");
45  int massIdx = tspecies.addAttribute("mass");
46  // Define the charge so the Jastrow cusp is set automatically
47  int e_chargeIdx = tspecies.addAttribute("charge");
48  // Mass is set oddly so the parameter derivative code is tested properly
49  tspecies(massIdx, upIdx) = 3.0;
50  tspecies(massIdx, downIdx) = 3.0;
51  tspecies(e_chargeIdx, upIdx) = -1.0;
52  tspecies(e_chargeIdx, downIdx) = -1.0;
53  elec.resetGroups();
54 
55  ions.create({1});
56  ions.R[0] = {0.0, 0.0, 0.0};
57  SpeciesSet& he_species = ions.getSpeciesSet();
58  int He_Idx = he_species.addSpecies("He");
59  int chargeIdx = he_species.addAttribute("charge");
60  tspecies(chargeIdx, He_Idx) = 2.0;
61  tspecies(massIdx, upIdx) = 2.0;
62 
63  elec.addTable(ions);
64 
65  WaveFunctionFactory wff(elec, particle_set_map, c);
66 
67  const char* wavefunction_xml = R"(<wavefunction name="psi0" target="e">
68  <jastrow name="Jee" type="Two-Body" function="pade">
69  <correlation speciesA="u" speciesB="d">
70  <var id="jud_b" name="B">0.8</var>
71  </correlation>
72  </jastrow>
73  <determinantset type="MO" key="STO" transform="no" source="ion0">
74  <basisset>
75  <atomicBasisSet type="STO" elementType="He">
76  <basisGroup rid="R0" n="1" l="0" m="0" type="Slater">
77  <radfunc exponent="2.0"/>
78  </basisGroup>
79  </atomicBasisSet>
80  </basisset>
81  <slaterdeterminant>
82  <determinant id="updet" spin="1" size="1">
83  <coefficient id="updetC" type="Array" size="1">
84  1.0
85  </coefficient>
86  </determinant>
87  <determinant id="downdet" spin="-1" size="1">
88  <coefficient id="downdetC" type="Array" size="1">
89  1.0
90  </coefficient>
91  </determinant>
92  </slaterdeterminant>
93  </determinantset>
94  </wavefunction>)";
95 
96 
98  bool okay = doc.parseFromString(wavefunction_xml);
99  REQUIRE(okay);
100 
101  xmlNodePtr root = doc.getRoot();
102  RuntimeOptions runtime_options;
103  auto twf_ptr = wff.buildTWF(root, runtime_options);
104 
105  REQUIRE(twf_ptr != nullptr);
106  REQUIRE(twf_ptr->size() == 2);
107 
108  return twf_ptr;
109 }
110 
111 TEST_CASE("TrialWaveFunction flex_evaluateParameterDerivatives", "[wavefunction]")
112 {
114 
116 
117  const SimulationCell simulation_cell;
118  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
119  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
120  auto &ions(*ions_ptr), elec(*elec_ptr);
121  ions.setName("ion0");
122  elec.setName("e");
123  WaveFunctionFactory::PSetMap particle_set_map;
124  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
125  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
126 
127  auto psi_ptr = setup_He_wavefunction(c, elec, ions, particle_set_map);
128  TrialWaveFunction& psi(*psi_ptr);
129 
130  ions.update();
131  elec.update();
132 
133  const int nparam = 1;
134  optimize::VariableSet var_param;
135  psi.checkInVariables(var_param);
136 
137  Vector<ValueType> dlogpsi(nparam);
138  Vector<ValueType> dhpsioverpsi(nparam);
139 
140  psi.evaluateDerivatives(elec, var_param, dlogpsi, dhpsioverpsi);
141 
142 
143  // testing batched interfaces
144  ResourceCollection pset_res("test_pset_res");
145  ResourceCollection twf_res("test_twf_res");
146 
147  elec.createResource(pset_res);
148  psi.createResource(twf_res);
149 
150  {
151  // Test list with one wavefunction
152  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi});
153  RefVectorWithLeader<ParticleSet> p_list(elec, {elec});
154 
155  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
156  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
157 
158 
159  const int nentry = 1;
160  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
161  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
162 
163  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, var_param, dlogpsi_list, dhpsi_over_psi_list);
164 
165  CHECK(dlogpsi[0] == ValueApprox(dlogpsi_list[0][0]));
166  CHECK(dhpsioverpsi[0] == ValueApprox(dhpsi_over_psi_list[0][0]));
167  }
168 
169  { // Test list with two wavefunctions
170  const int nentry = 2;
171  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
172  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
173 
174  ParticleSet elec2(elec);
175  elec2.R[0][0] = 0.9;
176  elec2.update();
177 
178  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi, psi});
179  RefVectorWithLeader<ParticleSet> p_list(elec, {elec, elec2});
180  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
181  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
182 
183  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, var_param, dlogpsi_list, dhpsi_over_psi_list);
184 
185  Vector<ValueType> dlogpsi2(nparam);
186  Vector<ValueType> dhpsioverpsi2(nparam);
187 
188  psi.evaluateDerivatives(elec2, var_param, dlogpsi2, dhpsioverpsi2);
189 
190  CHECK(dlogpsi[0] == ValueApprox(dlogpsi_list[0][0]));
191  CHECK(dhpsioverpsi[0] == ValueApprox(dhpsi_over_psi_list[0][0]));
192 
193  CHECK(dlogpsi2[0] == ValueApprox(dlogpsi_list[1][0]));
194  CHECK(dhpsioverpsi2[0] == ValueApprox(dhpsi_over_psi_list[1][0]));
195  }
196 }
197 
198 
200 {
202  for (int i = 0; i < nentry; i++)
203  G_list.emplace_back(std::make_unique<ParticleSet::ParticleGradient>(nelec));
204 
205  return G_list;
206 }
207 
209 {
211  for (int i = 0; i < nentry; i++)
212  L_list.emplace_back(std::make_unique<ParticleSet::ParticleLaplacian>(nelec));
213 
214  return L_list;
215 }
216 
217 TEST_CASE("TrialWaveFunction flex_evaluateDeltaLogSetup", "[wavefunction]")
218 {
221 
223  const SimulationCell simulation_cell;
224  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
225  auto elec1_ptr = std::make_unique<ParticleSet>(simulation_cell);
226  auto &ions(*ions_ptr), elec1(*elec1_ptr);
227  ions.setName("ion0");
228  elec1.setName("e");
229  WaveFunctionFactory::PSetMap particle_set_map;
230  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
231  particle_set_map.emplace(elec1_ptr->getName(), std::move(elec1_ptr));
232 
233  // This He wavefunction has two components
234  // The orbitals are fixed and have not optimizable parameters.
235  // The Jastrow factor does have an optimizable parameter.
236  auto psi_ptr = setup_He_wavefunction(c, elec1, ions, particle_set_map);
237  TrialWaveFunction& psi(*psi_ptr);
238  ions.update();
239  elec1.update();
240 
241  ParticleSet elec1b(elec1);
242  elec1b.update();
243 
244  ParticleSet elec2(elec1);
245  elec2.R[0][0] = 0.9;
246  elec2.update();
247  ParticleSet elec2b(elec2);
248  elec2b.update();
249 
250  RuntimeOptions runtime_options;
251  TrialWaveFunction psi2(runtime_options);
252  auto orb1 = psi.getOrbitals()[0]->makeClone(elec2);
253  psi2.addComponent(std::move(orb1));
254  auto orb2 = psi.getOrbitals()[1]->makeClone(elec2);
255  psi2.addComponent(std::move(orb2));
256 
257 
258  // testing batched interfaces
259  ResourceCollection pset_res("test_pset_res");
260  ResourceCollection twf_res("test_twf_res");
261 
262  elec1b.createResource(pset_res);
263  psi.createResource(twf_res);
264 
265  const int nelec = 2;
266  RealType logpsi_fixed_r1;
267  RealType logpsi_opt_r1;
270  fixedG1.resize(nelec);
271  fixedL1.resize(nelec);
272 
273  { // Prepare to compare using list with one wavefunction and particleset
274  const int nentry = 1;
275 
276  RefVectorWithLeader<ParticleSet> p_list(elec1b, {elec1b});
277  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi});
278 
279  // Evaluate new flex_evaluateDeltaLogSetup
280  auto fixedG_list_ptr = create_particle_gradient(nelec, nentry);
281  auto fixedL_list_ptr = create_particle_laplacian(nelec, nentry);
282  auto fixedG_list = convertUPtrToRefVector(fixedG_list_ptr);
283  auto fixedL_list = convertUPtrToRefVector(fixedL_list_ptr);
284 
285  std::vector<RealType> logpsi_fixed_list(nentry);
286  std::vector<RealType> logpsi_opt_list(nentry);
287 
288  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
289  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
290 
291  TrialWaveFunction::mw_evaluateDeltaLogSetup(wf_list, p_list, logpsi_fixed_list, logpsi_opt_list, fixedG_list,
292  fixedL_list);
293 
294 
295  // Evaluate old (single item) evaluateDeltaLog
296  psi.evaluateDeltaLogSetup(elec1, logpsi_fixed_r1, logpsi_opt_r1, fixedG1, fixedL1);
297 
298  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_list[0]));
299  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_list[0]));
300 
301  CHECK(fixedG1[0][0] == ValueApprox(fixedG_list[0].get()[0][0]));
302  CHECK(fixedG1[0][1] == ValueApprox(fixedG_list[0].get()[0][1]));
303  CHECK(fixedG1[0][2] == ValueApprox(fixedG_list[0].get()[0][2]));
304  CHECK(fixedG1[1][0] == ValueApprox(fixedG_list[0].get()[1][0]));
305  CHECK(fixedG1[1][1] == ValueApprox(fixedG_list[0].get()[1][1]));
306  CHECK(fixedG1[1][2] == ValueApprox(fixedG_list[0].get()[1][2]));
307 
308  CHECK(fixedL1[0] == ValueApprox(fixedL_list[0].get()[0]));
309  CHECK(fixedL1[1] == ValueApprox(fixedL_list[0].get()[1]));
310 
311  // Compare the ParticleSet gradient and laplacian storage
312  // This should be temporary until these get removed from ParticleSet
313  CHECK(elec1b.L[0] == ValueApprox(elec1.L[0]));
314  CHECK(elec1b.L[1] == ValueApprox(elec1.L[1]));
315 
316  CHECK(elec1b.G[0][0] == ValueApprox(elec1.G[0][0]));
317  CHECK(elec1b.G[1][1] == ValueApprox(elec1.G[1][1]));
318  }
319 
320  { // Prepare to compare using list with two wavefunctions and particlesets
321  const int nentry = 2;
322 
323  RefVectorWithLeader<ParticleSet> p_list(elec1b, {elec1b, elec2b});
324  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi, psi2});
325 
326  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
327  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
328 
329  auto fixedG_list_ptr = create_particle_gradient(nelec, nentry);
330  auto fixedL_list_ptr = create_particle_laplacian(nelec, nentry);
331  auto fixedG_list = convertUPtrToRefVector(fixedG_list_ptr);
332  auto fixedL_list = convertUPtrToRefVector(fixedL_list_ptr);
333 
334  std::vector<RealType> logpsi_fixed_list2(nentry);
335  std::vector<RealType> logpsi_opt_list2(nentry);
336 
337  RealType logpsi_fixed_r1b;
338  RealType logpsi_opt_r1b;
339  psi2.evaluateDeltaLogSetup(elec1, logpsi_fixed_r1b, logpsi_opt_r1b, fixedG1, fixedL1);
340 
341  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_r1b));
342  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_r1b));
343 
344  auto fixedG_list2_ptr = create_particle_gradient(nelec, nentry);
345  auto fixedL_list2_ptr = create_particle_laplacian(nelec, nentry);
346  auto fixedG_list2 = convertUPtrToRefVector(fixedG_list2_ptr);
347  auto fixedL_list2 = convertUPtrToRefVector(fixedL_list2_ptr);
348 
349  TrialWaveFunction::mw_evaluateDeltaLogSetup(wf_list, p_list, logpsi_fixed_list2, logpsi_opt_list2, fixedG_list2,
350  fixedL_list2);
351 
352  // Evaluate old (single item) evaluateDeltaLog corresponding to the second wavefunction/particleset
353 
354  RealType logpsi_fixed_r2;
355  RealType logpsi_opt_r2;
358  fixedG2.resize(nelec);
359  fixedL2.resize(nelec);
360 
361  psi2.setLogPsi(0.0);
362  psi2.evaluateDeltaLogSetup(elec2, logpsi_fixed_r2, logpsi_opt_r2, fixedG2, fixedL2);
363 
364  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_r1b));
365  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_r1b));
366 
367  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_list2[0]));
368  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_list2[0]));
369 
370  CHECK(logpsi_fixed_r2 == Approx(logpsi_fixed_list2[1]));
371  CHECK(logpsi_opt_r2 == Approx(logpsi_opt_list2[1]));
372 
373  // Laplacian for first entry in the wavefunction/particleset list
374  CHECK(fixedL1[0] == ValueApprox(fixedL_list2[0].get()[0]));
375  CHECK(fixedL1[1] == ValueApprox(fixedL_list2[0].get()[1]));
376  // Laplacian for second entry in the wavefunction/particleset list
377  CHECK(fixedL2[0] == ValueApprox(fixedL_list2[1].get()[0]));
378  CHECK(fixedL2[1] == ValueApprox(fixedL_list2[1].get()[1]));
379 
380 
381  // First entry wavefunction/particleset list
382  // Gradient for first electron
383  CHECK(fixedG1[0][0] == ValueApprox(fixedG_list2[0].get()[0][0]));
384  CHECK(fixedG1[0][1] == ValueApprox(fixedG_list2[0].get()[0][1]));
385  CHECK(fixedG1[0][2] == ValueApprox(fixedG_list2[0].get()[0][2]));
386  // Gradient for second electron
387  CHECK(fixedG1[1][0] == ValueApprox(fixedG_list2[0].get()[1][0]));
388  CHECK(fixedG1[1][1] == ValueApprox(fixedG_list2[0].get()[1][1]));
389  CHECK(fixedG1[1][2] == ValueApprox(fixedG_list2[0].get()[1][2]));
390 
391 
392  // Second entry wavefunction/particleset list
393  // Gradient for first electron
394  CHECK(fixedG2[0][0] == ValueApprox(fixedG_list2[1].get()[0][0]));
395  CHECK(fixedG2[0][1] == ValueApprox(fixedG_list2[1].get()[0][1]));
396  CHECK(fixedG2[0][2] == ValueApprox(fixedG_list2[1].get()[0][2]));
397  // Gradient for second electron
398  CHECK(fixedG2[1][0] == ValueApprox(fixedG_list2[1].get()[1][0]));
399  CHECK(fixedG2[1][1] == ValueApprox(fixedG_list2[1].get()[1][1]));
400  CHECK(fixedG2[1][2] == ValueApprox(fixedG_list2[1].get()[1][2]));
401 
402  // Compare the ParticleSet gradient and laplacian storage
403  // This should be temporary until these get removed from ParticleSet
404  CHECK(elec1b.L[0] == ValueApprox(elec1.L[0]));
405  CHECK(elec1b.L[1] == ValueApprox(elec1.L[1]));
406  CHECK(elec2b.L[0] == ValueApprox(elec2.L[0]));
407  CHECK(elec2b.L[1] == ValueApprox(elec2.L[1]));
408 
409  CHECK(elec2b.G[0][0] == ValueApprox(elec2.G[0][0]));
410  CHECK(elec2b.G[1][1] == ValueApprox(elec2.G[1][1]));
411 
412 
413  // these lists not used if 'recompute' is false
416 
417  std::vector<RealType> logpsi_variable_list(nentry);
418  TrialWaveFunction::mw_evaluateDeltaLog(wf_list, p_list, logpsi_variable_list, dummyG_list, dummyL_list, false);
419 
420  RealType logpsi1 = psi.evaluateDeltaLog(p_list[0], false);
421  CHECK(logpsi1 == Approx(logpsi_variable_list[0]));
422 
423  RealType logpsi2 = psi2.evaluateDeltaLog(p_list[1], false);
424  CHECK(logpsi2 == Approx(logpsi_variable_list[1]));
425 
426 
427  // Now check with 'recompute = true'
428  auto dummyG_list2_ptr = create_particle_gradient(nelec, nentry);
429  auto dummyL_list2_ptr = create_particle_laplacian(nelec, nentry);
430  auto dummyG_list2 = convertUPtrToRefVector(dummyG_list2_ptr);
431  auto dummyL_list2 = convertUPtrToRefVector(dummyL_list2_ptr);
432 
433  std::vector<RealType> logpsi_variable_list2(nentry);
434 
435  TrialWaveFunction::mw_evaluateDeltaLog(wf_list, p_list, logpsi_variable_list2, dummyG_list2, dummyL_list2, true);
436 
437  RealType logpsi1b = psi.evaluateDeltaLog(p_list[0], true);
438  CHECK(logpsi1b == Approx(logpsi_variable_list2[0]));
439 
440  RealType logpsi2b = psi2.evaluateDeltaLog(p_list[1], true);
441  CHECK(logpsi2b == Approx(logpsi_variable_list2[1]));
442  }
443 }
444 
445 } // namespace qmcplusplus
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
class that handles xmlDoc
Definition: Libxml2Doc.h:76
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
UPtrVector< ParticleSet::ParticleGradient > create_particle_gradient(int nelec, int nentry)
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate derivatives of KE wrt optimizable varibles
QTBase::RealType RealType
Definition: Configuration.h:58
TEST_CASE("complex_helper", "[type_traits]")
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Builder class for einspline-based SPOSet objects.
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
std::vector< std::unique_ptr< T > > UPtrVector
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
ParticleLaplacian L
laplacians of the particles
Definition: ParticleSet.h:85
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
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
void setLogPsi(RealType LogPsi_new)
UPtrVector< ParticleSet::ParticleLaplacian > create_particle_laplacian(int nelec, int nentry)
void evaluateDeltaLogSetup(ParticleSet &P, RealType &logpsi_fixed, RealType &logpsi_opt, ParticleSet::ParticleGradient &fixedG, ParticleSet::ParticleLaplacian &fixedL)
evaluate the sum of log value of optimizable many-body wavefunctions
Wrapping information on parallelism.
Definition: Communicate.h:68
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
std::unique_ptr< TrialWaveFunction > setup_He_wavefunction(Communicate *c, ParticleSet &elec, ParticleSet &ions, const WaveFunctionFactory::PSetMap &particle_set_map)
QTBase::ValueType ValueType
Definition: Configuration.h:60
std::unique_ptr< TrialWaveFunction > buildTWF(xmlNodePtr cur, const RuntimeOptions &runtime_options)
read from xmlNode
REQUIRE(std::filesystem::exists(filename))
static void mw_evaluateParameterDerivatives(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
ParticleGradient G
gradients of the particles
Definition: ParticleSet.h:83
Factory class to build a many-body wavefunction.
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
static void mw_evaluateDeltaLog(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, std::vector< RealType > &logpsi_list, RefVector< ParticleSet::ParticleGradient > &dummyG_list, RefVector< ParticleSet::ParticleLaplacian > &dummyL_list, bool recompute=false)
evaluate the log value for optimizable parts of a many-body wave function
std::vector< std::unique_ptr< WaveFunctionComponent > > const & getOrbitals()
ParticlePos R
Position.
Definition: ParticleSet.h:79
static void mw_evaluateDeltaLogSetup(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, std::vector< RealType > &logpsi_fixed_list, std::vector< RealType > &logpsi_opt_list, RefVector< ParticleSet::ParticleGradient > &fixedG_list, RefVector< ParticleSet::ParticleLaplacian > &fixedL_list)
evaluate the sum of log value of optimizable many-body wavefunctions
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< std::reference_wrapper< T > > RefVector
std::map< std::string, const std::unique_ptr< ParticleSet > > PSetMap
RealType evaluateDeltaLog(ParticleSet &P, bool recompute=false)
evaluate the log value of a many-body wave function
Class to represent a many-body trial wave function.
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
handles acquire/release resource by the consumer (RefVectorWithLeader type).
LatticeGaussianProduct::ValueType ValueType
Declaration of a WaveFunctionFactory.
Declaration of DiracDeterminant with a S(ingle)P(article)O(rbital)Set.
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
void addComponent(std::unique_ptr< WaveFunctionComponent > &&aterm)
add a WaveFunctionComponent
Declaration of ParticleSetPool.
void checkInVariables(opt_variables_type &o)
Check in an optimizable parameter.