27 : psetpool(PSP), Pdynamic(0), Pstatic(0), w_trace(0), Td_trace(0), Vd_trace(0), Vs_trace(0)
56 name_ =
"EnergyDensity";
57 std::string dyn, stat =
"";
61 attrib.
add(dyn,
"dynamic");
62 attrib.
add(stat,
"static");
71 std::vector<ParticleSet*> Pref;
97 for (
int i = 0; i <
nions; i++)
98 for (
int d = 0; d <
DIM; d++)
107 app_log() <<
"Initializing reference points" << std::endl;
108 bool has_ref =
false;
109 element = cur->children;
110 while (element != NULL)
112 std::string name((
const char*)element->name);
113 if (name ==
"reference_points")
117 APP_ABORT(
"EnergyDensityEstimator::put: EDE can only have one instance of reference_points.");
122 stop = stop || !ref_succeeded;
126 element = element->next;
131 stop = stop || !ref_succeeded;
136 element = cur->children;
138 while (element != NULL)
140 std::string name = (
const char*)element->name;
141 if (name ==
"spacegrid")
152 grid_succeeded = sg->
put(element,
ref.
points, periodic,
false);
153 stop = stop || !grid_succeeded;
155 element = element->next;
159 APP_ABORT(
"EnergyDensityEstimator::put");
170 int nspecies = species.TotalNum;
172 std::vector<RealType> Zspec;
173 Zspec.resize(nspecies);
175 for (
int spec = 0; spec < nspecies; spec++)
176 Zspec[spec] = species(ChargeAttribIndx, spec);
177 for (
int i = 0; i < nps; i++)
180 for (
int i = 0; i < P.
R.
size(); i++)
198 app_log() <<
" ParticleSet " << psname <<
" does not exist" << std::endl;
199 APP_ABORT(
"EnergyDensityEstimator::put");
201 return pit->second.get();
219 os <<
"EnergyDensityEstimator::write_description" << std::endl;
221 os <<
" EnergyDensityEstimator details" << std::endl;
223 std::string indent =
" ";
224 os << indent +
"nparticles = " <<
nparticles << std::endl;
225 os << indent +
"nspacegrids = " <<
spacegrids.size() << std::endl;
234 os <<
" end EnergyDensityEstimator details" << std::endl;
236 os <<
"end EnergyDensityEstimator::write_description" << std::endl;
243 os <<
"EDM replace this " << std::endl;
244 APP_ABORT(
"EnergyDensityEstimator::get");
266 for (
int i = 0; i < Rs.size(); i++)
275 for (
int i = 0; i < Rs.size(); i++)
345 for (
int i = 0; i <
nions; i++)
346 for (v = 0; v < (int)
nEDValues; v++, bi++)
352 #if defined(ENERGYDENSITY_CHECK) 358 #pragma omp critical(edcheck) 371 for (
int i = 0; i <
nions; i++)
380 app_log() << thread <<
" eval ED " << cnt <<
" " << Tsum <<
" " << Vsum <<
" " << Esum << std::endl;
384 for (
int v = 0; v < nvals; v++)
390 for (
int v = 0; v < nvals; v++)
391 edvals[v] += edtmp[v];
393 for (
int v = 0; v < nvals; v++)
397 for (
int i = 0; i <
nions; i++)
398 for (
int v = 0; v < nvals; v++)
402 app_log() << thread <<
" eval ES " << cnt <<
" " << edvals[
T] <<
" " << edvals[
V] <<
" " << edvals[
T] + edvals[
V]
404 app_log() << thread <<
" ref E " << cnt <<
" " << Tref <<
" " << Vref <<
" " << Eref << std::endl;
422 app_log() <<
"EDcoll " << label << cnt <<
" " << Ti <<
" " << To << std::endl;
429 app_log() <<
"EDValues" << std::endl;
436 app_log() <<
"Nonzero domains" << std::endl;
440 for (
int i = 0; i < nd; i++)
442 bool nonzero =
false;
463 std::vector<RealType> tmp(nvalues);
464 collectables.
add(tmp.begin(), tmp.end());
468 spacegrids[i]->allocate_buffer_space(collectables);
474 std::vector<RealType> tmp2(nvalues);
475 collectables.
add(tmp2.begin(), tmp2.end());
483 h5desc.emplace_back(hdf_name /
"variables");
484 auto&
oh = h5desc.back();
487 oh.
addProperty(const_cast<int&>(nspacegrids),
"nspacegrids", file);
496 h5desc.emplace_back(hdf_name /
"outside");
497 auto& ohOutside = h5desc.back();
498 std::vector<int> ng(1);
508 std::vector<int> ng2(2);
512 h5desc.emplace_back(hdf_name /
"ions");
513 auto& ohIons = h5desc.back();
533 app_log() <<
"EnergyDensityEstimator::makeClone" << std::endl;
535 std::unique_ptr<EnergyDensityEstimator> edclone = std::make_unique<EnergyDensityEstimator>(
psetpool,
defKE);
void resize(size_type n, Type_t val=Type_t())
Resize the container.
TraceSample< TraceReal > * Td_trace
size_type size() const
return the size of the data
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
TraceSample< TraceReal > * w_trace
void setObservables(PropertySetType &plist) override
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
std::vector< RealType > Zptcl
void delete_iter(IT first, IT last)
delete the pointers in [first,last)
helper functions for EinsplineSetBuilder
void applyMinimumImage(ParticlePos &pinout) const
bool put(xmlNodePtr cur) override
check xml elements
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
size_t getTotalNum() const
void setParticlePropertyList(PropertySetType &plist, int offset) override
int my_index_
starting index of this object
bool put(xmlNodePtr cur, ParticleSet &P, std::vector< ParticleSet *> &Pref)
bool put(xmlNodePtr cur)
assign attributes to the set
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const override
Vectorized record engine for scalar properties.
void addProperty(T &p, const std::string &pname, hdf_archive &file)
add named property to describe the collectable this helper class handles
std::vector< bool > particles_outside
void resize(size_type n, size_type m)
Resize the container.
int addAttribute(const std::string &aname)
for a new attribute, allocate the data, !More often used to get the index of a species ...
ParticleSet * get_particleset(std::string &psname)
TraceRequest request_
whether traces are being collected
ParticleIndex GroupID
Species ID.
void sum(const BufferType &buf, RealType *vals)
void evaluate(const ParticlePos &R, const Matrix< RealType > &values, BufferType &buf, std::vector< bool > &particles_outside, const DistanceTableAB &dtab)
PropertySetType PropertyList
name-value map of Walker Properties
void write_nonzero_domains(const ParticleSet &P)
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
void turnOnPerParticleSK()
Turn on per particle storage in Structure Factor.
std::vector< SpaceGrid * > spacegrids
~EnergyDensityEstimator() override
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
omp_int_t omp_get_thread_num()
std::string name_
name of this object
Specialized paritlce class for atomistic simulations.
void getRequiredTraces(TraceManager &tm) override
TODO: add docs.
size_type size() const
return the current size
void addObservables(PropertySetType &plist)
void write_EDValues(void)
class to handle a set of attributes of an xmlNode
std::map< std::string, Point > points
void write_Collectables(std::string &label, int &cnt, ParticleSet &P)
void write_description(std::ostream &os)
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
EnergyDensityEstimator(const PSPool &PSP, const std::string &defaultKE)
CombinedTraceSample< TraceReal > * Vs_trace
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file, int grid_index) const
void request_array(const std::string &name, bool write=false)
Buffer_t Collectables
observables in addition to those registered in Properties/PropertyList
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
bool have_required_traces_
FullPrecRealType Return_t
type of return value of evaluate
Class to represent a many-body trial wave function.
Indexes
an enum denoting index of physical properties
void write_description(std::ostream &os, std::string &indent)
std::map< std::string, const std::unique_ptr< ParticleSet > > PSPool
ParticleAttrib< SingleParticlePos > ParticlePos
Matrix< RealType > EDIonValues
const auto & getLattice() const
Define a LRHandler with two template parameters.
Matrix< RealType > EDValues
Custom container for set of attributes for a set of species.
CombinedTraceSample< TraceReal > * Vd_trace
CombinedTraceSample< TraceReal > * get_real_combined_trace(const std::string &name)
int outside_buffer_offset
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
bool get(std::ostream &os) const override
write about the class
Declaration of a MCWalkerConfiguration.
TraceSample< TraceReal > * get_real_trace(const std::string &name)
void request_scalar(const std::string &name, bool write=false)
std::bitset< 8 > update_mode_
set the current update mode
bool put(xmlNodePtr cur, std::map< std::string, Point > &points, ParticlePos &R, std::vector< RealType > &Z, int ndp, bool is_periodic, bool abort_on_fail=true)
void save(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const