32 TEST_CASE(
"Einspline SPO from HDF diamond_1x1x1",
"[wavefunction]")
41 lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
53 ions_.R[0] = {0.0, 0.0, 0.0};
54 ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
60 elec_.
R[0] = {0.0, 0.0, 0.0};
61 elec_.
R[1] = {0.0, 1.0, 0.0};
66 tspecies(chargeIdx, upIdx) = -1;
70 const char* particles = R
"(<tmp> 71 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="8"/> 80 xmlNodePtr ein1 = xmlFirstElementChild(root);
88 const int psi_size = 3;
92 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
114 spo->evaluateVGH(elec_, 1, psiV, dpsiV, ddpsiV);
117 double eps = 2000 * std::numeric_limits<float>::epsilon();
123 CHECK(
std::real(ddpsiV[1](1, 1)) == Approx(-0.07996207476).epsilon(eps));
131 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, hesspsiV, d3psiV);
158 #if 0 //Enable when finite precision issue on Rhea is found. 185 elec_2.
R[0] = elec_.
R[1];
186 elec_2.
R[1] = elec_.
R[0];
188 p_list.push_back(elec_);
189 p_list.push_back(elec_2);
191 std::unique_ptr<SPOSet> spo_2(spo->makeClone());
193 spo_list.push_back(*spo);
194 spo_list.push_back(*spo_2);
200 spo->createResource(spo_res);
205 const int ne = elec_.
R.
size();
217 psi_v_list.push_back(psi);
218 psi_v_list.push_back(psi_2);
219 dpsi_v_list.push_back(dpsi);
220 dpsi_v_list.push_back(dpsi_2);
221 d2psi_v_list.push_back(d2psi);
222 d2psi_v_list.push_back(d2psi_2);
223 spo->mw_evaluate_notranspose(spo_list, p_list, 0, elec_.
R.
size(), psi_v_list, dpsi_v_list, d2psi_v_list);
225 CHECK(
std::real(psi_v_list[0].
get()[0][0]) == Approx(-0.42546836868));
226 CHECK(
std::real(psi_v_list[0].
get()[1][0]) == Approx(-0.8886948824));
228 CHECK(
std::real(psi_v_list[1].
get()[0][0]) == Approx(-0.8886948824));
229 CHECK(
std::real(psi_v_list[1].
get()[1][0]) == Approx(-0.42546836868));
233 int orbSize= spo->getOrbitalSetSize();
234 int basisSize= spo->getBasisSetSize();
235 printf(
"orb size = %d basis set size = %d\n",orbSize, basisSize);
237 FILE *fspo = fopen(
"spo.dat",
"w");
238 for (
int ix = 0; ix < 30; ix++) {
239 for (
int iy = 0; iy < 30; iy++) {
240 for (
int iz = 0; iz < 30; iz++) {
241 double x = 0.1*ix - 1.5;
242 double y = 0.1*iy - 1.5;
243 double z = 0.1*iz - 1.5;
244 elec_.
R[0] = {x, y, z};
247 spo->evaluate(elec_, 0, orbs);
248 fprintf(fspo,
"%g %g %g",x,y,z);
249 for (
int j = 0; j < orbSize; j++) {
250 fprintf(fspo,
" %g ",orbs[j]);
261 TEST_CASE(
"Einspline SPO from HDF diamond_2x1x1 5 electrons",
"[wavefunction]")
267 lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
276 ions_.setName(
"ion");
279 ions_.R[0] = {0.0, 0.0, 0.0};
280 ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
281 ions_.R[2] = {3.37316115, 3.37316115, 0.0};
282 ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
288 elec_.
R[0] = {0.0, 0.0, 0.0};
289 elec_.
R[1] = {0.0, 1.0, 0.0};
290 elec_.
R[2] = {0.0, 1.1, 0.0};
291 elec_.
R[3] = {0.0, 1.2, 0.0};
292 elec_.
R[4] = {0.0, 1.3, 0.0};
297 tspecies(chargeIdx, upIdx) = -1;
300 const char* particles = R
"(<tmp> 301 <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="5"/> 311 xmlNodePtr ein1 = xmlFirstElementChild(root);
321 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
340 #if defined(QMC_COMPLEX) 360 elec_2.
R[0] = elec_.
R[1];
361 elec_2.
R[1] = elec_.
R[0];
363 p_list.push_back(elec_);
364 p_list.push_back(elec_2);
366 std::unique_ptr<SPOSet> spo_2(spo->makeClone());
368 spo_list.push_back(*spo);
369 spo_list.push_back(*spo_2);
375 spo->createResource(spo_res);
391 psi_v_list.push_back(psi);
392 psi_v_list.push_back(psi_2);
393 dpsi_v_list.push_back(dpsi);
394 dpsi_v_list.push_back(dpsi_2);
395 d2psi_v_list.push_back(d2psi);
396 d2psi_v_list.push_back(d2psi_2);
398 spo->mw_evaluateVGL(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list);
406 CHECK(
std::real(dpsi_v_list[1].
get()[0][0]) == Approx(0.0025820041));
407 CHECK(
std::real(dpsi_v_list[1].
get()[0][1]) == Approx(-0.1880052537));
408 CHECK(
std::real(dpsi_v_list[1].
get()[0][2]) == Approx(-0.0025404284));
409 CHECK(
std::real(dpsi_v_list[1].
get()[1][0]) == Approx(0.1069662273));
410 CHECK(
std::real(dpsi_v_list[1].
get()[1][1]) == Approx(-0.4364597797));
411 CHECK(
std::real(dpsi_v_list[1].
get()[1][2]) == Approx(-0.106951952));
413 CHECK(
std::real(d2psi_v_list[1].
get()[0]) == Approx(-1.3757134676));
414 CHECK(
std::real(d2psi_v_list[1].
get()[1]) == Approx(-2.4803137779));
416 #if defined(QMC_COMPLEX) 422 CHECK(
std::imag(dpsi_v_list[1].
get()[0][0]) == Approx(0.0025820041));
423 CHECK(
std::imag(dpsi_v_list[1].
get()[0][1]) == Approx(-0.1880052537));
424 CHECK(
std::imag(dpsi_v_list[1].
get()[0][2]) == Approx(-0.0025404284));
425 CHECK(
std::imag(dpsi_v_list[1].
get()[1][0]) == Approx(0.1069453433));
426 CHECK(
std::imag(dpsi_v_list[1].
get()[1][1]) == Approx(-0.43649593));
427 CHECK(
std::imag(dpsi_v_list[1].
get()[1][2]) == Approx(-0.1069145575));
429 CHECK(
std::imag(d2psi_v_list[1].
get()[0]) == Approx(-1.3757134676));
430 CHECK(
std::imag(d2psi_v_list[1].
get()[1]) == Approx(-2.4919104576));
434 std::vector<SPOSet::ValueType> ratio_v(nw);
435 std::vector<SPOSet::GradType> grads_v(nw);
438 inv_row = {0.1, 0.2, 0.3, 0.4, 0.5};
441 std::vector<const SPOSet::ValueType*> inv_row_ptr(nw, inv_row.
device_data());
445 spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, inv_row_ptr, phi_vgl_v, ratio_v, grads_v);
446 #if !defined(QMC_COMPLEX) 458 TEST_CASE(
"EinsplineSetBuilder CheckLattice",
"[wavefunction]")
469 auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
470 auto& elec(*elec_ptr);
472 elec.setName(
"elec");
473 std::vector<int> agroup(2);
477 elec.R[0] = {0.0, 0.0, 0.0};
478 elec.R[1] = {0.0, 1.0, 0.0};
481 ptcl_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
483 xmlNodePtr cur = NULL;
a class that defines a supercell in D-dimensional Euclean space.
OrbitalSetTraits< ValueType >::HessVector HessVector
void setName(const std::string &aname)
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
TEST_CASE("complex_helper", "[type_traits]")
pointer device_data()
Return the device_ptr matching X if this is a vector attached or owning dual space memory...
void addParticleSet(std::unique_ptr< ParticleSet > &&p)
add a ParticleSet* to the pool with its ownership transferred ParticleSet built outside the ParticleS...
Builder class for einspline-based SPOSet objects.
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
Derives EinsplineSetBuilder.
void update(bool skipSK=false)
update the internal data
Communicate * Controller
Global Communicator for a process.
void resize(const std::array< SIZET, D > &dims)
Resize the container.
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
Wrapping information on parallelism.
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
Specialized paritlce class for atomistic simulations.
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
size_type size() const
return the current size
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
OrbitalSetTraits< ValueType >::ValueVector ValueVector
std::map< std::string, const std::unique_ptr< ParticleSet > > PSetMap
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void create(const std::vector< int > &agroup)
create grouped particles
std::vector< std::reference_wrapper< T > > RefVector
OrbitalSetTraits< ValueType >::GradVector GradVector
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor< double, OHMMS_DIM > SuperLattice
handles acquire/release resource by the consumer (RefVectorWithLeader type).
Declaration of WaveFunctionComponent.
Custom container for set of attributes for a set of species.
const PoolType & getPool() const
get the Pool object
void updateTo(size_type size=0, std::ptrdiff_t offset=0)
OrbitalSetTraits< ValueType >::GradHessMatrix GGGMatrix
std::unique_ptr< SPOSet > createSPOSetFromXML(xmlNodePtr cur) override
initialize the Antisymmetric wave function for electrons
A D-dimensional Array class based on PETE.
const auto & getSimulationCell() const
get simulation cell
Declaration of ParticleSetPool.
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix