45 ions.
R[0] = {0.0, 0.0, 0.0};
48 elec.
R[0] = {0.0, 1.0, 0.0};
49 elec.
R[1] = {0.4, 0.3, 0.0};
55 tspecies(eChargeIdx, upIdx) = -1.0;
56 tspecies(massIdx, upIdx) = 1.0;
66 ion_species(pChargeIdx, pIdx) = 1;
93 std::cout << force.
Sinv << std::endl;
94 std::cout << force2.
Sinv << std::endl;
95 for (
int i = 0; i < force2.
Sinv.
rows(); i++)
97 for (
int j = 0; j < force2.
Sinv.
cols(); j++)
105 for (
int i = 0; i < force2.
h.
size(); i++)
107 CHECK(force2.
h[i] == Approx(force.
h[i]));
111 for (
int i = 0; i < force2.
h.
size(); i++)
113 CHECK(force2.
c[i] == Approx(force.
c[i]));
145 ions.
R[0] = {0.0, 0.0, 0.0};
146 ions.
R[1] = {2.0, 0.0, 0.0};
149 elec.
R[0] = {0.0, 1.0, 0.0};
150 elec.
R[1] = {0.4, 0.3, 0.0};
155 tspecies(eChargeIdx, upIdx) = -1.0;
156 tspecies(massIdx, upIdx) = 1.0;
163 ion_species(pChargeIdx, pIdx) = 1;
179 std::cout <<
" Force = " << force.
getForces() << std::endl;
180 std::cout <<
" Forces_IonIon = " << force.
getForcesIonIon() << std::endl;
195 CHECK(ionForce.getForces()[0][0] == Approx(-0.1478626893));
196 CHECK(ionForce.getForces()[1][0] == Approx(0.1478626893));
199 elecIonForce.evaluate(elec);
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));
211 ions3.setName(
"ion");
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();
219 ion3_species(p3ChargeIdx, p3Idx) = 1;
236 auto noElecForces = noElecForce.
getForces();
238 auto noIonForces = noIonForce.
getForces();
247 std::unique_ptr<OperatorBase> base_force2 = force.
makeClone(elec, psi);
263 ions.
R[0] = {0.0, 0.0, 0.0};
264 ions.
R[1] = {2.0, 0.0, 0.0};
267 elec.
R[0] = {0.0, 1.0, 0.0};
268 elec.
R[1] = {0.2, 0.3, 0.0};
273 tspecies(eChargeIdx, upIdx) = -1.0;
274 tspecies(massIdx, upIdx) = 1.0;
280 ion_species(pChargeIdx, pIdx) = 1;
293 double coeff[4] = {4375, -44296.9, 147656, -161133};
294 for (
int i = 0; i < 4; i++)
296 CHECK(force.
c[i] == Approx(coeff[i]));
304 std::cout <<
" Force ionion = " << force.
getForcesIonIon() << std::endl;
305 std::cout <<
" Force = " << force.
getForces() << std::endl;
317 double coeff2[6] = {3281.25, -33837.9, 135352, -261841, 245476, -89496.4};
318 for (
int i = 0; i < 6; i++)
320 CHECK(force.
c[i] == Approx(coeff2[i]));
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};
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};
344 ionSpecies(HChargeIdx, HIdx) = 1;
351 elecSpecies(eChargeIdx, upIdx) = -1.0;
352 elecSpecies(massIdx, upIdx) = 1.0;
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++)
385 ions.
R[0] = {0.0, 0.0, 0.0};
388 elec.
R[0] = {0.0, 1.0, 0.0};
389 elec.
R[1] = {0.4, 0.3, 0.0};
395 tspecies(eChargeIdx, upIdx) = -1.0;
396 tspecies(massIdx, upIdx) = 1.0;
406 ion_species(pChargeIdx, pIdx) = 1;
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"> 433 const std::string acforceXMLnew = R
"(<tmp> 434 <acforce spacewarp="no" swpow="2." delta="1.e-3" fast_derivatives="yes"> 446 CHECK(regval == Approx(1.421875));
450 CHECK(regval == Approx(1.0));
453 CHECK(regval == Approx(1.0));
462 xmlNodePtr oldroot = olddoc.
getRoot();
463 xmlNodePtr oldh1 = xmlFirstElementChild(oldroot);
464 xmlNodePtr newroot = newdoc.
getRoot();
465 xmlNodePtr newh1 = xmlFirstElementChild(newroot);
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);
473 CHECK(vold == Approx(0));
474 CHECK(vnew == Approx(0));
a class that defines a supercell in D-dimensional Euclean space.
void setName(const std::string &aname)
static RealType compute_regularizer_f(const ParticleGradient &G, const RealType epsilon)
Computes multiplicative regularizer f(G,epsilon) according to Pathak-Wagner arXiv:2002.01434 .
class that handles xmlDoc
Return_t evaluate(ParticleSet &P) final
Evaluate.
Calculates the AA Coulomb potential using PBCs.
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.
helper functions for EinsplineSetBuilder
Calculates the AA Coulomb potential using PBCs.
QTBase::RealType RealType
size_t getTotalNum() const
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.
Collection of Local Energy Operators.
bool get(std::ostream &os) const final
write about the class
void update(bool skipSK=false)
update the internal data
Attaches a unit to a Vector for IO.
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 ...
int getDistanceTableAAID() const
Wrapping information on parallelism.
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)
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
Specialized paritlce class for atomistic simulations.
size_type size() const
return the current size
int NptclB
number of particles of B
REQUIRE(std::filesystem::exists(filename))
bool put(xmlNodePtr cur) final
I/O Routines.
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
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
Class to represent a many-body trial wave function.
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
bool parseFromString(const std::string_view data)
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't sufficient...
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
void createSK()
create Structure Factor with PBCs
void resetTargetParticleSet(ParticleSet &P) final
Initialization/assignment.
Custom container for set of attributes for a set of species.
bool getAddIonIon() const noexcept
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
Vector< FullPrecRealType > c
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
Cloning.
static lr_type this_lr_type
std::vector< RealType > Qspec
Qspec[spec] charge for the spec-th species of B.
const ParticleSet::ParticlePos & getForces() const noexcept