19 #ifndef QMCPLUSPLUS_PARTICLESET_H 20 #define QMCPLUSPLUS_PARTICLESET_H 42 class DistanceTableAA;
43 class DistanceTableAB;
44 class ResourceCollection;
46 struct SKMultiWalkerMem;
148 void create(
const std::vector<int>& agroup);
154 void print(std::ostream& os,
const size_t maxParticlesToPrint = 0)
const;
157 bool get(std::ostream& os)
const override;
159 bool put(std::istream&)
override;
161 void reset()
override;
164 bool put(xmlNodePtr cur)
override;
203 void update(
bool skipSK =
false);
292 template<CoordsType CT>
297 const std::vector<SingleParticlePos>& displs);
302 const std::vector<Scalar_t>& sdispls);
354 const std::vector<RealType>& dt);
388 template<CoordsType CT>
391 const std::vector<bool>& isAccepted,
392 bool forward_mode =
true);
397 const std::vector<bool>& isAccepted,
398 bool forward_mode =
true);
408 const std::vector<bool>& isAccepted);
441 const std::vector<bool>& recompute,
530 template<
typename ATList>
541 AttribList.add(
spins);
556 AttribList.add(
Mass);
668 const std::vector<SingleParticlePos>& new_positions,
669 bool maybe_accept =
true);
void resize(size_type n, Type_t val=Type_t())
Resize the container.
a class that defines a supercell in D-dimensional Euclean space.
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
const auto & getLRBox() const
Index_t getActivePtcl() const
return active particle id
void setName(const std::string &aname)
Walker< QMCTraits, PtclOnLatticeTraits > Walker_t
walker type
HamiltonianRef::FullPrecRealType FullPrecRealType
ResourceHandle< SKMultiWalkerMem > mw_structure_factor_data_handle_
multi walker structure factor data
auto & get_group_offsets() const
void convert2UnitInBox(const ParticlePos &pint, ParticlePos &pout)
void acceptMoveForwardMode(Index_t iat)
actual implemenation for accepting a proposed move in forward mode
quantum_domains quantum_domain
quantum_domain of the particles, default = classical
const SpeciesSet & getSpeciesSet() const
retrun the const SpeciesSet of this particle set
static void mw_makeMove(const RefVectorWithLeader< ParticleSet > &p_list, int iat, const MCCoords< CT > &displs)
batched version of makeMove
Index_t active_ptcl_
the index of the active particle during particle-by-particle moves
helper functions for EinsplineSetBuilder
const DistanceTableAA & getDistTableAA(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAA
static void mw_accept_rejectSpinMove(const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< bool > &isAccepted)
batched version of acceptMove and reject Move fused, but only for spins
Scalar_t getActiveSpinVal() const
ParticleScalar spins
internal spin variables for dynamical spin calculations
void applyMinimumImage(ParticlePos &pinout) const
void setTypeName(const std::string &tname)
set the type name
PropertyContainer_t Properties
properties of the current walker
std::string myName
the name of the node, corresponds to the xml tag
Array< RealType, OHMMS_DIM > Density_r
const std::vector< int > & get_map_storage_to_input() const
ParticleLayout::SingleParticlePos SingleParticlePos
static std::string indextype_tag
the datatype tag for the index-type attribute
size_t getTotalNum() const
std::vector< T >::iterator end()
return the ending iterator
static std::string spins_tag
the name for spins attribute
quantum variables of all the particles
size_t TotalNum
total number of particles
ResourceHandle manages the temporary resource referenced from a collection.
static void mw_makeSpinMove(const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< Scalar_t > &sdispls)
batched version makeMove for spin variable only
static void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< ParticleSet > &p_list)
release external resource Note: use RAII ResourceCollectionTeamLock whenever possible ...
static RefVectorWithLeader< StructFact > extractSKRefList(const RefVectorWithLeader< ParticleSet > &p_list)
bool same_mass_
true if the particles have the same mass
static std::string position_tag
names of particle attributes, e.g., position
Soa Container for D-dim vectors.
int addProperty(const std::string &pname)
std::vector< std::vector< FullPrecRealType > > PropertyHistory
Property history vector.
int getNumDistTables() const
ParticleAttrib< QTFull::ValueType > ParticleLaplacian
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
void applyBC(const ParticlePos &pin, ParticlePos &pout)
int first(int igroup) const
return the first index of a group i
Vectorized record engine for scalar properties.
static std::string postype_tag
the datatype tag for the pos-type attribute
ParticleAttrib< Index_t > ParticleIndex
int current_step
current MC step
void update(bool skipSK=false)
update the internal data
bool is_classical() const
std::vector< T >::iterator begin()
return the starting iterator
ParticleLaplacian L
laplacians of the particles
Calculates the structure-factor for a particle set.
ConstantSizeMatrix< FullPrecRealType, std::allocator< FullPrecRealType > > PropertyContainer_t
typedef for the property container, fixed size
static RefVectorWithLeader< DistanceTable > extractDTRefList(const RefVectorWithLeader< ParticleSet > &p_list, int id)
static void mw_saveWalker(const RefVectorWithLeader< ParticleSet > &psets, const RefVector< Walker_t > &walkers)
batched version of saveWalker
static void mw_accept_rejectMove(const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< bool > &isAccepted, bool forward_mode=true)
batched version of acceptMove and rejectMove fused, templated on CoordsType
SingleParticlePos myTwist
Scalar_t active_spin_val_
the proposed spin of active_ptcl_ during particle-by-particle moves
std::map< std::string, int > myDistTableMap
map to handle distance tables
void convert2Unit(const ParticlePos &pin, ParticlePos &pout)
Index_t activeBead
the index of the active bead for particle-by-particle moves
const Scalar_t & activeSpin(int iat) const
return the active spin value if the particle is active or return the current spin value if not ...
ParticleIndex GroupID
Species ID.
void rejectMoveForwardMode(Index_t iat)
reject a proposed move in forward mode
PropertySetType PropertyList
name-value map of Walker Properties
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
std::unique_ptr< StructFact > structure_factor_
Structure factor.
void turnOnPerParticleSK()
Turn on per particle storage in Structure Factor.
int groups() const
return the number of groups
ParticleSet(const SimulationCell &simulation_cell, const DynamicCoordinateKind kind=DynamicCoordinateKind::DC_POS)
default constructor
const auto & getSimulationCell() const
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
std::vector< ComplexType > VHXC_G[2]
void createAttributeList(ATList &AttribList)
add attributes to list for IO
const PosType & getActivePos() const
Specialized paritlce class for atomistic simulations.
const Lattice & getLattice() const
Abstract class to provide xml-compatible I/O interfaces for the derived classes.
bool quantumDomainValid(quantum_domains qdomain) const
check whether quantum domain is valid for particles
int add(const std::string &aname)
AB type of DistanceTable containing storage.
void rejectMove(Index_t iat)
reject a proposed move in regular mode
void setObjName(const std::string &oname)
set the object name
const FullPrecRealType *restrict getPropertyBase() const
return the address of the values of Hamiltonian terms
void resize(size_t numPtcl)
resize internal storage
ParticleGradient G
gradients of the particles
bool makeMoveAndCheckWithSpin(Index_t iat, const SingleParticlePos &displ, const Scalar_t &sdispl)
makeMoveAndCheck, but now includes an update to the spin variable
void convert2Cart(const ParticlePos &pin, ParticlePos &pout)
static void mw_computeNewPosDistTables(const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< SingleParticlePos > &new_positions, bool maybe_accept=true)
compute temporal DistTables and SK for a new particle position for each walker in a batch ...
void saveWalker(Walker_t &awalker)
save this to awalker
std::vector< int > PHindex
int groupsize(int igroup) const
return the size of a group
std::vector< ComplexType > Density_G
void accept_rejectMove(Index_t iat, bool accepted, bool forward_mode=true)
accept or reject a proposed move Two operation modes: The using and updating distance tables via Part...
FullPrecRealType *restrict getPropertyBase(int i)
return the address of the i-th properties
void reset() override
dummy. For satisfying OhmmsElementBase.
int addPropertyHistory(int leng)
void makeMoveWithSpin(Index_t iat, const SingleParticlePos &displ, const Scalar_t &sdispl)
makeMove, but now includes an update to the spin variable
const std::string & parentName() const
return parent's name
QTFull::RealType Scalar_t
Index_t direction
the direction reptile traveling
int last(int igroup) const
return the last index of a group i
static std::string ionid_tag
the name for ionid attribute
const StructFact & getSK() const
return Structure Factor
std::vector< std::string > distTableDescriptions
Descriptions from distance table creation. Same order as DistTables.
const PosType & activeR(int iat) const
return the active position if the particle is active or the return current position if not ...
bool is_spinor_
true is a dynamic spin calculation
void setTwist(const SingleParticlePos &t)
ParticleScalar Z
charge of each particle
AA type of DistanceTable containing storage.
void loadWalker(Walker_t &awalker, bool pbyp)
load a Walker_t to the current ParticleSet
auto & getDistTable(int table_ID) const
get a distance table by table_ID
void computeNewPosDistTables(Index_t iat, const SingleParticlePos &newpos, bool maybe_accept=true)
compute temporal DistTables and SK for a new particle position
Buffer_t Collectables
observables in addition to those registered in Properties/PropertyList
const Lattice & getLRBox() const
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void create(const std::vector< int > &agroup)
create grouped particles
static void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< ParticleSet > &p_list)
acquire external resource and assocaite it with the list of ParticleSet Note: use RAII ResourceCollec...
void setMapStorageToInput(const std::vector< int > &mapping)
std::vector< std::string > speciesName
Species name list.
std::unique_ptr< DynamicCoordinates > coordinates_
internal representation of R. It can be an SoA copy of R
static std::string gradtype_tag
the datatype tag for the gradient-type attribute
const SingleParticlePos & getTwist() const
std::vector< std::reference_wrapper< T > > RefVector
const DynamicCoordinates & getCoordinates() const
std::shared_ptr< Vector< int, OMPallocator< int > > > group_offsets_
array to handle a group of distinct particles per species
SpeciesSet my_species_
SpeciesSet of particles.
void print(std::ostream &os, const size_t maxParticlesToPrint=0) const
print particle coordinates to a std::ostream
void convert(const ParticlePos &pin, ParticlePos &pout)
Particle traits to use UniformGridLayout for the ParticleLayout.
~ParticleSet() override
default destructor
bool quantumDomainValid() const
check whether quantum domain is valid for particles
void makeMove(Index_t iat, const SingleParticlePos &displ, bool maybe_accept=true)
move the iat-th particle to active_pos_
ParticleScalar Mass
mass of each particle
static RefVectorWithLeader< DynamicCoordinates > extractCoordsRefList(const RefVectorWithLeader< ParticleSet > &p_list)
bool getPerParticleSKState() const
Get state (on/off) of per particle storage in Structure Factor.
SingleParticlePos active_pos_
the proposed position of active_ptcl_ during particle-by-particle moves
std::vector< int > map_storage_to_input_
Map storage index to the input index.
const FullPrecRealType *restrict getPropertyBase(int i) const
return the address of the i-th properties
static void mw_update(const RefVectorWithLeader< ParticleSet > &p_list, bool skipSK=false)
batched version of update
Array< RealType, OHMMS_DIM > VHXC_r[2]
void resetCollectables()
reset all the collectable quantities during a MC iteration
ParticleAttrib< SingleParticlePos > ParticlePos
static void mw_donePbyP(const RefVectorWithLeader< ParticleSet > &p_list, bool skipSK=false)
batched version of donePbyP
bool put(std::istream &) override
dummy. For satisfying OhmmsElementBase.
const auto & getLattice() const
bool makeMoveAllParticlesWithDrift(const Walker_t &awalker, const ParticlePos &drift, const ParticlePos &deltaR, RealType dt)
move all the particles including the drift
bool makeMoveAndCheck(Index_t iat, const SingleParticlePos &displ)
move the iat-th particle to active_pos_
ParticleAttrib< QTFull::GradType > ParticleGradient
const std::string & species_from_index(int i)
get species name of particle i
void createSK()
create Structure Factor with PBCs
void setQuantumDomain(quantum_domains qdomain)
specify quantum_domain of particles
void randomizeFromSource(ParticleSet &src)
Initialize particles around another ParticleSet Used to initialize an electron ParticleSet by an ion ...
Custom container for set of attributes for a set of species.
void setSpinor(bool is_spinor)
static void mw_loadWalker(const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< Walker_t > &walkers, const std::vector< bool > &recompute, bool pbyp)
batched version of loadWalker
std::vector< std::unique_ptr< DistanceTable > > DistTables
distance tables that need to be updated by moving this ParticleSet
void acceptMove(Index_t iat)
accept the move and update the particle attribute by the proposed move in regular mode ...
FullPrecRealType *restrict getPropertyBase()
return the address of the values of Hamiltonian terms
bool makeMoveAllParticles(const Walker_t &awalker, const ParticlePos &deltaR, RealType dt)
move all the particles of a walker
ParticleAttrib< Scalar_t > ParticleScalar
std::vector< TinyVector< int, OHMMS_DIM > > DensityReducedGvecs
Particle density in G-space for MPC interaction.
A container class to represent a walker.
const SimulationCell & simulation_cell_
reference to global simulation cell
std::vector< TinyVector< int, OHMMS_DIM > > VHXCReducedGvecs
DFT potential.
void convert2CartInBox(const ParticlePos &pint, ParticlePos &pout)
Define a serialized buffer to store anonymous data.
void donePbyP(bool skipSK=false)
update structure factor and unmark active_ptcl_
void makeVirtualMoves(const SingleParticlePos &newpos)
Handles virtual moves for all the particles to a single newpos.
static std::string scalartype_tag
the datatype tag for the scalar-type attribute
const Lattice & getPrimLattice() const
int getGroupID(int iat) const
return the group id of a given particle in the particle set.
static std::string laptype_tag
the datatype tag for the laplacian-type attribute
auto & getPrimitiveLattice() const