55 for (
int iw = 0; iw <
walkers.size(); ++iw)
62 std::vector<Value> sxgrid(
nsamples_, 0.0);
63 std::vector<Value> sygrid(
nsamples_, 0.0);
64 std::vector<Value> szgrid(
nsamples_, 0.0);
72 const int np =
pset.getTotalNum();
76 for (
int p = 0; p < np; ++p)
99 throw std::runtime_error(
"You cannot call collect on MagnetizationDensity with this DataLocality");
113 return DIM * point + component;
118 std::size_t data_size =
data_.size();
128 throw std::runtime_error(
"There is no memory savings implementation for MagnetizationDensity");
132 spawn->get_data().resize(data_size);
139 std::vector<Value>& sxgrid,
140 std::vector<Value>& sygrid,
141 std::vector<Value>& szgrid)
148 for (
int samp = 0; samp <
nsamples_; samp++)
156 const std::complex<Real> eye(0, 1.0);
158 for (
int samp = 0; samp <
nsamples_; samp++)
168 size_t num_gridpoints = sgrid.size();
169 Real delta = (stop - start) / (num_gridpoints - 1.0);
170 for (
int i = 0; i < num_gridpoints; i++)
171 sgrid[i] = start + i * delta;
178 Real stop = 2 * M_PI;
186 throw std::runtime_error(
"Monte Carlo sampling not implemented yet");
193 std::vector<size_t> my_indexes;
198 h5desc_.emplace_back(hdf_name);
207 int gridsize = fgrid.size();
208 for (
int is = 1; is < gridsize - 1; is += 2)
209 sint +=
Real(4. / 3.) * gridDx * fgrid[is];
211 for (
int is = 2; is < gridsize - 1; is += 2)
212 sint +=
Real(2. / 3.) * gridDx * fgrid[is];
214 sint +=
Real(1. / 3.) * gridDx * fgrid[0];
215 sint +=
Real(1. / 3.) * gridDx * fgrid[gridsize - 1];
223 Real stop = 2 * M_PI;
237 val = std::accumulate(fgrid.begin(), fgrid.end(),
Value(0));
249 size_t npoints = sgrid.size();
250 for (
int i = 0; i < npoints; i++)
251 sgrid[i] = (stop - start) * rng();
a class that defines a supercell in D-dimensional Euclean space.
SingleParticlePos Center
Center of the cell sum(Rv[i])/2.
size_t computeBin(const Position &r, const unsigned int component) const
For a given spatial position r and spin component s, this returns the bin for accumulating the observ...
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
std::vector< ObservableHelper > h5desc_
Integrator get_integrator() const
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
void startBlock(int steps) override
void generateSpinIntegrand(ParticleSet &pset, TrialWaveFunction &wfn, const int iat, std::vector< Value > &sx, std::vector< Value > &sy, std::vector< Value > &sz)
Generates the spin integrand (s')/Psi(s)* s | {} | s' for a specific electron iat.
MagnetizationDensity(MagnetizationDensityInput &&min, const Lattice &lattice)
DataLocality data_locality_
locality for accumulation of estimator data.
Value integrateMagnetizationDensity(const std::vector< Value > &fgrid) const
This is a convenience function that handles ^{2} dx f(x).
void collect(const RefVector< OperatorEstBase > &operator_estimators) override
Reduce estimator result data from crowds to rank.
void registerOperatorEstimator(hdf_archive &file) override
Specialized paritlce class for atomistic simulations.
QMCT::FullPrecRealType walkers_weight_
Value integrateBySimpsonsRule(const std::vector< Value > &fgrid, Real gridDx) const
Implementation of Simpson's 1/3 rule to integrate a function on a uniform grid.
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MagnetizationDensityInput input_
QMCTraits::ValueType Value
TinyVector< int, DIM > gdims_
void generateGrid(std::vector< Real > &sgrid) const
Convenience function to generate a grid between 0 and 2pi, consistent with nsamples_ and integration ...
An abstract class for gridded estimators.
void generateUniformGrid(std::vector< Real > &sgrid, const Real start, const Real stop) const
Generate a uniform grid between [start,stop] for numerical quadrature.
SingleParticlePos toUnit(const TinyVector< T1, D > &r) const
Convert a cartesian vector to a unit vector.
std::unique_ptr< OperatorEstBase > spawnCrowdClone() const override
TinyVector< int, DIM > gdims
std::unique_ptr< T > UPtr
size_t getFullDataSize()
This returns the total size of data object required for this estimator.
TinyVector< int, DIM > grid_
std::vector< std::reference_wrapper< T > > RefVector
void accumulate(const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecReal > &rng) override
Class to represent a many-body trial wave function.
void set_dimensions(const std::vector< int > &dims, int first)
set the shape of this observable
DataLocality
data locality with respect to walker buffer
void generateRandomGrid(std::vector< Real > &sgrid, RandomBase< FullPrecReal > &rng, Real start, Real stop) const
Generate random grid between [start,stop] for MC integration.
Magnetization density estimator for non-collinear spin calculations.
TinyVector< int, DIM > grid
A container class to represent a walker.
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios, ComputeType ct=ComputeType::ALL)
compulte multiple ratios to handle non-local moves and other virtual moves
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)
std::string my_name_
name of this object – only used for debugging and h5 output