34 TEST_CASE(
"Hybridrep SPO from HDF diamond_1x1x1",
"[wavefunction]")
40 lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
52 ions_.R[0] = {0.0, 0.0, 0.0};
53 ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
54 SpeciesSet& ion_species = ions_.getSpeciesSet();
57 int cutoffIdx = ion_species.
addAttribute(
"cutoff_radius");
60 ion_species(C_chargeIdx, C_Idx) = 4;
61 ion_species(cutoffIdx, C_Idx) = 0.9;
62 ion_species(lmaxIdx, C_Idx) = 3;
67 elec_.
R[0] = {0.4, 0.0, 0.0};
68 elec_.
R[1] = {0.0, 1.0, 0.0};
69 elec_.
R[2] = {0.0, 0.5, 0.5};
73 tspecies(chargeIdx, upIdx) = -1;
76 const char* particles = R
"(<tmp> 77 <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="4" hybridrep="yes"/> 87 xmlNodePtr ein1 = xmlFirstElementChild(root);
105 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
155 if (spo->isRotationSupported())
160 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
167 for (
int iorb = 0; iorb < 4; iorb++)
169 rot_mat[0][iorb] = row0[iorb];
170 rot_mat[1][iorb] = row1[iorb];
171 rot_mat[2][iorb] = row2[iorb];
172 rot_mat[3][iorb] = row3[iorb];
175 for (
int i = 0; i < elec_.
R.
size(); i++)
176 for (
int j = 0; j < spo->size(); j++)
178 psiM_rot_manual[i][j] = 0.0;
179 for (
int k = 0; k < spo->size(); k++)
180 psiM_rot_manual[i][j] += psiM[i][k] * rot_mat[k][j];
183 spo->storeParamsBeforeRotation();
184 spo->applyRotation(rot_mat,
false);
185 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
186 auto check =
checkMatrix(psiM_rot_manual, psiM,
true);
187 CHECKED_ELSE(check.result) { FAIL(check.result_message); }
191 TEST_CASE(
"Hybridrep SPO from HDF diamond_2x1x1",
"[wavefunction]")
197 lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
206 ions_.setName(
"ion");
209 ions_.R[0] = {0.0, 0.0, 0.0};
210 ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
211 ions_.R[2] = {3.37316115, 3.37316115, 0.0};
212 ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
213 SpeciesSet& ion_species = ions_.getSpeciesSet();
216 int cutoffIdx = ion_species.
addAttribute(
"cutoff_radius");
219 ion_species(C_chargeIdx, C_Idx) = 4;
220 ion_species(cutoffIdx, C_Idx) = 0.9;
221 ion_species(lmaxIdx, C_Idx) = 3;
226 elec_.
R[0] = {0.4, 0.0, 0.0};
227 elec_.
R[1] = {0.0, 1.0, 0.0};
228 elec_.
R[2] = {0.0, 0.5, 0.5};
232 tspecies(chargeIdx, upIdx) = -1;
235 const char* particles = R
"(<tmp> 236 <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="4" hybridrep="yes"/> 246 xmlNodePtr ein1 = xmlFirstElementChild(root);
257 elec_.
getDistTable(0).get_first_neighbor(0, r, dr,
false);
258 app_log() << std::setprecision(14) <<
"check r^2 against dr^2. " 259 <<
"r = " << r <<
" dr = " << dr << std::endl;
261 <<
" epsilon = " << std::numeric_limits<double>::epsilon() << std::endl;
262 #if defined(MIXED_PRECISION) 263 REQUIRE(
std::abs(r * r -
dot(dr, dr)) < std::numeric_limits<double>::epsilon() * 1e8);
277 spo->evaluate_notranspose(elec_, 0, elec_.
R.
size(), psiM, dpsiM, d2psiM);
279 #if defined(QMC_COMPLEX) 283 CHECK(psiM[0][0] == ComplexApprox(
ValueType{0.6776432991, 0.6776432991}));
284 CHECK(psiM[0][1] == ComplexApprox(
ValueType{1.0759553909, 1.0762499571}));
286 CHECK(dpsiM[0][0][0] == ComplexApprox(
ValueType{0.8782411218, 0.878241539}));
287 CHECK(dpsiM[0][0][1] == ComplexApprox(
ValueType{0.004904394, 0.0049043936}));
288 CHECK(dpsiM[0][0][2] == ComplexApprox(
ValueType{-0.0049044029, -0.0049044029}));
289 CHECK(dpsiM[0][1][0] == ComplexApprox(
ValueType{1.1041458845, 1.1067043543}));
290 CHECK(dpsiM[0][1][1] == ComplexApprox(
ValueType{0.6333346963, 0.6384321451}));
291 CHECK(dpsiM[0][1][2] == ComplexApprox(
ValueType{-0.6333346963, -0.6384321451}));
293 CHECK(d2psiM[0][0] == ComplexApprox(
ValueType{4.0779185295, 4.0779790878}).epsilon(1
e-4));
294 CHECK(d2psiM[0][1] == ComplexApprox(
ValueType{-0.7860302329, -0.7897151113}).epsilon(1
e-4));
298 CHECK(psiM[1][0] == ComplexApprox(
ValueType{0.9008999467, 0.9008999467}));
299 CHECK(psiM[1][1] == ComplexApprox(
ValueType{1.2383049726, 1.2383049726}));
301 CHECK(dpsiM[1][0][0] == ComplexApprox(
ValueType{0.0025820041, 0.0025820041}));
302 CHECK(dpsiM[1][0][1] == ComplexApprox(
ValueType{-0.1880052537, -0.1880052537}));
303 CHECK(dpsiM[1][0][2] == ComplexApprox(
ValueType{-0.0025404284, -0.0025404284}));
304 CHECK(dpsiM[1][1][0] == ComplexApprox(
ValueType{0.1069662273, 0.1069453433}));
305 CHECK(dpsiM[1][1][1] == ComplexApprox(
ValueType{-0.4364597797, -0.43649593}));
306 CHECK(dpsiM[1][1][2] == ComplexApprox(
ValueType{-0.106951952, -0.1069145575}));
308 CHECK(d2psiM[1][0] == ComplexApprox(
ValueType{-1.3757134676, -1.3757134676}));
309 CHECK(d2psiM[1][1] == ComplexApprox(
ValueType{-2.4803137779, -2.4919104576}));
313 CHECK(psiM[2][0] == ComplexApprox(
ValueType{0.8841851282, 0.8841851282}));
314 CHECK(psiM[2][1] == ComplexApprox(
ValueType{1.0331713017, 1.0291547321}));
316 CHECK(dpsiM[2][0][0] == ComplexApprox(
ValueType{0.0688574613, 0.0688574613}));
317 CHECK(dpsiM[2][0][1] == ComplexApprox(
ValueType{0.2735091889, 0.2735091889}));
318 CHECK(dpsiM[2][0][2] == ComplexApprox(
ValueType{0.2666900514, 0.2666900514}));
319 CHECK(dpsiM[2][1][0] == ComplexApprox(
ValueType{0.5398793935, 0.5376840012}));
320 CHECK(dpsiM[2][1][1] == ComplexApprox(
ValueType{0.7525391523, 0.7550587239}));
321 CHECK(dpsiM[2][1][2] == ComplexApprox(
ValueType{-0.1224437827, -0.1228616516}));
323 CHECK(d2psiM[2][0] == ComplexApprox(
ValueType{-1.1799273657, -1.2044699918}).epsilon(1
e-4));
324 CHECK(d2psiM[2][1] == ComplexApprox(
ValueType{-2.0339757673, -1.885562226}).epsilon(1
e-4));
330 elec_2.
R[0] = elec_.
R[1];
331 elec_2.
R[1] = elec_.
R[0];
334 p_list.push_back(elec_);
335 p_list.push_back(elec_2);
337 std::unique_ptr<SPOSet> spo_2(spo->makeClone());
339 spo_list.push_back(*spo);
340 spo_list.push_back(*spo_2);
346 spo->createResource(spo_res);
362 psi_v_list.push_back(psi);
363 psi_v_list.push_back(psi_2);
364 dpsi_v_list.push_back(dpsi);
365 dpsi_v_list.push_back(dpsi_2);
366 d2psi_v_list.push_back(d2psi);
367 d2psi_v_list.push_back(d2psi_2);
369 spo->mw_evaluateVGL(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list);
370 #if defined(QMC_COMPLEX) 373 CHECK(psi_v_list[1].
get()[0] == ComplexApprox(
ValueType{0.9008999467, 0.9008999467}));
374 CHECK(psi_v_list[1].
get()[1] == ComplexApprox(
ValueType{1.2383049726, 1.2383049726}));
376 CHECK(dpsi_v_list[1].
get()[0][0] == ComplexApprox(
ValueType{0.0025820041, 0.0025820041}));
377 CHECK(dpsi_v_list[1].
get()[0][1] == ComplexApprox(
ValueType{-0.1880052537, -0.1880052537}));
378 CHECK(dpsi_v_list[1].
get()[0][2] == ComplexApprox(
ValueType{-0.0025404284, -0.0025404284}));
379 CHECK(dpsi_v_list[1].
get()[1][0] == ComplexApprox(
ValueType{0.1069662273, 0.1069453433}));
380 CHECK(dpsi_v_list[1].
get()[1][1] == ComplexApprox(
ValueType{-0.4364597797, -0.43649593}));
381 CHECK(dpsi_v_list[1].
get()[1][2] == ComplexApprox(
ValueType{-0.106951952, -0.1069145575}));
383 CHECK(d2psi_v_list[1].
get()[0] == ComplexApprox(
ValueType{-1.3757134676, -1.3757134676}));
384 CHECK(d2psi_v_list[1].
get()[1] == ComplexApprox(
ValueType{-2.4803137779, -2.4919104576}));
a class that defines a supercell in D-dimensional Euclean space.
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
QTBase::RealType RealType
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
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...
Builder class for einspline-based SPOSet objects.
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
CHECKED_ELSE(check_matrix_result.result)
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.
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.
size_type size() const
return the current size
QTBase::ValueType ValueType
REQUIRE(std::filesystem::exists(filename))
Manage a collection of ParticleSet objects.
OrbitalSetTraits< ValueType >::ValueVector ValueVector
auto & getDistTable(int table_ID) const
get a distance table by table_ID
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)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
handles acquire/release resource by the consumer (RefVectorWithLeader type).
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
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
std::unique_ptr< SPOSet > createSPOSetFromXML(xmlNodePtr cur) override
initialize the Antisymmetric wave function for electrons
const auto & getSimulationCell() const
get simulation cell
Declaration of ParticleSetPool.