44 std::unique_ptr<Resource>
makeClone()
const override {
return std::make_unique<J1OrbitalSoAMultiWalkerMem>(*this); }
50 use_offload_(use_offload),
52 Nions(ions.getTotalNum()),
53 Nelec(els.getTotalNum()),
54 NumGroups(ions.groups()),
58 throw std::runtime_error(
"J1OrbitalSoA object name cannot be empty!");
69 for (
int j = ions.
first(ig); j < ions.
last(ig); j++)
71 assert(count ==
Nions);
81 if (std::any_of(J1Functors.begin(), J1Functors.end(), [](
auto* ptr) {
return ptr ==
nullptr; }))
82 app_warning() <<
"One-body Jastrow \"" << my_name_ <<
"\" doesn't cover all the particle pairs. " 83 <<
"Consider fusing multiple entries if they are of the same type for optimal code performance." 101 template<
typename FT>
109 template<
typename FT>
112 std::vector<std::vector<ValueType>>& ratios)
const 121 if (wfc_list.size() == 0)
125 const auto& mw_refPctls = vp_leader.getMultiWalkerRefPctls();
127 auto& mw_vals = mw_mem.mw_vals;
128 auto& mw_minus_one = mw_mem.mw_minus_one;
129 const int nw = wfc_list.size();
131 const size_t nVPs = mw_refPctls.size();
132 mw_vals.resize(nVPs);
133 mw_mem.resize_minus_one(nVPs);
135 const auto& dt_leader(vp_leader.getDistTableAB(wfc_leader.myTableID));
137 FT::mw_evaluateV(NumGroups, GroupFunctors.data(), wfc_leader.Nions, grp_ids.data(), nVPs, mw_minus_one.data(),
138 dt_leader.getMultiWalkerDataPtr(), dt_leader.getPerTargetPctlStrideSize(), mw_vals.data(),
139 mw_mem.transfer_buffer);
142 for (
int iw = 0; iw < nw; ++iw)
147 ratios[iw][k] =
std::exp(wfc.Vat[mw_refPctls[ivp]] - mw_vals[ivp]);
void checkSanity() const override
Validate the internal consistency of the object.
size_t addResource(std::unique_ptr< Resource > &&res, bool noprint=false)
std::ostream & app_warning()
void takebackResource(ResourceHandle< RS > &res_handle)
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
const int NumGroups
number of ion groups
Vector< T, OffloadPinnedAllocator< T > > mw_vals
For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
size_t getTotalNum() const
std::unique_ptr< Resource > makeClone() const override
int first(int igroup) const
return the first index of a group i
void resize_minus_one(size_t size)
const bool use_offload_
if true use offload
J1OrbitalSoAMultiWalkerMem(const J1OrbitalSoAMultiWalkerMem &)
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
return a shared resource to a collection
An abstract class for a component of a many-body trial wave function.
ResourceHandle< J1OrbitalSoAMultiWalkerMem< RealType > > mw_mem_handle_
Specialization for one-body Jastrow function using multiple functors.
Specialized paritlce class for atomistic simulations.
DynamicCoordinateKind getKind() const
void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const override
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
CASTTYPE & getCastedElement(size_t i) const
int last(int igroup) const
return the last index of a group i
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
void initialize(const ParticleSet &els)
J1OrbitalSoA(const std::string &obj_name, const ParticleSet &ions, ParticleSet &els, bool use_offload)
const int Nions
number of ions
const DynamicCoordinates & getCoordinates() const
CASTTYPE & getCastedLeader() const
Vector< int, OffloadPinnedAllocator< int > > grp_ids
the group_id of each particle
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
acquire a shared resource from a collection
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
Vector< char, OffloadPinnedAllocator< char > > transfer_buffer
J1OrbitalSoAMultiWalkerMem()
ResourceHandle< RS > lendResource()
Vector< int, OffloadPinnedAllocator< int > > mw_minus_one