22 TEST_CASE(
"J1 evaluate derivatives Jastrow",
"[wavefunction]")
32 ions_.setName(
"ion0");
35 ions_.R[0] = {0.0, 0.0, 0.0};
38 int ichargeIdx =
ispecies.addAttribute(
"charge");
44 elec_.
R[0] = {0.5, 0.5, 0.5};
45 elec_.
R[1] = {-0.5, -0.5, -0.5};
52 tspecies(massIdx, upIdx) = 1.0;
53 tspecies(massIdx, downIdx) = 1.0;
54 tspecies(chargeIdx, upIdx) = -1.0;
55 tspecies(massIdx, downIdx) = -1.0;
67 const char* jasxml = R
"(<wavefunction name="psi0" target="e"> 68 <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0"> 69 <correlation elementType="H" cusp="0.0" size="2" rcut="5.0"> 70 <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients> 85 auto twf_ptr = wf_factory.
buildTWF(jas1, runtime_options);
87 twf.setMassTerm(elec_);
88 twf.evaluateLog(elec_);
89 twf.prepareGroup(elec_, 0);
91 auto& twf_component_list =
twf.getOrbitals();
94 twf.checkInVariables(active);
103 twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
106 std::vector<ValueType> expected_dlogpsi = {-0.9336294487, -1.0196051794};
107 std::vector<ValueType> expected_dhpsioverpsi = {-1.1596433096, 0.7595492539};
108 for (
int i = 0; i < nparam; i++)
110 CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
111 CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
115 TEST_CASE(
"J1 evaluate derivatives Jastrow with two species",
"[wavefunction]")
124 ions_.setName(
"ion0");
126 ions_.create({1, 1});
127 ions_.R[0] = {0.0, 0.0, 1.0};
128 ions_.R[1] = {0.0, 0.0, 0.0};
130 int OIdx =
ispecies.addSpecies(
"O");
131 int HIdx =
ispecies.addSpecies(
"H");
132 int imassIdx =
ispecies.addAttribute(
"mass");
133 int ichargeIdx =
ispecies.addAttribute(
"charge");
142 elec_.
R[0] = {0.5, 0.5, 0.5};
143 elec_.
R[1] = {-0.5, -0.5, -0.5};
150 tspecies(massIdx, upIdx) = 1.0;
151 tspecies(massIdx, downIdx) = 1.0;
152 tspecies(chargeIdx, upIdx) = -1.0;
153 tspecies(massIdx, downIdx) = -1.0;
165 const char* jasxml = R
"(<wavefunction name="psi0" target="e"> 166 <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0"> 167 <correlation elementType="H" cusp="0.0" size="2" rcut="5.0"> 168 <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients> 170 <correlation elementType="O" cusp="0.0" size="2" rcut="5.0"> 171 <coefficients id="J1O" type="Array"> 0.2 0.1 </coefficients> 186 auto twf_ptr = wf_factory.
buildTWF(jas1, runtime_options);
188 twf.setMassTerm(elec_);
189 twf.evaluateLog(elec_);
190 twf.prepareGroup(elec_, 0);
192 auto& twf_component_list =
twf.getOrbitals();
195 twf.checkInVariables(active);
204 twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
207 std::vector<ValueType> expected_dlogpsi = {-0.6360001724, -1.1764442146, -0.9336294487, -1.0196051794};
208 std::vector<ValueType> expected_dhpsioverpsi = {-0.6225838942, 0.0099980417, -1.1853702074, 0.7798000176};
209 for (
int i = 0; i < nparam; i++)
211 CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
212 CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
216 TEST_CASE(
"J1 evaluate derivatives Jastrow with two species one without Jastrow",
"[wavefunction]")
225 ions_.setName(
"ion0");
227 ions_.create({1, 1});
228 ions_.R[0] = {0.0, 0.0, 1.0};
229 ions_.R[1] = {0.0, 0.0, 0.0};
231 int OIdx =
ispecies.addSpecies(
"O");
232 int HIdx =
ispecies.addSpecies(
"H");
233 int imassIdx =
ispecies.addAttribute(
"mass");
234 int ichargeIdx =
ispecies.addAttribute(
"charge");
243 elec_.
R[0] = {0.5, 0.5, 0.5};
244 elec_.
R[1] = {-0.5, -0.5, -0.5};
251 tspecies(massIdx, upIdx) = 1.0;
252 tspecies(massIdx, downIdx) = 1.0;
253 tspecies(chargeIdx, upIdx) = -1.0;
254 tspecies(massIdx, downIdx) = -1.0;
266 const char* jasxml = R
"(<wavefunction name="psi0" target="e"> 267 <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0"> 268 <correlation elementType="H" cusp="0.0" size="2" rcut="5.0"> 269 <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients> 284 auto twf_ptr = wf_factory.
buildTWF(jas1, runtime_options);
286 twf.setMassTerm(elec_);
287 twf.evaluateLog(elec_);
288 twf.prepareGroup(elec_, 0);
290 auto& twf_component_list =
twf.getOrbitals();
293 twf.checkInVariables(active);
302 twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
305 std::vector<ValueType> expected_dlogpsi = {-0.9336294487, -1.0196051794};
306 std::vector<ValueType> expected_dhpsioverpsi = {-1.1596433096, 0.7595492539};
307 for (
int i = 0; i < nparam; i++)
309 CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
310 CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
void setName(const std::string &aname)
class that handles xmlDoc
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
helper functions for EinsplineSetBuilder
TEST_CASE("complex_helper", "[type_traits]")
void addParticleSet(std::unique_ptr< ParticleSet > &&p)
add a ParticleSet* to the pool with its ownership transferred ParticleSet built outside the ParticleS...
void update(bool skipSK=false)
update the internal data
Communicate * Controller
Global Communicator for a process.
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
Wrapping information on parallelism.
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
QTBase::ValueType ValueType
std::unique_ptr< TrialWaveFunction > buildTWF(xmlNodePtr cur, const RuntimeOptions &runtime_options)
read from xmlNode
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
Factory class to build a many-body wavefunction.
class to handle a set of variables that can be modified during optimizations
int size_of_active() const
return the number of active variables
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void create(const std::vector< int > &agroup)
create grouped particles
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
Declaration of a WaveFunctionFactory.
Custom container for set of attributes for a set of species.
const PoolType & getPool() const
get the Pool object
void removeInactive()
remove inactive variables and trim the internal data
bool get(std::ostream &os) const override
dummy. For satisfying OhmmsElementBase.
const auto & getSimulationCell() const
get simulation cell
Declaration of ParticleSetPool.