34 xmlNodePtr root,
node;
43 lattice.R.diagonal(70.89815403622065);
49 const char* particle_text = R
"(<tmp> 50 <particleset name="e" random="no"> 51 <group name="u" size="2"> 52 <parameter name="charge"> -1 </parameter> 53 <attrib name="position" datatype="posArray" condition="0"> 54 54.66209032978565 2.018663420381362 0.0 55 23.566489035927912 3.443259712257945 0.0 58 <group name="d" size="2"> 59 <parameter name="charge"> -1 </parameter> 60 <attrib name="position" datatype="posArray" condition="0"> 61 67.26206197993817 30.29582561496142 0.0 62 37.00657847142635 1.4508035033146867 0.0 70 node = xmlFirstElementChild(root); 78 const char* jastrow_text = R
"(<tmp> 79 <jastrow name="J2" type="Two-Body" function="Bspline"> 80 <correlation speciesA="u" speciesB="u" size="8"> 81 <coefficients id="uu" type="Array" optimize="yes">4.868951397 3.154235815 1.719776072 0.9676536301 0.6044866223 0.3368526364 0.1566214572 0.06031539785</coefficients> 83 <correlation speciesA="u" speciesB="d" size="8"> 84 <coefficients id="ud" type="Array" optimize="yes">6.991319036 3.93760887 2.077967513 1.115208829 0.6946729632 0.3826149045 0.1705411558 0.06155742938</coefficients> 91 node = xmlFirstElementChild(root); 95 J2Type* j2 =
dynamic_cast<J2Type*
>(j2_uptr.get());
99 double logpsi =
real(j2->evaluateLog(elec, elec.
G, elec.
L));
101 CHECK(
real(elec.
G[0][0]) == Approx(0.08490220791));
102 CHECK(
real(elec.
G[0][1]) == Approx(-0.006958062051));
103 CHECK(
real(elec.
G[1][0]) == Approx(-0.1325957095));
104 CHECK(
real(elec.
G[1][1]) == Approx(0.01872445072));
105 CHECK(
real(elec.
G[2][0]) == Approx(0.004059085343));
106 CHECK(
real(elec.
G[2][1]) == Approx(0.009109497845));
107 CHECK(
real(elec.
G[3][0]) == Approx(0.04363441629));
108 CHECK(
real(elec.
G[3][1]) == Approx(-0.02087588652));
109 for (
int i = 0; i < nelec; i++)
115 const std::vector<RealType> lap_values = {-0.00916449, -0.0166369, -0.00351783, -0.0153977};
116 for (
int m = 0;
m < nelec;
m++)
120 grad_grad_psi.resize(nelec);
123 CHECK_THROWS(j2->evaluateHessian(elec, grad_grad_psi));
149 std::vector<ValueType> ratios(nelec);
150 j2->evaluateRatiosAlltoOne(elec, ratios);
151 std::vector<double> ratio_values = {1.46023, 1.46559, 0.444258, 1.90226};
152 for (
int i = 0; i < ratios.size(); i++)
153 CHECK(
real(ratios[i]) == Approx(ratio_values[i]));
155 for (
int i = 0; i < nelec; i++)
159 CHECK(
real(rat1) == Approx(ratio_values[i]));
165 j2->extractOptimizableObjectRefs(opt_obj_refs);
166 REQUIRE(opt_obj_refs.size() == 2);
173 obj.checkInVariablesExclusive(optvars);
174 optvars.resetIndex();
175 const int NumOptimizables(optvars.size());
176 j2->checkOutVariables(optvars);
177 dlogpsi.
resize(NumOptimizables);
178 dhpsioverpsi.
resize(NumOptimizables);
179 j2->evaluateDerivatives(elec, optvars, dlogpsi, dhpsioverpsi);
180 app_log() << std::endl <<
"reporting dlogpsi and dhpsioverpsi" << std::scientific << std::endl;
181 for (
int iparam = 0; iparam < NumOptimizables; iparam++)
182 app_log() <<
"param=" << iparam <<
" : " << dlogpsi[iparam] <<
" " << dhpsioverpsi[iparam] << std::endl;
184 const std::vector<RealType> dlogpsi_values = {0, 0, 0, 0, 0, 0, -1.521258e-04, -2.194165e-01, 0, 0, -2.779981e-02, -5.327999e-01, -9.356640e-01, -4.847466e-01, -1.945081e-02, -2.453297e-01};
185 const std::vector<RealType> dhpsi_values = {0, 0, 0, 0, 0, 0, 5.953288e-03, 8.618836e-03, 0, 0, 2.572195e-02, -5.048126e-02, -3.139861e-02, 2.197638e-02, 4.319522e-02, 3.512834e-02};
186 for (
int iparam = 0; iparam < NumOptimizables; iparam++)
188 CHECK(
real(dlogpsi[iparam]) == Approx(dlogpsi_values[iparam]));
189 CHECK(
real(dhpsioverpsi[iparam]) == Approx(dhpsi_values[iparam]));
void resize(size_type n, Type_t val=Type_t())
Resize the container.
a class that defines a supercell in D-dimensional Euclean space.
class that handles xmlDoc
WaveFunctionComponent::PsiValue PsiValue
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
if(!okay) throw std xmlNodePtr node
size_t getTotalNum() const
TEST_CASE("complex_helper", "[type_traits]")
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
JastrowBuilder using an analytic 1d functor Should be able to eventually handle all one and two body ...
float real(const float &c)
real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.
void update(bool skipSK=false)
update the internal data
Communicate * Controller
Global Communicator for a process.
ParticleLaplacian L
laplacians of the particles
QMCTraits::PosType PosType
Wrapping information on parallelism.
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
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...
QTBase::ValueType ValueType
REQUIRE(std::filesystem::exists(filename))
void rejectMove(Index_t iat)
reject a proposed move in regular mode
ParticleGradient G
gradients of the particles
class to handle a set of variables that can be modified during optimizations
bool readXML(xmlNodePtr cur)
process xmlnode <particleset/> which contains everything about the particle set to initialize ...
QTFull::ValueType PsiValue
Specialization for two-body Jastrow function using multiple functors.
QMCTraits::RealType RealType
void makeMove(Index_t iat, const SingleParticlePos &displ, bool maybe_accept=true)
move the iat-th particle to active_pos_
bool parseFromString(const std::string_view data)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
OrbitalSetTraits< ValueType >::HessVector HessVector
LatticeGaussianProduct::ValueType ValueType
void makeVirtualMoves(const SingleParticlePos &newpos)
Handles virtual moves for all the particles to a single newpos.