PSCF v1.3
Species.h
1#ifndef PSCF_SPECIES_H
2#define PSCF_SPECIES_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/param/ParamComposite.h> // base class
12#include <util/global.h>
13
14namespace Pscf {
15
16 using namespace Util;
17
33 class Species : public ParamComposite
34 {
35 public:
36
40 enum Ensemble {Unknown, Closed, Open};
41
45 Species();
46
57 virtual void readParameters(std::istream& in);
58
62 double phi() const;
63
67 double mu() const;
68
72 double q() const;
73
78
91 void setPhi(double phi);
92
105 void setMu(double mu);
106
107 protected:
108
120 void setQ(double q);
121
122 private:
123
127 double phi_;
128
132 double mu_;
133
137 double q_;
138
142 Ensemble ensemble_;
143
144 };
145
146 /*
147 * Get species volume fraction.
148 */
149 inline double Species::phi() const
150 { return phi_; }
151
152 /*
153 * Get species chemical potential.
154 */
155 inline double Species::mu() const
156 { return mu_; }
157
158 /*
159 * Get species partition function q.
160 */
161 inline double Species::q() const
162 { return q_; }
163
164 /*
165 * Get statistical ensemble for this species (open or closed).
166 */
168 { return ensemble_; }
169
177 std::istream& operator >> (std::istream& in, Species::Ensemble& policy);
178
188 std::ostream& operator << (std::ostream& out, Species::Ensemble policy);
189
197 template <class Archive>
198 void serialize(Archive& ar, Species::Ensemble& policy,
199 const unsigned int version)
200 { serializeEnum(ar, policy, version); }
201
202}
203#endif
double phi() const
Get the overall volume fraction for this species.
Definition Species.h:149
double mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:155
double q() const
Get the molecular partition function for this species.
Definition Species.h:161
double phi() const
Get the overall volume fraction for this species.
Definition Species.h:149
virtual void readParameters(std::istream &in)
Read phi or mu (but not both) and set ensemble accordingly.
Definition Species.cpp:28
void setPhi(double phi)
Set value of phi (volume fraction), if ensemble is closed.
Definition Species.cpp:43
void setQ(double q)
Set q and compute phi or mu (depending on the ensemble).
Definition Species.cpp:63
double mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:155
Ensemble ensemble() const
Get the statistical ensemble for this species (open or closed).
Definition Species.h:167
void setMu(double mu)
Set value of mu (chemical potential), if ensemble is closed.
Definition Species.cpp:54
Species()
Default constructor.
Definition Species.cpp:18
double q() const
Get the molecular partition function for this species.
Definition Species.h:161
Ensemble
Statistical ensemble for number of molecules.
Definition Species.h:40
ParamComposite()
Constructor.
File containing preprocessor macros for error handling.
void serializeEnum(Archive &ar, T &data, const unsigned int version=0)
Serialize an enumeration value.
Definition serialize.h:59
PSCF package top-level namespace.
Definition param_pc.dox:1
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition Pair.h:44
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition Pair.h:57