23 TEST_CASE(
"TwoBodyJastrow simple",
"[wavefunction]")
35 TEST_CASE(
"TwoBodyJastrow one species and two variables",
"[wavefunction]")
43 auto j2_uptr = std::make_unique<FakeJasFunctor>(
"test_fake");
45 j2.myVars.insert(
"opt1", 1.0);
46 j2.myVars.insert(
"opt2", 2.0);
48 j2.myVars.resetIndex();
49 jorb.
addFunc(0, 0, std::move(j2_uptr));
65 elec.
R[0] = {1.0, 0.0, 0.0};
66 elec.
R[1] = {1.1, 1.0, 0.1};
67 elec.
R[2] = {0.9, 0.8, 1.0};
68 elec.
R[3] = {0.9, 0.5, 1.1};
82 TEST_CASE(
"TwoBodyJastrow two variables",
"[wavefunction]")
89 auto j2a_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_a");
90 auto& j2a = *j2a_uptr;
91 j2a.myVars.insert(
"opt1", 1.0);
93 j2a.myVars.resetIndex();
94 jorb.
addFunc(0, 0, std::move(j2a_uptr));
96 auto j2b_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_b");
97 auto& j2b = *j2b_uptr;
98 j2b.myVars.insert(
"opt2", 2.0);
100 j2b.myVars.resetIndex();
101 jorb.
addFunc(0, 1, std::move(j2b_uptr));
126 CHECK(o1.first == 0);
127 CHECK(o1.second == 1);
130 CHECK(o2.first == 1);
131 CHECK(o2.second == 2);
134 CHECK(o3.first == 1);
135 CHECK(o3.second == 2);
138 CHECK(o4.first == 0);
139 CHECK(o4.second == 1);
143 REQUIRE(opt_obj_refs.size() == 2);
149 TEST_CASE(
"TwoBodyJastrow variables fail",
"[wavefunction]")
156 auto j2a_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_a");
157 auto& j2a = *j2a_uptr;
158 j2a.myVars.insert(
"opt1", 1.0);
160 j2a.myVars.resetIndex();
161 jorb.
addFunc(0, 0, std::move(j2a_uptr));
163 auto j2b_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_b");
164 auto& j2b = *j2b_uptr;
165 j2b.myVars.insert(
"opt2", 2.0);
167 j2b.myVars.resetIndex();
168 jorb.
addFunc(0, 1, std::move(j2b_uptr));
180 CHECK(o1.first == -1);
184 CHECK(o2.first == 0);
185 CHECK(o2.second == 1);
188 CHECK(o3.first == 0);
189 CHECK(o3.second == 1);
192 CHECK(o4.first == -1);
198 j2b.derivs_.resize(num_vars);
200 j2b.derivs_[0] = {0.5, 1.3, 2.4};
204 CHECK(dlogpsi[0] == ValueApprox(-2.0));
210 CHECK(dlogpsi2[0] == ValueApprox(-2.0));
215 TEST_CASE(
"TwoBodyJastrow other variables",
"[wavefunction]")
222 auto j2a_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_a");
223 auto j2a = *j2a_uptr;
224 j2a.myVars.insert(
"opt1", 1.0);
226 j2a.myVars.resetIndex();
227 jorb.
addFunc(0, 0, std::move(j2a_uptr));
229 auto j2b_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_b");
230 auto& j2b = *j2b_uptr;
231 j2b.myVars.insert(
"opt2", 2.0);
233 j2b.myVars.resetIndex();
234 jorb.
addFunc(0, 1, std::move(j2b_uptr));
238 global_active.
insert(
"other_opt", 1.0);
255 CHECK(o2.first == 0);
256 CHECK(o2.second == 1);
259 CHECK(o3.first == 0);
260 CHECK(o3.second == 1);
270 j2b.derivs_.resize(num_vars);
272 j2b.derivs_[0] = {0.5, 1.3, 2.4};
276 CHECK(dlogpsi[1] == ValueApprox(-2.0));
282 CHECK(dlogpsi2[1] == ValueApprox(-2.0));
288 TEST_CASE(
"TwoBodyJastrow Jastrow three particles of three types",
"[wavefunction]")
296 ions.
R[0] = {0.0, 0.0, 0.0};
299 elec.
R[0] = {-0.28, 0.0225, -2.709};
300 elec.
R[1] = {-1.08389, 1.9679, -0.0128914};
301 elec.
R[2] = {-2.08389, 0.9679, 0.0128914};
314 auto j2a_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_a");
315 auto& j2a = *j2a_uptr;
316 j2a.myVars.insert(
"opt1", 1.0);
318 j2a.myVars.resetIndex();
319 jorb.
addFunc(0, 1, std::move(j2a_uptr));
321 auto j2b_uptr = std::make_unique<FakeJasFunctor>(
"test_fake_b");
322 auto j2b = *j2b_uptr;
323 j2b.myVars.insert(
"opt2", 2.0);
325 j2b.myVars.resetIndex();
326 jorb.
addFunc(0, 2, std::make_unique<FakeJasFunctor>(*j2b_uptr));
330 jorb.
addFunc(1, 2, std::move(j2b_uptr));
333 for (
size_t i = 0; i < F.size(); ++i)
334 CHECK(F[i] !=
nullptr);
void setName(const std::string &aname)
ParticleSet get_two_species_particleset(const SimulationCell &simulation_cell)
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
helper functions for EinsplineSetBuilder
FakeFunctor for testing purpose.
void addFunc(int ia, int ib, std::unique_ptr< FT > j)
add functor for (ia,ib) pair
TEST_CASE("complex_helper", "[type_traits]")
const std::vector< FT * > & getPairFunctions() const
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
void resetIndex()
reset Index
void update(bool skipSK=false)
update the internal data
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi) override
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
QTBase::ValueType ValueType
REQUIRE(std::filesystem::exists(filename))
void insert(const std::string &vname, real_type v, bool enable=true, int type=OTHER_P)
class to handle a set of variables that can be modified during optimizations
int size_of_active() const
return the number of active variables
Specialization for two-body Jastrow function using multiple functors.
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void create(const std::vector< int > &agroup)
create grouped particles
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::pair< int, int > getComponentOffset(int index)
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
LatticeGaussianProduct::ValueType ValueType
void checkOutVariables(const opt_variables_type &active) override
check out optimizable variables
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
Custom container for set of attributes for a set of species.