41 :
MPIObjectBase(other.myComm), simulation_cell_(std::move(other.simulation_cell_)), myPool(std::move(other.myPool))
44 myName = other.myName;
54 return pit->second.
get();
62 throw std::runtime_error(
"ParticleSePool::getWalkerSet missing " + pname);
69 const auto pit(
myPool.find(p->getName()));
72 auto& pname = p->getName();
73 LOGMSG(
" Adding " << pname <<
" ParticleSet to the pool")
75 throw std::runtime_error(
"Bug detected! ParticleSetPool::addParticleSet requires p created with the simulation " 76 "cell from ParticleSetPool.");
77 myPool.emplace(pname, std::move(p));
80 throw std::runtime_error(p->getName() +
" exists. Cannot be added again.");
87 bool lattice_defined =
false;
91 lattice_defined = a.
put(cur);
100 app_log() <<
" Overwriting global supercell " << std::endl;
107 return lattice_defined;
121 std::string role(
"none");
122 std::string randomR(
"no");
123 std::string randomsrc;
127 pAttrib.
add(
id,
"id");
128 pAttrib.
add(
id,
"name");
129 pAttrib.
add(role,
"role");
130 pAttrib.
add(randomR,
"random");
131 pAttrib.
add(randomsrc,
"randomsrc");
132 pAttrib.
add(randomsrc,
"random_source");
133 pAttrib.
add(spinor,
"spinor", {
"no",
"yes"});
137 if (
id ==
"e" && role ==
"none")
146 app_summary() <<
" Name: " <<
id <<
" Offload : " << (use_offload ?
"yes" :
"no") << std::endl;
155 myPool.emplace(
id, pTemp);
168 if (randomR ==
"yes" && !randomsrc.empty())
170 xmlNodePtr anode = xmlNewNode(NULL, (
const xmlChar*)
"init");
171 xmlNewProp(anode, (
const xmlChar*)
"source", (
const xmlChar*)randomsrc.c_str());
172 xmlNewProp(anode, (
const xmlChar*)
"target", (
const xmlChar*)
id.c_str());
183 app_warning() <<
"Particle set " <<
id <<
" is already created. Ignoring this section." << std::endl;
202 throw std::runtime_error(
"ParticleSePool::randomize failed to randomize some Particlesets!");
207 os <<
"ParticleSetPool has: " << std::endl << std::endl;
208 os.setf(std::ios::scientific, std::ios::floatfield);
214 pset->print(os, 10 );
220 xmlNodePtr particles_info =
doc.
addChild(root,
"particles");
221 PoolType::const_iterator it(
myPool.begin()), it_end(
myPool.end());
224 xmlNodePtr particle =
doc.
addChild(particles_info,
"particle");
225 doc.
addChild(particle,
"name", (*it).second->getName());
226 doc.
addChild(particle,
"size", (*it).second->getTotalNum());
MCWalkerConfiguration * getWalkerSet(const std::string &pname)
get a named MCWalkerConfiguration
void setName(const std::string &aname)
class that handles xmlDoc
ParticleSetPool(Communicate *c, const char *aname="particleset")
constructor
A set of walkers that are to be advanced by Metropolis Monte Carlo.
std::ostream & app_warning()
Base class for any object which needs to know about a MPI communicator.
void reset()
reset is used to initialize and evaluate the distance tables
helper functions for EinsplineSetBuilder
bool put(xmlNodePtr cur)
process an xml element
bool isHighActive() const
size_t getTotalNum() const
std::ostream & app_summary()
bool put(xmlNodePtr cur)
assign attributes to the set
std::string myName
name of the object
void addParticleSet(std::unique_ptr< ParticleSet > &&p)
add a ParticleSet* to the pool with its ownership transferred ParticleSet built outside the ParticleS...
OutputManagerClass outputManager(Verbosity::HIGH)
void output_particleset_info(Libxml2Document &doc, xmlNodePtr root)
Wrapping information on parallelism.
int groups() const
return the number of groups
std::unique_ptr< SimulationCell > simulation_cell_
global simulation cell
bool get(std::ostream &os) const
Specialized paritlce class for atomistic simulations.
Declaration of InitMolecularSystem.
ParticleSet * getParticleSet(const std::string &pname)
get a named ParticleSet
Final class and should not be derived.
Communicate * myComm
pointer to Communicate
class to handle a set of attributes of an xmlNode
This a subclass for runtime errors that will occur on all ranks.
declaration of ProgressReportEngine
Manage a collection of ParticleSet objects.
std::string ClassName
class Name
bool readXML(xmlNodePtr cur)
process xmlnode <particleset/> which contains everything about the particle set to initialize ...
std::vector< xmlNodePtr > randomize_nodes
xml node for random initialization.
static PlatformKind selectPlatform(std::string_view value)
bool readSimulationCellXML(xmlNodePtr cur)
initialize the supercell shared by all the particle sets
bool isDebugActive() const
void randomize()
randomize a particleset particleset/='yes' && particleset exists
void addChild(xmlNodePtr newnode)
Define a LRHandler with two template parameters.
void setSpinor(bool is_spinor)
void barrier_and_abort(const std::string &msg) const
bool get(std::ostream &os) const override
dummy. For satisfying OhmmsElementBase.
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
bool put(std::istream &is) override
read from std::istream
PoolType myPool
List of ParticleSet owned.
Declaration of ParticleSetPool.
const std::vector< std::string > candidate_values