8 #include "SpeciesEnsemble.h" 10 #include <util/mpi/MpiStructBuilder.h> 38 UTIL_THROW(
"Must be a grand-canonical ensemble");
49 read<Type>(in,
"type", type_);
51 read<double>(in,
"mu", mu_);
63 if (buffer ==
"CLOSED" || buffer ==
"closed") {
64 type = SpeciesEnsemble::CLOSED;
66 if (buffer ==
"GRAND" || buffer ==
"grand") {
67 type = SpeciesEnsemble::GRAND;
69 UTIL_THROW(
"Invalid SpeciesEnsemble::Type value input");
79 if (type == SpeciesEnsemble::CLOSED) {
82 if (type == SpeciesEnsemble::GRAND) {
98 builder.
addMember(&
object.mu_, MPI::DOUBLE);
99 builder.
addMember(&
object.type_, MPI::INT);
void addMember(void *memberAddress, MPI::Datatype type, int count=1)
Add a new member variable to the type map.
An ensemble for the number of molecules of one Species.
double mu() const
Return the chemical potential mu.
bool isGrand() const
Is this a Grand ensemble?
End & readEnd(std::istream &in)
Add and read the closing bracket.
Classes used by all simpatico molecular simulations.
std::istream & operator>>(std::istream &in, MonoclinicBoundary &boundary)
istream extractor for a MonoclinicBoundary.
void setBase(void *objectAddress)
Set address of an class instance.
void commit(MPI::Datatype &newType)
Build and commit a user-defined MPI Struct datatype.
SpeciesEnsemble(Type type=UNKNOWN)
Constructor.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void setMu(double mu)
Set the chemical potential mu.
static void commitMpiType()
Commit associated MPI DataType.
Utility classes for scientific computation.
virtual void readParam(std::istream &in)
Read the type and (if appropriate) mu from file.
std::ostream & operator<<(std::ostream &out, const MonoclinicBoundary &boundary)
ostream inserter for an MonoclinicBoundary.
Type
Enumeration of the allowed types of SpeciesEnsemble.
~SpeciesEnsemble()
Destructor.
A MpiStructBuilder objects is used to create an MPI Struct datatype.
Begin & readBegin(std::istream &in, const char *label, bool isRequired=true)
Add and read a class label and opening bracket.