65 auto& elec(*elec_ptr);
71 elec.R[0] = {0.1, 0.2, 0.3};
72 elec.R[1] = {1.0, 1.0, 1.0};
78 especies(chargeIdx, upIdx) = -1;
79 especies(massIdx, upIdx) = 1.0;
81 especies(chargeIdx, dnIdx) = -1;
82 especies(massIdx, dnIdx) = 1.0;
90 ions.R[0] = {0.0, 0.0, 0.0};
94 int CatomicnumberIdx = tspecies.
addAttribute(
"atomicnumber");
95 tspecies(CchargeIdx, CIdx) = 2;
96 tspecies(CatomicnumberIdx, CIdx) = 4;
104 const char* wf_input_multi_det = R
"( 105 <wavefunction name="psi0" target="e"> 106 <sposet_builder type="bspline" href="hcpBe.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" version="0.10" meshfactor="1.0" precision="double" truncate="no" save_coefs="no"> 107 <sposet type="bspline" name="spo_up" size="2" spindataset="0" optimize="yes"> 109 <sposet type="bspline" name="spo_down" size="2" spindataset="0" optimize="yes"> 113 <multideterminant optimize="no" spo_0="spo_up" spo_1="spo_down" algorithm="precomputed_table_method"> 114 <detlist size="1" type="DETS" nc0="0" ne0="1" nc1="0" ne1="1" nstates="2" cutoff="1e-20"> 115 <ci coeff="1.0" occ0="10" occ1="10"/> 121 const char* wf_input_single_det = R
"( 122 <wavefunction name="psi0" target="e"> 123 <sposet_builder type="bspline" href="hcpBe.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" version="0.10" meshfactor="1.0" precision="double" truncate="no" save_coefs="no"> 124 <sposet type="bspline" name="spo_up" size="2" spindataset="0" optimize="yes"> 126 <sposet type="bspline" name="spo_down" size="2" spindataset="0" optimize="yes"> 131 <determinant id="spo_up" size="1"> 132 <occupation mode="ground" spindataset="0"/> 134 <determinant id="spo_down" size="1"> 135 <occupation mode="ground" spindataset="0"/> 141 const char* wf_input = wf_input_multi_det;
143 wf_input = wf_input_single_det;
158 const char* ham_input_nlpp_nonbatched = R
"( 159 <hamiltonian name="h0" type="generic" target="e"> 160 <pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml" algorithm="non-batched" pbc="no"> 161 <pseudo elementType="Be" href="Be.BFD.xml" nrule="2" disable_randomize_grid="yes"/> 165 const char* ham_input_nlpp_batched = R
"( 166 <hamiltonian name="h0" type="generic" target="e"> 167 <pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml" algorithm="batched" pbc="no"> 168 <pseudo elementType="Be" href="Be.BFD.xml" nrule="2" disable_randomize_grid="yes"/> 172 const char* ham_input = ham_input_nlpp_nonbatched;
173 if (use_nlpp_batched)
174 ham_input = ham_input_nlpp_batched;
182 xmlNodePtr root2 = doc2.getRoot();
194 CHECK(logval == Approx(-1.2865633501081344));
196 CHECK(elec.G[0][0] == ValueApprox(0.54752651));
197 CHECK(elec.L[0] == ValueApprox(11.066512459947848));
198 #if defined(MIXED_PRECISION) 199 CHECK(elec.L[1] == ValueApprox(-0.4830868071).epsilon(1
e-3));
201 CHECK(elec.L[1] == ValueApprox(-0.4831061477045371));
211 CHECK(dlogpsi[0] == ValueApprox(-2.97750823));
212 CHECK(dlogpsi[1] == ValueApprox(-1.06146356));
213 CHECK(dhpsioverpsi[0] == ValueApprox(-36.71707483));
214 CHECK(dhpsioverpsi[1] == ValueApprox(-0.35274333));
228 CHECK(dlogpsi_list[0][0] == Approx(dlogpsi[0]));
229 CHECK(dlogpsi_list[0][1] == Approx(dlogpsi[1]));
230 CHECK(dhpsi_over_psi_list[0][0] == Approx(dhpsioverpsi[0]));
231 CHECK(dhpsi_over_psi_list[0][1] == Approx(dhpsioverpsi[1]));
241 CHECK(ke == Approx(-6.818620576308302));
242 CHECK(loc_e == Approx(-3.562354739253797));
245 double local_pp = localECP_H->
evaluate(elec);
252 CHECK(dlogpsi2[0] == Approx(dlogpsi[0]));
253 CHECK(dlogpsi2[1] == Approx(dlogpsi[1]));
256 CHECK(dhpsioverpsi2[0] == ValueApprox(-5.45054261));
257 CHECK(dhpsioverpsi2[1] == ValueApprox(-0.34818307));
267 CHECK(dlogpsi_list2[0][0] == Approx(dlogpsi2[0]));
268 CHECK(dlogpsi_list2[0][1] == Approx(dlogpsi2[1]));
270 CHECK(dhpsi_over_psi_list2[0][0] == Approx(dhpsioverpsi2[0]));
271 CHECK(dhpsi_over_psi_list2[0][1] == Approx(dhpsioverpsi2[1]));
274 TEST_CASE(
"RotatedSPOs SplineR2R hcpBe values",
"[wavefunction]")
276 SECTION(
"nlpp non-batched")
278 bool use_single_det = GENERATE(
true,
false);
279 bool use_nlpp_batched =
false;
283 SECTION(
"nlpp batched")
285 bool use_single_det =
true;
286 bool use_nlpp_batched =
true;
a class that defines a supercell in D-dimensional Euclean space.
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
void setSimulationCell(const SimulationCell &simulation_cell)
set simulation cell
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
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
OperatorBase * getHamiltonian(const std::string &aname)
return OperatorBase with the name aname
FullPrecRealType evaluateValueAndDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate energy and derivatives wrt to the variables
TEST_CASE("complex_helper", "[type_traits]")
void resetParameters(const opt_variables_type &active)
Set values of parameters in each component from the global list.
void addParticleSet(std::unique_ptr< ParticleSet > &&p)
add a ParticleSet* to the pool with its ownership transferred ParticleSet built outside the ParticleS...
void test_hcpBe_rotation(bool use_single_det, bool use_nlpp_batched)
Builder class for einspline-based SPOSet objects.
Collection of Local Energy Operators.
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
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 ...
const RuntimeOptions & getRuntimeOptions() const noexcept
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluateValueAndDerivatives(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
Wrapping information on parallelism.
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
Specialized paritlce class for atomistic simulations.
QTBase::ValueType ValueType
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)
Declaration of WaveFunctionPool.
Factory class to build a many-body wavefunction.
Manage a collection of ParticleSet objects.
class to handle a set of variables that can be modified during optimizations
std::vector< std::unique_ptr< WaveFunctionComponent > > const & getOrbitals()
Declaration of a HamiltonianFactory.
FullPrecRealType getLocalEnergy()
void checkOutVariables(const opt_variables_type &o)
Check out optimizable variables Assign index mappings from global list (o) to local values in each co...
Class to represent a many-body trial wave function.
bool parseFromString(const std::string_view data)
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
virtual Return_t evaluate(ParticleSet &P)=0
Evaluate the local energy contribution of this component.
LatticeGaussianProduct::ValueType ValueType
Declaration of WaveFunctionComponent.
Custom container for set of attributes for a set of species.
const PoolType & getPool() const
get the Pool object
void setRandomGenerator(RandomBase< FullPrecRealType > *rng)
FullPrecRealType getKineticEnergy()
const auto & getSimulationCell() const
get simulation cell
Manage a collection of TrialWaveFunction objects.
Declaration of ParticleSetPool.
void checkInVariables(opt_variables_type &o)
Check in an optimizable parameter.