37 TEST_CASE(
"PolynomialFunctor3D functor zero",
"[wavefunction]")
42 double u = functor.
evaluate(r, r, r);
56 ions_.
R[0] = {2.0, 0.0, 0.0};
57 ions_.
R[1] = {-2.0, 0.0, 0.0};
64 elec_.
R[0] = {1.00, 0.0, 0.0};
65 elec_.
R[1] = {0.0, 0.0, 0.0};
66 elec_.
R[2] = {-1.00, 0.0, 0.0};
67 elec_.
R[3] = {0.0, 0.0, 2.0};
70 int downIdx = target_species.addSpecies(
"d");
71 int chargeIdx = target_species.addAttribute(
"charge");
72 target_species(chargeIdx, upIdx) = -1;
73 target_species(chargeIdx, downIdx) = -1;
76 const char* particles = R
"(<tmp> 77 <jastrow name="J3" type="eeI" function="polynomial" source="ion" print="yes"> 78 <correlation ispecies="O" especies="u" isize="3" esize="3" rcut="10"> 79 <coefficients id="uuO" type="Array" optimize="yes"> 8.227710241e-06 2.480817653e-06 -5.354068112e-06 -1.112644787e-05 -2.208006078e-06 5.213121933e-06 -1.537865869e-05 8.899030233e-06 6.257255156e-06 3.214580988e-06 -7.716743107e-06 -5.275682077e-06 -1.778457637e-06 7.926231121e-06 1.767406868e-06 5.451359059e-08 2.801423724e-06 4.577282736e-06 7.634608083e-06 -9.510673173e-07 -2.344131575e-06 -1.878777219e-06 3.937363358e-07 5.065353773e-07 5.086724869e-07 -1.358768154e-07</coefficients> 81 <correlation ispecies="O" especies1="u" especies2="d" isize="3" esize="3" rcut="10"> 82 <coefficients id="udO" type="Array" optimize="yes"> -6.939530224e-06 2.634169299e-05 4.046077477e-05 -8.002682388e-06 -5.396795988e-06 6.697370507e-06 5.433953051e-05 -6.336849668e-06 3.680471431e-05 -2.996059772e-05 1.99365828e-06 -3.222705626e-05 -8.091669063e-06 4.15738535e-06 4.843939112e-06 3.563650208e-07 3.786332474e-05 -1.418336941e-05 2.282691374e-05 1.29239286e-06 -4.93580873e-06 -3.052539228e-06 9.870288001e-08 1.844286407e-06 2.970561871e-07 -4.364303677e-08</coefficients> 93 xmlNodePtr jas_eeI = xmlFirstElementChild(root);
96 std::unique_ptr<WaveFunctionComponent> jas(jastrow.
buildComponent(jas_eeI));
107 CHECK(logpsi_real == Approx(-1.193457749));
109 double KE = -0.5 * (
Dot(elec_.
G, elec_.
G) +
Sum(elec_.
L));
110 CHECK(KE == Approx(-0.058051245));
119 std::vector<ValueType> ratios(elec_.
getTotalNum());
150 REQUIRE(opt_obj_refs.size() == 2);
157 obj.checkInVariablesExclusive(optvars);
158 optvars.resetIndex();
159 const int NumOptimizables(optvars.size());
161 dlogpsi.
resize(NumOptimizables);
162 dhpsioverpsi.
resize(NumOptimizables);
165 app_log() << std::endl <<
"reporting dlogpsi and dhpsioverpsi" << std::scientific << std::endl;
166 for (
int iparam = 0; iparam < NumOptimizables; iparam++)
167 app_log() <<
"param=" << iparam <<
" : " << dlogpsi[iparam] <<
" " << dhpsioverpsi[iparam] << std::endl;
174 dlogpsiWF.
resize(NumOptimizables);
176 for (
int i = 0; i < NumOptimizables; i++)
177 CHECK(dlogpsi[i] == ValueApprox(dlogpsiWF[i]));
180 std::vector<PosType> newpos2(2);
181 std::vector<ValueType> ratios2(2);
182 newpos2[0] = newpos - elec_.
R[1];
183 newpos2[1] =
PosType(0.2, 0.5, 0.3) - elec_.
R[1];
190 std::fill(ratios2.begin(), ratios2.end(), 0);
207 auto j3_clone = j3->
makeClone(elec_clone);
216 std::vector<bool> isAccepted(2,
true);
225 vp.createResource(vp_res);
228 const int ei_table_index = elec_.
addTable(ions_);
231 NLPPJob<RealType> job1(1, 0, ei_table1.getDistances()[0][1], -ei_table1.getDisplacements()[0][1]);
232 const auto& ei_table2 = elec_clone.
getDistTableAB(ei_table_index);
234 NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
236 std::vector<PosType> deltaV1{{0.1, 0.2, 0.3}, {0.1, 0.3, 0.2}, {0.2, 0.1, 0.3}};
237 std::vector<PosType> deltaV2{{0.02, 0.01, 0.03}, {0.02, 0.03, 0.01}, {0.03, 0.01, 0.02}};
241 std::vector<std::vector<ValueType>> nlpp_ratios(2);
242 nlpp_ratios[0].resize(nknot);
243 nlpp_ratios[1].resize(nknot);
254 TEST_CASE(
"PolynomialFunctor3D Jastrow",
"[wavefunction]")
void resize(size_type n, Type_t val=Type_t())
Resize the container.
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
void setName(const std::string &aname)
T Sum(const ParticleAttrib< T > &pa)
class that handles xmlDoc
virtual LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L)=0
evaluate the value of the WaveFunctionComponent from scratch
virtual void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios)
evaluate ratios to evaluate the non-local PP
WaveFunctionComponent::PsiValue PsiValue
int addSpecies(const std::string &aname)
When a name species does not exist, add a new species.
helper functions for EinsplineSetBuilder
virtual void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const
QTBase::RealType RealType
size_t getTotalNum() const
void test_J3_polynomial3D(const DynamicCoordinateKind kind_selected)
TEST_CASE("complex_helper", "[type_traits]")
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
void makeMoves(const ParticleSet &refp, int jel, const std::vector< PosType > &deltaV, bool sphere=false, int iat=-1)
move virtual particles to new postions and update distance tables
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
void update(bool skipSK=false)
update the internal data
Communicate * Controller
Global Communicator for a process.
ParticleLaplacian L
laplacians of the particles
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
std::complex< QTFull::RealType > LogValue
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
Wrapping information on parallelism.
An abstract class for a component of a many-body trial wave function.
virtual void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)=0
Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimi...
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
real_type evaluate(real_type r_12, real_type r_1I, real_type r_2I) const
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
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
virtual void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
QTFull::ValueType PsiValue
virtual void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
Compute the derivatives of the log of the wavefunction with respect to optimizable parameters...
static void mw_makeMoves(const RefVectorWithLeader< VirtualParticleSet > &vp_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< const std::vector< PosType >> &deltaV_list, const RefVector< const NLPPJob< RealType >> &joblist, bool sphere)
virtual PsiValue ratio(ParticleSet &P, int iat)=0
evaluate the ratio of the new to old WaveFunctionComponent value
virtual void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios)
evaluate ratios to evaluate the non-local PP
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void create(const std::vector< int > &agroup)
create grouped particles
virtual void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs)
extract underlying OptimizableObject references
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)
Declaraton of ParticleAttrib<T>
static void mw_update(const RefVectorWithLeader< ParticleSet > &p_list, bool skipSK=false)
batched version of update
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
virtual void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const
evaluate ratios to evaluate the non-local PP multiple walkers
TinyVector< double, 3 > PosType
handles acquire/release resource by the consumer (RefVectorWithLeader type).
LatticeGaussianProduct::ValueType ValueType
meta data for NLPP calculation of a pair of ion and electron This is not just meta data...
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
Custom container for set of attributes for a set of species.
virtual void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios)
evaluate the ratios of one virtual move with respect to all the particles
virtual std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const
make clone
Specialization for three-body Jastrow function using multiple functors.
void makeVirtualMoves(const SingleParticlePos &newpos)
Handles virtual moves for all the particles to a single newpos.