41 app_log() <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
42 app_log() <<
"!!! WARNING: RPAJastrow is not fully tested for production !!!\n";
43 app_log() <<
"!!! level calculations. Use at your own risk! !!!\n";
44 app_log() <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
47 std::string useL =
"yes";
48 std::string useS =
"yes";
52 a.
add(useL,
"longrange");
53 a.
add(useS,
"shortrange");
58 std::string
ID_Rs =
"RPA_rs";
68 const std::string& UL,
69 const std::string& US,
70 const std::string& RF,
74 std::string
ID_Rs =
"RPA_rs";
76 std::string useL = UL;
77 std::string useS = US;
81 app_log() << std::endl <<
" LongRangeForm is " <<
rpafunc << std::endl;
95 std::cout <<
" Error finding rs. Is this an open system?!" << std::endl;
103 Kc = 2.0 *
std::pow(2.25 * M_PI, 1.0 / 3.0) / tlen;
108 app_log() <<
" Kc set too high. Resetting to the maximum value" << std::endl;
110 app_log() <<
" RPAJastrowBuilder::addTwoBodyPart Rs = " <<
Rs <<
" Kc= " <<
Kc << std::endl;
120 throw std::invalid_argument(
"RPAJastrowBuilder::buildOrbital: Unrecognized rpa function type.\n");
127 app_log() <<
" Using LongRange part" << std::endl;
132 app_log() <<
" Using ShortRange part" << std::endl;
140 bool oneBodySpin, twoBodySpin;
145 auto LongRangeRPA_uptr =
147 twoBodySymm,
Kc,
"cG2", twoBodySpin);
150 std::vector<RealType> oneBodyCoefs, twoBodyCoefs;
151 twoBodyCoefs.resize(
myHandler->MaxKshell);
154 for (
size_t is = 0; is <
myHandler->MaxKshell; is++)
156 twoBodyCoefs[is] = prefactorInv *
myHandler->Fk_symm[is];
159 Psi.push_back(std::move(LongRangeRPA_uptr));
168 app_log() <<
" Adding Short Range part of RPA function" << std::endl;
173 auto nfunc_uptr = std::make_unique<FuncType>(
my_name_ +
"_short");
174 nfunc = nfunc_uptr.get();
177 auto j2 = std::make_unique<TwoBodyJastrow<BsplineFunctor<RealType>>>(
"RPA",
targetPtcl,
false);
182 std::vector<RealType> X(npts + 1), Y(npts + 1);
183 for (
size_t i = 0; i < npts; ++i)
186 Y[i] = SRA.evaluate(X[i]);
188 X[npts] = npts * delta;
190 std::string functype =
"rpa";
191 std::string useit =
"no";
193 for (
size_t i = 0; i < npts; ++i)
196 Y[i] = SRA.evaluate(X[i]);
198 j2->addFunc(0, 0, std::move(nfunc_uptr));
200 Psi.push_back(std::move(j2));
214 for (
int i = 0; i <
Psi.size(); i++)
222 for (
int i = 0; i <
Psi.size(); i++)
230 for (
int i = 0; i <
Psi.size(); i++)
238 for (
int i = 0; i <
Psi.size(); i++)
240 r *=
Psi[i]->ratioGrad(P, iat, grad_iat);
248 for (
int i = 0; i <
Psi.size(); i++)
254 for (
int i = 0; i <
Psi.size(); i++)
260 for (
int i = 0; i <
Psi.size(); i++)
267 for (
int i = 0; i <
Psi.size(); i++)
274 for (
int i = 0; i <
Psi.size(); i++)
282 std::unique_ptr<HandlerType> tempHandler;
312 auto myClone = std::make_unique<RPAJastrow>(tpq);
313 myClone->Rcut =
Rcut;
315 myClone->setHandler(std::move(tempHandler));
317 myClone->makeLongRange();
319 myClone->makeShortRange();
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
kSpaceJastrow * LongRangeRPA
object to handle the long-range part
const std::string my_name_
Name of the object It is required to be different for objects of the same derived type like multiple ...
helper functions for EinsplineSetBuilder
WaveFunctionComponent * ShortRangeRPA
QTBase::RealType RealType
size_t getTotalNum() const
bool put(xmlNodePtr cur)
assign attributes to the set
RPAJastrow(ParticleSet &target)
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
this is a great deal of logic for make clone I'm wondering what is going on
void setRmax(real_type rm)
void setCoefficients(std::vector< RealType > &oneBodyCoefs, std::vector< RealType > &twoBodyCoefs)
Attaches a unit to a Vector for IO.
bool put(std::istream &is) override
read from std::istream
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
std::complex< QTFull::RealType > LogValue
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
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)
const auto & getSimulationCell() const
Specialized paritlce class for atomistic simulations.
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
class to handle a set of parameters
QTBase::ValueType ValueType
A derivative of LRBasis class to provide the functionality of the LPQHI basis.
Final class and should not be derived.
class to handle a set of attributes of an xmlNode
void checkOutVariables(const opt_variables_type &active) override
check out variational optimizable variables
declaration of ProgressReportEngine
std::unique_ptr< HandlerType > myHandler
main handler
class to handle a set of variables that can be modified during optimizations
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
a move for iat-th particle is accepted.
Define a LRHandler with two template parameters.
QTFull::ValueType PsiValue
LogValue log_value_
Current .
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
void initialize(int numPoints, std::vector< Real > &x, std::vector< Real > &y, REAL cusp, REAL rcut, std::string &id, std::string &optimize)
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
void restore(int iat) override
If a move for iat-th particle is rejected, restore to the content.
UPtrVector< WaveFunctionComponent > Psi
A list of WaveFunctionComponent*.
const auto & getLattice() const
FuncType * nfunc
numerical function owned by ShortRangeRPA
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
void buildOrbital(const std::string &name, const std::string &UL, const std::string &US, const std::string &RF, RealType R, RealType K)
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
void checkOutVariables(const opt_variables_type &o) override
check out optimizable variables
Define a LRHandler with two template parameters.
declaration of the base class for many-body wavefunction.