35 throw std::runtime_error(
"If SpinDensityInput does not contain a cell definition you must call the constructor " 36 "with an explicit lattice defined");
53 species_size_(getSpeciesSize(species)),
73 std::vector<int> species_size;
76 throw std::runtime_error(
"SpinDensity(P) Species set does not have the required attribute 'membersize'");
77 for (
int s = 0;
s < species.
size(); ++
s)
78 species_size.push_back(species(index,
s));
86 std::size_t data_size =
data_.size();
94 data_size = num_particles * 20;
97 spawn->get_data().resize(data_size);
106 size_t data_size = num_particles * steps * 2;
107 data_.reserve(data_size);
124 for (
int iw = 0; iw <
walkers.size(); ++iw)
138 size_t point = offset;
140 point += dp_.gdims[d] * ((
int)(dp_.grid[d] * (u[d] -
std::floor(u[d]))));
150 data_[point] += weight;
154 data_.push_back(point);
155 data_.push_back(weight);
159 throw std::runtime_error(
"You cannot accumulate to a SpinDensityNew with datalocality of this type");
178 for (
int id = 0;
id < data.size();
id += 2)
181 size_t point{
static_cast<size_t>(data[id])};
183 data_[point] += weight;
195 throw std::runtime_error(
"You cannot call collect on a SpinDensityNew with this DataLocality");
202 app_log() << pad <<
"SpinDensity report" << std::endl;
204 app_log() << pad <<
" npoints = " << dp_.npoints << std::endl;
205 app_log() << pad <<
" grid = " << dp_.grid << std::endl;
206 app_log() << pad <<
" gdims = " << dp_.gdims << std::endl;
207 app_log() << pad <<
" corner = " << dp_.corner << std::endl;
209 app_log() << pad <<
" cell " << std::endl;
212 app_log() << pad <<
" end cell " << std::endl;
215 app_log() << pad <<
" species[" <<
s <<
"]" 217 app_log() << pad <<
"end SpinDensity report" << std::endl;
222 std::vector<size_t> my_indexes;
a class that defines a supercell in D-dimensional Euclean space.
SingleParticlePos Center
Center of the cell sum(Rv[i])/2.
std::vector< QMCT::RealType > & get_data()
void accumulate(const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecRealType > &rng) override
accumulate 1 or more walkers of SpinDensity samples
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
std::vector< ObservableHelper > h5desc_
void collect(const RefVector< OperatorEstBase > &operator_estimators) override
this allows the EstimatorManagerNew to reduce without needing to know the details of SpinDensityNew's...
std::unique_ptr< OperatorEstBase > spawnCrowdClone() const override
standard interface
int size() const
return the number of species
DataLocality data_locality_
locality for accumulation of estimator data.
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
void report(const std::string &pad)
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
Specialized paritlce class for atomistic simulations.
QMCT::FullPrecRealType walkers_weight_
const std::vector< int > species_size_
static std::vector< int > getSpeciesSize(const SpeciesSet &species)
void accumulateToData(size_t point, QMCT::RealType weight)
SpinDensityNew(SpinDensityInput &&sdi, const SpeciesSet &species, DataLocality dl=DataLocality::crowd)
Constructor for SpinDensityNew that contains an explicitly defined cell part of legacy input handling...
size_t getFullDataSize()
derived_parameters_ must be valid i.e.
bool get_write_report() const
void registerOperatorEstimator(hdf_archive &file) override
this allows the EstimatorManagerNew to reduce without needing to know the details of SpinDensityNew's...
An abstract class for gridded estimators.
SingleParticlePos toUnit(const TinyVector< T1, D > &r) const
Convert a cartesian vector to a unit vector.
std::unique_ptr< T > UPtr
const SpeciesSet & species_
Lattice lattice_
they should be limited to values that can be changed from input or are not present explicitly in t...
Native representation for Spin Density Estimators inputs.
bool get_save_memory() const
std::vector< std::string > speciesName
Species name list.
std::vector< std::reference_wrapper< T > > RefVector
void set_dimensions(const std::vector< int > &dims, int first)
set the shape of this observable
SpinDensityInput::DerivedParameters derived_parameters_
Class that collects density per species of particle.
void startBlock(int steps) override
This allows us to allocate the necessary data for the DataLocality::queue.
DataLocality
data locality with respect to walker buffer
const SpinDensityInput input_
bool explicitly_defined
true, the lattice is defined by the input instead of an artificial default
Custom container for set of attributes for a set of species.
int findAttribute(const std::string &name) const
almost all code ignores this and just uses addAttribute for the same purpose.
A container class to represent a walker.
DerivedParameters calculateDerivedParameters(const Lattice &lattice) const
Derived parameters of SpinDensity.
virtual void collect(const RefVector< OperatorEstBase > &oebs)
Reduce estimator result data from crowds to rank.
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)
SpinDensityNew sdn(std::move(sdi), lattice, species_set)
std::string my_name_
name of this object – only used for debugging and h5 output