37 std::unique_ptr<Resource>
makeClone()
const override 39 return std::make_unique<QMCHamiltonianMultiWalkerResource>(*this);
57 eval_ion_derivs_fast_timer_(
59 #
if !defined(REMOVE_TRACEMANAGER)
61 streaming_position(false),
68 weight_sample(nullptr),
69 position_sample(nullptr)
85 for (
int i = 0; i <
H.size(); i++)
87 os <<
" " << std::setw(16) << std::left <<
H[i]->getName();
105 for (
int i = 0; i <
H.size(); ++i)
109 app_warning() <<
"QMCHamiltonian::addOperator cannot " << aname <<
". The name is already used" << std::endl;
113 app_log() <<
" QMCHamiltonian::addOperator " << aname <<
" to H, physical Hamiltonian " << std::endl;
115 H.push_back(std::move(h));
116 std::string tname =
"Hamiltonian:" + aname;
122 for (
int i = 0; i <
auxH.size(); ++i)
126 app_warning() <<
"QMCHamiltonian::addOperator cannot " << aname <<
". The name is already used" << std::endl;
130 app_log() <<
" QMCHamiltonian::addOperator " << aname <<
" to auxH " << std::endl;
132 auxH.push_back(std::move(h));
137 if (aname ==
"NonLocalECP")
143 : dynamic_cast<NonLocalECPotential*>(
auxH.back().get());
147 APP_ABORT(
"QMCHamiltonian::addOperator nlpp_ptr is supposed to be null. Something went wrong!");
157 l2_ptr = physical ?
dynamic_cast<L2Potential*
>(
H.back().get()) : dynamic_cast<L2Potential*>(
auxH.back().get());
161 APP_ABORT(
"QMCHamiltonian::addOperator l2_ptr is supposed to be null. Something went wrong!");
169 app_log() <<
"QMCHamiltonian::addOperatorType added type " << type <<
" named " << name << std::endl;
176 std::map<std::string, std::string>::iterator type =
operator_types.find(name);
178 APP_ABORT(
"QMCHamiltonian::getOperatorType\n operator type not found for name " + name);
194 for (
int i = 0; i <
H.size(); ++i)
196 for (
int i = 0; i <
auxH.size(); ++i)
230 for (
int i = 0; i <
H.size(); ++i)
232 for (
int i = 0; i <
auxH.size(); ++i)
238 app_log() <<
"\n QMCHamiltonian::add2WalkerProperty added" 239 <<
"\n " <<
Observables.size() <<
" to P::PropertyList " 241 <<
"\n starting Index of the observables in P::PropertyList = " <<
myIndex << std::endl;
250 for (
int i = 0; i <
H.size(); ++i)
252 for (
int i = 0; i <
auxH.size(); ++i)
254 if (collectables.
size() != ncollects)
256 APP_ABORT(
" QMCHamiltonian::resetObservables numCollectables != ncollects");
264 for (
int i = 0; i <
H.size(); ++i)
266 for (
int i = 0; i <
auxH.size(); ++i)
273 for (
int i = 0; i <
auxH.size(); ++i)
280 ham_leader.
mw_res_handle_.getResource().kinetic_listeners_.push_back(listener);
287 ham_leader.
mw_res_handle_.getResource().kinetic_listeners_.push_back(listener);
288 ham_leader.
mw_res_handle_.getResource().potential_listeners_.push_back(listener);
294 ham_leader.
mw_res_handle_.getResource().potential_listeners_.push_back(listener);
300 ham_leader.
mw_res_handle_.getResource().ion_potential_listeners_.push_back(listener);
305 for (
int i = 0; i <
H.size(); ++i)
306 H[i]->informOfPerParticleListener();
309 #if !defined(REMOVE_TRACEMANAGER) 312 static bool first_init =
true;
315 app_log() <<
"\n Hamiltonian is initializing traces" << std::endl;
318 std::vector<std::string> Eloc;
319 std::vector<std::string> Vloc;
320 std::vector<std::string> Vq, Vc, Vqq, Vqc, Vcc;
321 for (
int i = 0; i <
H.size(); ++i)
322 Eloc.push_back(
H[i]->getName());
323 for (
int i = 1; i <
H.size(); ++i)
324 Vloc.push_back(
H[i]->getName());
328 for (
int i = 1; i <
H.size(); ++i)
343 <<
" has not been classified according to its quantum domain (q,c,qq,qc,cc)\n estimators depending " 344 "on this classification may not function properly" 358 for (
int i = 0; i <
H.size(); ++i)
359 H[i]->contributeTraceQuantities();
360 for (
int i = 0; i <
auxH.size(); ++i)
361 auxH[i]->contributeTraceQuantities();
380 std::vector<TraceRequest*> requests;
384 for (
int i = 0; i <
H.size(); ++i)
385 requests.push_back(&
H[i]->getRequest());
387 for (
int i = 0; i <
auxH.size(); ++i)
388 requests.push_back(&
auxH[i]->getRequest());
391 for (
int i = 0; i < requests.size(); ++i)
398 for (
int i = 0; i < requests.size(); ++i)
409 APP_ABORT(
"QMCHamiltonian::initialize_traces trace request failed to initialize properly");
415 app_log() <<
" no traces streaming" << std::endl;
420 app_log() <<
" traces streaming" << std::endl;
438 for (
int i = 0; i <
H.size(); ++i)
441 app_log() <<
" OperatorBase::checkoutTraceQuantities " <<
H[i]->getName() << std::endl;
442 H[i]->checkoutTraceQuantities(tm);
444 for (
int i = 0; i <
auxH.size(); ++i)
447 app_log() <<
" OperatorBase::checkoutTraceQuantities " <<
auxH[i]->getName() << std::endl;
448 auxH[i]->checkoutTraceQuantities(tm);
473 app_log() <<
"\n Hamiltonian is fulfilling trace requests from observables" << std::endl;
474 for (
int i = 0; i <
auxH.size(); ++i)
477 app_log() <<
" OperatorBase::getRequiredTraces " <<
auxH[i]->getName() << std::endl;
478 auxH[i]->getRequiredTraces(tm);
495 (*id_sample)(0) =
walker.getWalkerID();
496 (*pid_sample)(0) =
walker.getParentID();
497 (*step_sample)(0) = step;
498 (*gen_sample)(0) =
walker.Generation;
504 for (
int i = 0; i <
walker.R.size(); ++i)
505 for (
int d = 0; d <
DIM; ++d)
526 for (
int i = 0; i <
H.size(); ++i)
527 H[i]->deleteTraceQuantities();
528 for (
int i = 0; i <
auxH.size(); ++i)
529 auxH[i]->deleteTraceQuantities();
544 for (
int i = 0; i <
H.size(); ++i)
549 #if !defined(REMOVE_TRACEMANAGER) 550 H[i]->collectScalarTraces();
561 for (
int i = 0; i <
H.size(); ++i)
564 H[i]->evaluateDeterministic(P);
566 #if !defined(REMOVE_TRACEMANAGER) 567 H[i]->collectScalarTraces();
578 std::ostringstream msg;
579 msg <<
"QMCHamiltonian::updateComponent component " << op.
getName() <<
" returns NaN." << std::endl;
581 throw std::runtime_error(msg.str());
606 const int num_ham_operators = ham_leader.H.size();
610 int kinetic_index = 0;
612 ScopedTimer h_timer(ham_leader.my_timers_[kinetic_index]);
614 if (ham_leader.mw_res_handle_.getResource().kinetic_listeners_.size() > 0)
615 ham_leader.H[kinetic_index]
616 ->mw_evaluatePerParticle(HC_list, wf_list, p_list, ham_leader.mw_res_handle_.getResource().kinetic_listeners_,
617 ham_leader.mw_res_handle_.getResource().ion_kinetic_listeners_);
619 ham_leader.H[kinetic_index]->mw_evaluate(HC_list, wf_list, p_list);
620 for (
int iw = 0; iw < ham_list.size(); iw++)
624 for (
int i_ham_op = 1; i_ham_op < num_ham_operators; ++i_ham_op)
626 ScopedTimer h_timer(ham_leader.my_timers_[i_ham_op]);
629 if (ham_leader.mw_res_handle_.getResource().potential_listeners_.size() > 0)
630 ham_leader.H[i_ham_op]->mw_evaluatePerParticle(HC_list, wf_list, p_list,
631 ham_leader.mw_res_handle_.getResource().potential_listeners_,
632 ham_leader.mw_res_handle_.getResource().ion_potential_listeners_);
634 ham_leader.H[i_ham_op]->mw_evaluate(HC_list, wf_list, p_list);
635 for (
int iw = 0; iw < ham_list.size(); iw++)
639 for (
int iw = 0; iw < ham_list.size(); iw++)
642 std::vector<FullPrecRealType> local_energies(ham_list.size(), 0.0);
643 for (
int iw = 0; iw < ham_list.size(); ++iw)
646 return local_energies;
656 assert(dynamic_cast<BareKineticEnergy*>(
H[0].
get()) &&
657 "BUG: The first componennt in Hamiltonian must be BareKineticEnergy.");
665 for (
int i = 1; i <
H.size(); ++i)
668 LocalEnergy +=
H[i]->evaluateValueAndDerivatives(P, optvars, dlogpsi, dhpsioverpsi);
681 std::vector<FullPrecRealType> local_energies(ham_list.size(), 0.0);
682 for (
int iw = 0; iw < ham_list.size(); iw++)
685 if (ham_list.size() > 0)
688 const int num_ham_operators = ham_leader.H.size();
689 for (
int i_ham_op = 0; i_ham_op < num_ham_operators; ++i_ham_op)
691 ScopedTimer local_timer(ham_leader.my_timers_[i_ham_op]);
694 ham_leader.H[i_ham_op]->mw_evaluateWithParameterDerivatives(HC_list, p_list, optvars, dlogpsi, dhpsioverpsi);
696 for (
int iw = 0; iw < ham_list.size(); iw++)
700 for (
int iw = 0; iw < ham_list.size(); iw++)
703 for (
int iw = 0; iw < ham_list.size(); ++iw)
707 return local_energies;
715 for (
int i = 1; i <
H.size(); ++i)
717 if (
H[i]->isNonLocal())
725 for (
int i = 0; i <
auxH.size(); ++i)
729 #if !defined(REMOVE_TRACEMANAGER) 730 auxH[i]->collectScalarTraces();
740 #if !defined(REMOVE_TRACEMANAGER) 743 for (
int i = 0; i <
auxH.size(); ++i)
745 auxH[i]->setHistories(ThisWalker);
748 #if !defined(REMOVE_TRACEMANAGER) 749 auxH[i]->collectScalarTraces();
757 #if !defined(REMOVE_TRACEMANAGER) 760 for (
int i = 0; i <
auxH.size(); ++i)
764 if ((is_property && do_properties) || (is_collectable && do_collectables))
766 auxH[i]->setHistories(ThisWalker);
769 #if !defined(REMOVE_TRACEMANAGER) 770 auxH[i]->collectScalarTraces();
785 #if !defined(REMOVE_TRACEMANAGER) 789 for (
int i = 0; i <
auxH.size(); ++i)
791 auxH[i]->setHistories(ThisWalker);
800 for (
int i = 0; i <
H.size(); ++i)
803 H[i]->evaluateWithToperator(P);
805 #if !defined(REMOVE_TRACEMANAGER) 806 H[i]->collectScalarTraces();
821 auto& ham_leader = ham_list.getLeader();
822 const int num_ham_operators = ham_leader.H.size();
824 const int kinetic_index = 0;
826 ScopedTimer h_timer(ham_leader.my_timers_[kinetic_index]);
828 if (ham_leader.mw_res_handle_.getResource().kinetic_listeners_.size() > 0)
829 ham_leader.H[kinetic_index]
830 ->mw_evaluatePerParticleWithToperator(HC_list, wf_list, p_list,
831 ham_leader.mw_res_handle_.getResource().kinetic_listeners_,
832 ham_leader.mw_res_handle_.getResource().ion_kinetic_listeners_);
834 ham_leader.H[kinetic_index]->mw_evaluateWithToperator(HC_list, wf_list, p_list);
835 for (
int iw = 0; iw < ham_list.size(); iw++)
839 for (
int i_ham_op = 1; i_ham_op < num_ham_operators; ++i_ham_op)
841 ScopedTimer local_timer(ham_leader.my_timers_[i_ham_op]);
843 if (ham_leader.mw_res_handle_.getResource().potential_listeners_.size() > 0)
844 ham_leader.H[i_ham_op]
845 ->mw_evaluatePerParticleWithToperator(HC_list, wf_list, p_list,
846 ham_leader.mw_res_handle_.getResource().potential_listeners_,
847 ham_leader.mw_res_handle_.getResource().ion_potential_listeners_);
849 ham_leader.H[i_ham_op]->mw_evaluateWithToperator(HC_list, wf_list, p_list);
850 for (
int iw = 0; iw < ham_list.size(); ++iw)
854 for (
int iw = 0; iw < ham_list.size(); iw++)
857 std::vector<FullPrecRealType> local_energies(ham_list.size());
858 for (
int iw = 0; iw < ham_list.size(); ++iw)
861 return local_energies;
872 for (
int iel = 0; iel < nelec; iel++)
874 for (
int dim = 0; dim <
OHMMS_DIM; dim++)
893 Egrad[iel][dim] = (ep - em) / (2.0 * delta);
911 for (
int i = 0; i <
H.size(); ++i)
912 localEnergy +=
H[i]->evaluateWithIonDerivs(P, ions, psi, hf_term, pulay_terms);
933 for (
int i = 0; i <
H.size(); ++i)
934 localEnergy +=
H[i]->evaluateWithIonDerivsDeterministic(P, ions, psi, hf_term, pulay_terms);
947 for (
int i = 0; i <
H.size(); i++)
960 for (
int i = 0; i <
H.size(); ++i)
963 for (
int i = 0; i <
auxH.size(); ++i)
965 return auxH[i].
get();
972 for (
int i = 0; i <
H.size(); i++)
973 if (
H[i]->dependsOnWaveFunction())
974 components.push_back(*
H[i]);
980 for (
int i = 0; i <
H.size(); i++)
982 for (
int i = 0; i <
auxH.size(); i++)
988 for (
int i = 0; i <
H.size(); i++)
990 for (
int i = 0; i <
auxH.size(); i++)
1024 auto& ham_leader = ham_list.
getLeader();
1026 std::vector<int> num_accepts(ham_list.size(), 0);
1029 for (
int iw = 0; iw < ham_list.size(); ++iw)
1037 auto resource_index = collection.
addResource(std::make_unique<QMCHamiltonianMultiWalkerResource>());
1038 for (
int i = 0; i <
H.size(); ++i)
1045 auto& ham_leader = ham_list.
getLeader();
1047 for (
int i_ham_op = 0; i_ham_op < ham_leader.H.size(); ++i_ham_op)
1050 ham_leader.H[i_ham_op]->acquireResource(collection, HC_list);
1057 auto& ham_leader = ham_list.
getLeader();
1059 for (
int i_ham_op = 0; i_ham_op < ham_leader.H.size(); ++i_ham_op)
1062 ham_leader.H[i_ham_op]->releaseResource(collection, HC_list);
1068 auto myclone = std::make_unique<QMCHamiltonian>(
myName);
1069 for (
int i = 0; i <
H.size(); ++i)
1070 H[i]->add2Hamiltonian(qp, psi, *myclone);
1071 for (
int i = 0; i <
auxH.size(); ++i)
1072 auxH[i]->add2Hamiltonian(qp, psi, *myclone);
1091 HC_list.reserve(ham_list.size());
1093 HC_list.push_back(*(
H.H[
id]));
1107 const int ngroups = psi_wrapper_in.
numGroups();
1109 std::vector<ValueMatrix> X_;
1110 std::vector<ValueMatrix> Minv_;
1111 std::vector<ValueMatrix> B_;
1112 std::vector<ValueMatrix> B_gs_;
1113 std::vector<ValueMatrix> M_;
1114 std::vector<ValueMatrix> M_gs_;
1116 std::vector<std::vector<ValueMatrix>> dM_;
1117 std::vector<std::vector<ValueMatrix>> dM_gs_;
1118 std::vector<std::vector<ValueMatrix>> dB_;
1119 std::vector<std::vector<ValueMatrix>> dB_gs_;
1123 M_gs_.resize(ngroups);
1126 B_gs_.resize(ngroups);
1127 Minv_.resize(ngroups);
1129 for (
int gid = 0; gid < ngroups; gid++)
1132 const int norbs = psi_wrapper_in.
numOrbitals(sid);
1133 const int first = P.
first(gid);
1134 const int last = P.
last(gid);
1135 const int nptcls = last - first;
1137 M_[sid].resize(nptcls, norbs);
1138 B_[sid].resize(nptcls, norbs);
1140 M_gs_[sid].resize(nptcls, nptcls);
1141 Minv_[sid].resize(nptcls, nptcls);
1142 B_gs_[sid].resize(nptcls, nptcls);
1143 X_[sid].resize(nptcls, nptcls);
1151 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
1153 dM_[idim].resize(ngroups);
1154 dB_[idim].resize(ngroups);
1155 dM_gs_[idim].resize(ngroups);
1156 dB_gs_[idim].resize(ngroups);
1158 for (
int gid = 0; gid < ngroups; gid++)
1161 const int norbs = psi_wrapper_in.
numOrbitals(sid);
1162 const int first = P.
first(gid);
1163 const int last = P.
last(gid);
1164 const int nptcls = last - first;
1166 dM_[idim][sid].resize(nptcls, norbs);
1167 dB_[idim][sid].resize(nptcls, norbs);
1168 dM_gs_[idim][sid].resize(nptcls, nptcls);
1169 dB_gs_[idim][sid].resize(nptcls, nptcls);
1179 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
1197 psi_wrapper_in.
getM(P, M_);
1204 for (
int i = 0; i <
H.size(); ++i)
1206 if (
H[i]->dependsOnWaveFunction())
1208 H[i]->evaluateOneBodyOpMatrix(P, psi_wrapper_in, B_);
1212 localEnergy +=
H[i]->evaluateWithIonDerivsDeterministic(P, ions, psi_in, hfdiag_, pulayterms_);
1220 nondiag_cont = psi_wrapper_in.
trAB(Minv_, B_gs_);
1222 localEnergy += nondiag_cont_re;
1225 psi_wrapper_in.
buildX(Minv_, B_gs_, X_);
1228 for (
int iat = 0; iat < ions.
getTotalNum(); iat++)
1235 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
1247 for (
int i = 0; i <
H.size(); ++i)
1249 if (
H[i]->dependsOnWaveFunction())
1251 H[i]->evaluateOneBodyOpMatrixForceDeriv(P, ions, psi_wrapper_in, iat, dB_);
1255 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
1262 dedr_complex[iat][idim] = fval;
1265 wfcomp = psi_wrapper_in.
trAB(Minv_, dM_gs_[idim]);
1266 wfgradraw_[iat][idim] += wfcomp;
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
int addObservables(ParticleSet &P)
add each term to the PropertyList for averages
FullPrecRealType evaluateIonDerivsDeterministicFast(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi_in, TWFFastDerivWrapper &psi_wrapper, ParticleSet::ParticlePos &dedr, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
register collectables so that their averages can be dumped to hdf5
Array< TraceInt, 1 > * gen_sample
void informOperatorsOfListener()
Some Hamiltonian components need to be informed that they are in a per particle reporting situation s...
Evaluate the L2 potentials around each ion.
size_type size() const
return the size of the data
void setNonLocalMoves(xmlNodePtr cur)
set non local moves options
NewTimer & ham_timer_
Total timer for H evaluation.
size_t addResource(std::unique_ptr< Resource > &&res, bool noprint=false)
std::ostream & app_warning()
void takebackResource(ResourceHandle< RS > &res_handle)
IndexType numGroups() const
These are query functions to the internal state of various groups and SPOSet info.
helper functions for EinsplineSetBuilder
bool isQuantumClassical() const noexcept
Array< TraceInt, 1 > * step_sample
Array< TraceInt, 1 > * pid_sample
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluateWithToperator(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluate Local energy with Toperators updated.
bool streaming_array(const std::string &name)
RefVector< OperatorBase > getTWFDependentComponents()
return components, auxH not included, depending on TWF.
std::vector< ListenerVector< RealType > > ion_kinetic_listeners_
NewTimer & eval_vals_derivs_timer_
Total timer for H evaluation.
void addOperator(std::unique_ptr< OperatorBase > &&h, const std::string &aname, bool physical=true)
add an operator
OperatorBase * getHamiltonian(const std::string &aname)
return OperatorBase with the name aname
~QMCHamiltonian()
destructor
size_t getTotalNum() const
void addOperatorType(const std::string &name, const std::string &type)
record the name-type pair of an operator
bool get(std::ostream &os) const
QMCTraits::FullPrecRealType FullPrecRealType
ValueType trAB(const std::vector< ValueMatrix > &A, const std::vector< ValueMatrix > &B)
Returns Tr(A*B).
FullPrecRealType evaluateValueAndDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate energy and derivatives wrt to the variables
FullPrecRealType KineticEnergy
Current Kinetic Energy.
ResourceHandle< QMCHamiltonianMultiWalkerResource > mw_res_handle_
std::vector< std::reference_wrapper< NewTimer > > my_timers_
timers for H components
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
GradType evaluateJastrowGradSource(ParticleSet &P, ParticleSet &source, const int iat) const
Return ionic gradient of J(r).
Collection of Local Energy Operators.
An object of this type is a listener expecting a callback to the report function with a vector of val...
OperatorBase::RealType RealType
static void updateComponent(OperatorBase &op, QMCHamiltonian &ham, ParticleSet &pset)
accumulate local energy and update Observables and PropertyList
int first(int igroup) const
return the first index of a group i
static void mw_registerLocalEnergyListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
bool streaming_default_scalars
IndexType numOrbitals(const IndexType sid) const
int current_step
current MC step
void update(bool skipSK=false)
update the internal data
Array< TraceInt, D > * checkout_int(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
NonLocalECPotential * nlpp_ptr
pointer to NonLocalECP
Attaches a unit to a Vector for IO.
void resetObservables(int start, int ncollects)
reset Observables and counters
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
void rewind(size_type cur=0)
set the Current to a cursor
void getIonGradM(const ParticleSet &P, const ParticleSet &source, const int iat, std::vector< std::vector< ValueMatrix >> &dmvec) const
Returns x,y,z components of ion gradient of slater matrices.
void determine_stream_write()
ValueType computeGSDerivative(const std::vector< ValueMatrix > &Minv, const std::vector< ValueMatrix > &X, const std::vector< ValueMatrix > &dM, const std::vector< ValueMatrix > &dB) const
Calculates derivative of observable via Tr[M^{-1} dB - X * dM ].
void getGSMatrices(const std::vector< ValueMatrix > &A, std::vector< ValueMatrix > &Aslice) const
Takes sub matrices of full SPOSet quantities (evaluated on all particles and all orbitals), consistent with ground state occupations.
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluate(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluate for LocalEnergy
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluateValueAndDerivatives(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
PropertySetType PropertyList
name-value map of Walker Properties
bool streaming(const std::string &name)
NewTimer & eval_ion_derivs_fast_timer_
Total timer for H ion deriv evaluation;.
static void mw_registerKineticListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
Listener Registration This must be called on a QMCHamiltonian that has acquired multiwalker resources...
omp_int_t omp_get_thread_num()
Array< TraceReal, 1 > * weight_sample
Specialized paritlce class for atomistic simulations.
int myIndex
starting index
int makeNonLocalMovesPbyP(ParticleSet &P)
make non local moves with particle-by-particle moves
FullPrecRealType LocalEnergy
Current Local Energy.
int numCollectables
starting index
FullPrecRealType evaluateWithToperator(ParticleSet &P)
evaluate Local energy with Toperators updated.
std::vector< ListenerVector< RealType > > kinetic_listeners_
void make_combined_trace(const std::string &name, std::vector< std::string > &names)
int add(const std::string &aname)
TraceRequest request
traces variables
void collect_walker_traces(Walker_t &walker, int step)
collect walker trace data
static void mw_registerLocalIonPotentialListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
void clear()
clear the data and set Current=0
void contribute_scalar(const std::string &name, bool default_quantity=false)
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
bool isQuantum() const noexcept
class to handle a set of variables that can be modified during optimizations
GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat)
Returns the logarithmic gradient of the trial wave function with respect to the iat^th atom of the so...
bool isClassicalClassical() const noexcept
QMCHamiltonianMultiWalkerResource()
void getM(const ParticleSet &P, std::vector< ValueMatrix > &mmat) const
Returns the non-rectangular slater matrices M_ij=phi_j(r_i) (N_particle x N_orbs) for each species gr...
Array< TraceInt, 1 > * age_sample
FullPrecRealType evaluateIonDerivsDeterministic(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
FullPrecRealType evaluateDeterministic(ParticleSet &P)
evaluate Local Energy deterministically.
FullPrecRealType getEnsembleAverage()
return an average value of the LocalEnergy
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void user_report(std::string pad=" ")
int last(int igroup) const
return the last index of a group i
L2Potential * l2_ptr
pointer to L2Potential
FullPrecRealType getLocalEnergy()
const std::string myName
getName is in the way
void incorporate(TraceRequest &other)
const std::string & getName() const
static void updateKinetic(QMCHamiltonian &ham, ParticleSet &pset)
extract kinetic and potential energies.
void evaluateElecGrad(ParticleSet &P, TrialWaveFunction &psi, ParticleSet::ParticlePos &EGrad, RealType delta=1e-5)
Evaluate the electron gradient of the local energy.
Return_t getValue() const noexcept
get a copy of value_
void setNonLocalMoves(xmlNodePtr cur)
set non local moves options
static std::vector< int > mw_makeNonLocalMoves(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
void resize(size_type n, T val=T())
resize
Buffer_t Collectables
observables in addition to those registered in Properties/PropertyList
Array< TraceReal, D > * checkout_real(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
const std::string & getOperatorType(const std::string &name)
return type of named H element or fail
void initialize_traces(TraceManager &tm, ParticleSet &P)
initialize trace data
Declaration of a TrialWaveFunction.
void auxHevaluate(ParticleSet &P)
An abstract class for Local Energy operators.
Array< TraceReal, 2 > * position_sample
void contribute_combined(const std::string &name, std::vector< std::string > &deps, bool scalar=false, bool array=false, bool default_quantity=false)
std::vector< std::reference_wrapper< T > > RefVector
void rejectedMove(ParticleSet &P, Walker_t &ThisWalker)
Looks like a hack see DMCBatched.cpp and DMC.cpp weight is used like temporary flag from DMC...
static void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< QMCHamiltonian > &ham_list)
acquire external resource Note: use RAII ResourceCollectionLock whenever possible ...
void relay_stream_info(TraceRequest &other)
void registerObservables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
register obsevables so that their averages can be dumped to hdf5
static void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< QMCHamiltonian > &ham_list)
release external resource Note: use RAII ResourceCollectionLock whenever possible ...
std::vector< std::unique_ptr< OperatorBase > > H
vector of Hamiltonians
void setRandomGenerator(RandomBase< FullPrecRealType > *rng) override
set the internal RNG pointer as the given pointer
virtual void setParticlePropertyList(PropertySetType &plist, int offset)
Evaluate the semi local potentials.
Class to represent a many-body trial wave function.
bool isQuantumQuantum() const noexcept
static void mw_registerLocalPotentialListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
PropertySetType Observables
data
std::vector< ListenerVector< RealType > > ion_potential_listeners_
std::vector< ListenerVector< RealType > > potential_listeners_
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
std::string getName() const noexcept
getter a copy of my_name_, rvalue small string optimization
void contribute_array(const std::string &name, bool default_quantity=false)
std::vector< std::unique_ptr< OperatorBase > > auxH
vector of Hamiltonians
void updateSource(ParticleSet &s)
remove a named Hamiltonian from the list
void finalize_traces()
finalize trace data
int makeNonLocalMoves(ParticleSet &P)
make non local moves
void wipeMatrices(std::vector< ValueMatrix > &A)
Goes through a list of matrices and zeros them out.
void resetTargetParticleSet(ParticleSet &P)
bool isClassical() const noexcept
virtual void setObservables(PropertySetType &plist)
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
Array< TraceInt, 1 > * mult_sample
ResourceHandle< RS > lendResource()
IndexType getTWFGroupIndex(const IndexType gid) const
Takes particle set groupID and returns the TWF internal index for it.
std::map< std::string, std::string > operator_types
types of component operators
OperatorBase::ValueType ValueType
FullPrecRealType evaluateVariableEnergy(ParticleSet &P, bool free_nlpp)
evaluate energy
void buildX(const std::vector< ValueMatrix > &Minv, const std::vector< ValueMatrix > &B, std::vector< ValueMatrix > &X)
Build the auxiliary X=M^-1 B M^-1 matrix.
Array< TraceInt, 1 > * id_sample
void setRandomGenerator(RandomBase< FullPrecRealType > *rng)
static RefVectorWithLeader< OperatorBase > extract_HC_list(const RefVectorWithLeader< QMCHamiltonian > &ham_list, int id)
std::unique_ptr< QMCHamiltonian > makeClone(ParticleSet &qp, TrialWaveFunction &psi) const
return a clone
void invertMatrices(const std::vector< ValueMatrix > &M, std::vector< ValueMatrix > &Minv)
Helper function that inverts all slater matrices in our species list.
A container class to represent a walker.
std::unique_ptr< Resource > makeClone() const override
Declaration of QMCHamiltonian.
bool isnan(float a)
return true if the value is NaN.
FullPrecRealType evaluateIonDerivs(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates.
QMCHamiltonian(const std::string &aname="psi0")
constructor