23 cur = cur->xmlChildrenNode;
26 std::string cname((
const char*)(cur->name));
33 rAttrib.
add(id_in,
"id");
34 rAttrib.
add(p_name,
"name");
71 const auto& ee_displs = ee_table.getDisplacements();
73 double r12 = ee_dists[1][0];
74 auto rhat12 = ee_displs[1][0] / r12;
78 const auto& ei_displs = ei_table.getDisplacements();
81 double r1 = ei_dists[0][0];
82 double r2 = ei_dists[1][0];
84 auto rhat1 = ei_displs[0][0] / r1;
85 auto rhat2 = ei_displs[1][0] / r2;
91 double du =
A / ((
B * r12 + 1) * (
B * r12 + 1));
94 G[0] = -df1 * rhat1 - du * rhat12;
101 G[1] = -df2 * rhat2 + du * rhat12;
103 double del_u = 2 *
A / (r12 * (
B * r12 + 1) * (
B * r12 + 1) * (
B * r12 + 1));
105 L[0] = -2 *
Z / r1 - del_u;
106 L[1] = -2 *
Z / r2 - del_u;
108 double u =
A * r12 / (
B * r12 + 1) -
A /
B;
118 const auto& ee_temp_r = ee_table.getTempDists();
121 double r12_old = ee_dists[1][0];
122 double r12_new = ee_temp_r[iat == 0 ? 1 : 0];
126 const auto& ei_temp_r = ei_table.getTempDists();
128 double r_old = ei_dists[iat][0];
129 double r_new = ei_temp_r[0];
131 double u_old =
A * r12_old / (
B * r12_old + 1);
132 double u_new =
A * r12_new / (
B * r12_new + 1);
134 double log_v_old = -
Z * (r_old)-u_old;
135 double log_v_new = -
Z * (r_new)-u_new;
137 return std::exp(static_cast<PsiValue>(log_v_new - log_v_old));
144 const auto& ei_displs = ei_table.getDisplacements();
146 double r = ei_dists[iat][0];
147 auto rhat = ei_displs[iat][0] / r;
151 const auto& ee_displs = ee_table.getDisplacements();
154 double r12 = ee_dists[1][0];
155 auto rhat12 = (iat == 0 ? -ee_displs[1][0] : ee_displs[1][0]) / r12;
157 double du =
A / ((
B * r12 + 1) * (
B * r12 + 1));
159 return Z * rhat + rhat12 * du;
166 const auto& ee_displs = ee_table.getDisplacements();
167 const auto& ee_temp_r = ee_table.getTempDists();
168 const auto& ee_temp_dr = ee_table.getTempDispls();
170 const int jat = (iat == 0 ? 1 : 0);
172 double r12_old = ee_dists[1][0];
173 double r12_new = ee_temp_r[jat];
175 auto rhat12 = ee_temp_dr[jat] / r12_new;
179 const auto& ei_displs = ei_table.getDisplacements();
180 const auto& ei_temp_r = ei_table.getTempDists();
181 const auto& ei_temp_dr = ei_table.getTempDispls();
183 double r_old = ei_dists[iat][0];
184 double r_new = ei_temp_r[0];
186 auto rhat = ei_temp_dr[0] / r_new;
188 double du =
A / ((
B * r12_new + 1) * (
B * r12_new + 1));
190 grad_iat = -df * rhat + du * rhat12;
192 double u_old =
A * r12_old / (
B * r12_old + 1);
193 double u_new =
A * r12_new / (
B * r12_new + 1);
195 double log_v_old = -
Z * (r_old)-u_old;
196 double log_v_new = -
Z * (r_new)-u_new;
198 return std::exp(static_cast<PsiValue>(log_v_new - log_v_old));
209 return std::make_unique<ExampleHeComponent>(*this);
239 const auto& ee_displs = ee_table.getDisplacements();
240 const auto& ee_temp_r = ee_table.getTempDists();
241 const auto& ee_temp_dr = ee_table.getTempDispls();
243 double r12 = ee_dists[1][0];
244 auto rhat12 = ee_displs[1][0] / r12;
248 const auto& ei_displs = ei_table.getDisplacements();
249 const auto& ei_temp_r = ei_table.getTempDists();
250 const auto& ei_temp_dr = ei_table.getTempDispls();
252 double r1 = ei_dists[0][0];
253 double r2 = ei_dists[1][0];
255 auto rhat1 = ei_displs[0][0] / r1;
256 auto rhat2 = ei_displs[1][0] / r2;
258 dlogpsi[0] =
A * r12 * r12 / ((tmpB * r12 + 1) * (tmpB * r12 + 1)) -
A / (tmpB * tmpB);
261 double du =
A / ((
B * r12 + 1) * (
B * r12 + 1));
262 RealGradType G1 = -df * rhat1 - rhat12 * du;
263 RealGradType G2 = -df * rhat2 + rhat12 * du;
265 double dudb = -2 *
A * r12 /
std::pow(
B * r12 + 1, 3);
266 RealGradType dG1 = rhat12 * dudb;
267 RealGradType dG2 = -1 * rhat12 * dudb;
269 double dlap = -6 *
A /
std::pow((tmpB * r12 + 1), 4);
271 dlap + (G1[0] * dG1[0] + G1[1] * dG1[1] + G1[2] * dG1[2]) + (G2[0] * dG2[0] + G2[1] * dG2[1] + G2[2] * dG2[2]);
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
const std::vector< DistRow > & getDistances() const
return full table distances
helper functions for EinsplineSetBuilder
const DistanceTableAA & getDistTableAA(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAA
An example wavefunction component for a simple wavefunction for a helium atom.
bool put(xmlNodePtr cur)
assign attributes to the set
const int my_table_ee_idx_
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
void evaluateDerivatives(ParticleSet &P, const OptVariablesType &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimi...
Attaches a unit to a Vector for IO.
ParticleLaplacian L
laplacians of the particles
const int my_table_ei_idx_
std::complex< QTFull::RealType > LogValue
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
Specialized paritlce class for atomistic simulations.
double norm(const zVec &c)
OptVariablesType my_vars_
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
void insert(const std::string &vname, real_type v, bool enable=true, int type=OTHER_P)
class to handle a set of attributes of an xmlNode
void resetParametersExclusive(const OptVariablesType &active) override
reset the parameters during optimizations.
ParticleGradient G
gradients of the particles
class to handle a set of variables that can be modified during optimizations
int where(int i) const
return the locator of the i-th Index
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
QTFull::ValueType PsiValue
void clear()
clear the variable set
size_type size() const
return the size
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tpq) const override
make clone
LogValue log_value_
Current .
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
const std::vector< DistRow > & getDistances() const
return full table distances
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.