33 ensemble_ = Species::Closed;
35 ensemble_ = Species::Open;
81 if (buffer ==
"Closed" || buffer ==
"closed") {
82 policy = Species::Closed;
84 if (buffer ==
"Open" || buffer ==
"open") {
85 policy = Species::Open;
87 UTIL_THROW(
"Invalid Species::Ensemble string in operator >>");
97 if (policy == Species::Closed) {
100 if (policy == Species::Open) {
103 if (policy == Species::Unknown) {
106 std::cout <<
"Invalid Species::Ensemble value on input"
108 UTIL_THROW(
"Unrecognized value for Species::Ensemble");
double phi() const
Get the overall volume fraction for this species.
virtual void readParameters(std::istream &in)
Read phi or mu (but not both) and set ensemble accordingly.
void setPhi(double phi)
Set value of phi (volume fraction), if ensemble is closed.
void setQ(double q)
Set q and compute phi or mu (depending on the ensemble).
double mu() const
Get the chemical potential for this species (units kT=1).
Ensemble ensemble() const
Get the statistical ensemble for this species (open or closed).
void setMu(double mu)
Set value of mu (chemical potential), if ensemble is closed.
Species()
Default constructor.
double q() const
Get the molecular partition function for this species.
Ensemble
Statistical ensemble for number of molecules.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
PSCF package top-level namespace.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.