QMCPACK
test_LCAOrbitalBuilder.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2023 QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include "Configuration.h"
16 #include "Message/Communicate.h"
17 
18 #include "LCAO/LCAOrbitalBuilder.h"
22 #include "LCAO/SoaAtomicBasisSet.h"
24 #include "LCAO/AOBasisBuilder.h"
26 
27 
28 namespace qmcplusplus
29 {
30 
31 
32 TEST_CASE("LCAOrbitalBuilder", "[wavefunction][LCAO]")
33 {
35 
36  using Real = QMCTraits::RealType;
38 
39 
40  const SimulationCell sim_cell;
41  ParticleSet elec(sim_cell);
42  elec.setName("e");
43  ParticleSet ions(sim_cell);
44  ions.setName("ion0");
45  ions.create({1});
46  SpeciesSet& source_species(ions.getSpeciesSet());
47  source_species.addSpecies("C");
48  ions.update();
49 
50 
51  // Radial basis: Numerical (Transform to grid) Angular part: Cartesian
52  auto wf_xml_num_cart = R"(
53  <tmp>
54  <basisset keyword="STO" transform="yes">
55  <atomicBasisSet angular="cartesian" elementType="C" normalized="no" type="STO">
56  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
57  <radfunc contraction="1.0" exponent="11.4" n="1"/>
58  </basisGroup>
59  </atomicBasisSet>
60  </basisset>
61  </tmp>
62  )";
63 
65  bool okay = doc.parseFromString(wf_xml_num_cart);
66  REQUIRE(okay);
67 
69  LCAOrbitalBuilder lcaob_num_cart(elec, ions, c, doc.getRoot());
70  const auto& bs = lcaob_num_cart.getBasissetMap().at("LCAOBSet");
71  CHECK(dynamic_cast<
73  bs.get()) != nullptr);
74 
75 
76  // Radial basis: Numerical (Transform to grid) Angular part: Spherical
77  auto wf_xml_num_sph = R"(
78  <tmp>
79  <basisset keyword="STO" transform="yes">
80  <atomicBasisSet angular="spherical" elementType="C" normalized="no" type="STO">
81  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
82  <radfunc contraction="1.0" exponent="11.4" n="1"/>
83  </basisGroup>
84  </atomicBasisSet>
85  </basisset>
86  </tmp>
87  )";
88 
89  okay = doc.parseFromString(wf_xml_num_sph);
90  REQUIRE(okay);
91 
92  LCAOrbitalBuilder lcaob_num_sph(elec, ions, c, doc.getRoot());
93  const auto& bs2 = lcaob_num_sph.getBasissetMap().at("LCAOBSet");
94  CHECK(dynamic_cast<
96  bs2.get()) != nullptr);
97 
98 
99  // Radial basis: GTO Angular part: Cartesian
100  auto wf_xml_gto_cart = R"(
101  <tmp>
102  <basisset keyword="GTO" name="LCAOBSet">
103  <atomicBasisSet angular="cartesian" elementType="C" name="Gaussian-G2" normalized="no" type="Gaussian">
104  <grid npts="1001" rf="1.e2" ri="1.e-6" type="log" />
105  <basisGroup l="0" n="0" rid="H00" type="Gaussian">
106  <radfunc contraction="0.002006000801" exponent="82.64" />
107  <radfunc contraction="0.01534300612" exponent="12.41" />
108  </basisGroup>
109  </atomicBasisSet>
110  </basisset>
111  </tmp>
112  )";
113 
114  okay = doc.parseFromString(wf_xml_gto_cart);
115  REQUIRE(okay);
116 
117  LCAOrbitalBuilder lcaob_gto_cart(elec, ions, c, doc.getRoot());
118  const auto& bs3 = lcaob_gto_cart.getBasissetMap().at("LCAOBSet");
119  CHECK(dynamic_cast<SoaLocalizedBasisSet<
121  bs3.get()) != nullptr);
122 
123 
124  // Radial basis: GTO Angular part: Spherical
125  auto wf_xml_gto_sph = R"(
126  <tmp>
127  <basisset keyword="GTO" name="LCAOBSet">
128  <atomicBasisSet angular="spherical" elementType="C" name="Gaussian-G2" normalized="no" type="Gaussian">
129  <grid npts="1001" rf="1.e2" ri="1.e-6" type="log" />
130  <basisGroup l="0" n="0" rid="H00" type="Gaussian">
131  <radfunc contraction="0.002006000801" exponent="82.64" />
132  <radfunc contraction="0.01534300612" exponent="12.41" />
133  </basisGroup>
134  </atomicBasisSet>
135  </basisset>
136  </tmp>
137  )";
138 
139  okay = doc.parseFromString(wf_xml_gto_sph);
140  REQUIRE(okay);
141 
142  LCAOrbitalBuilder lcaob_gto_sph(elec, ions, c, doc.getRoot());
143  const auto& bs4 = lcaob_gto_sph.getBasissetMap().at("LCAOBSet");
144  CHECK(dynamic_cast<SoaLocalizedBasisSet<
146  bs4.get()) != nullptr);
147 
148 
149  // Radial basis: STO Angular part: Cartesian
150  auto wf_xml_sto_cart = R"(
151  <tmp>
152  <basisset keyword="STO" transform="no">
153  <atomicBasisSet angular="cartesian" elementType="C" normalized="no" type="STO">
154  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
155  <radfunc contraction="1.0" exponent="11.4" n="1"/>
156  </basisGroup>
157  </atomicBasisSet>
158  </basisset>
159  </tmp>
160  )";
161 
162  okay = doc.parseFromString(wf_xml_sto_cart);
163  REQUIRE(okay);
164 
165  LCAOrbitalBuilder lcaob_sto_cart(elec, ions, c, doc.getRoot());
166  const auto& bs5 = lcaob_sto_cart.getBasissetMap().at("LCAOBSet");
167  CHECK(dynamic_cast<SoaLocalizedBasisSet<
169  bs5.get()) != nullptr);
170 
171 
172  // Radial basis: STO Angular part: Spherical
173  auto wf_xml_sto_sph = R"(
174  <tmp>
175  <basisset keyword="STO" transform="no">
176  <atomicBasisSet angular="spherical" elementType="C" normalized="no" type="STO">
177  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
178  <radfunc contraction="1.0" exponent="11.4" n="1"/>
179  </basisGroup>
180  </atomicBasisSet>
181  </basisset>
182  </tmp>
183  )";
184 
185  okay = doc.parseFromString(wf_xml_sto_sph);
186  REQUIRE(okay);
187 
188  LCAOrbitalBuilder lcaob_sto_sph(elec, ions, c, doc.getRoot());
189  const auto& bs6 = lcaob_sto_sph.getBasissetMap().at("LCAOBSet");
190  CHECK(dynamic_cast<SoaLocalizedBasisSet<
192  bs6.get()) != nullptr);
193 }
194 
195 } // namespace qmcplusplus
void setName(const std::string &aname)
Definition: ParticleSet.h:237
class that handles xmlDoc
Definition: Libxml2Doc.h:76
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
Definition: SpeciesSet.cpp:33
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
A localized basis set derived from SoaBasisSetBase<ORBT>
const BasissetMap & getBasissetMap() const
QTBase::RealType RealType
Definition: Configuration.h:58
TEST_CASE("complex_helper", "[type_traits]")
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
SPOSetBuilder using new LCAOrbitalSet and Soa versions.
void update(bool skipSK=false)
update the internal data
SoaSphericalTensor that evaluates the Real Spherical Harmonics.
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
ForceBase::Real Real
Definition: ForceBase.cpp:26
Wrapping information on parallelism.
Definition: Communicate.h:68
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
QTBase::ValueType ValueType
Definition: Configuration.h:60
REQUIRE(std::filesystem::exists(filename))
LCAOrbitalSet::basis_type BasisSet_t
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
void create(const std::vector< int > &agroup)
create grouped particles
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
Custom container for set of attributes for a set of species.
Definition: SpeciesSet.h:33
A derived class from BasisSetBase.
CartesianTensor according to Gamess order.
Assume that coeffs.D1 and the LogLightGrid r_values.size() are equal Therefore r must be < r_max...
Base for real basis set.
Definition: BasisSetBase.h:132