PSCF v1.4.0
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 <pscf/chem/Ensemble.h> // member
13
14namespace Pscf {
15
16 using namespace Util;
17
33 template <typename WT = double>
34 class Species : public ParamComposite
35 {
36 public:
37
42
46 virtual ~Species() = default;
47
58 virtual void readParameters(std::istream& in);
59
63 WT phi() const;
64
68 WT mu() const;
69
73 WT q() const;
74
79
92 void setPhi(double phi);
93
106 void setMu(double mu);
107
108 protected:
109
121 void setQ(WT q);
122
123 private:
124
128 WT phi_;
129
133 WT mu_;
134
138 WT q_;
139
146 double phiMu_;
147
151 Ensemble ensemble_;
152
153 };
154
155 /*
156 * Get species volume fraction.
157 */
158 template <typename WT>
159 inline WT Species<WT>::phi() const
160 { return phi_; }
161
162 /*
163 * Get species chemical potential.
164 */
165 template <typename WT>
166 inline WT Species<WT>::mu() const
167 { return mu_; }
168
169 /*
170 * Get species partition function q.
171 */
172 template <typename WT>
173 inline WT Species<WT>::q() const
174 { return q_; }
175
176 /*
177 * Get statistical ensemble for this species (open or closed).
178 */
179 template <typename WT>
181 { return ensemble_; }
182
183 // Explicit instantiation declaration
184 extern template class Species<double>;
185
186}
187#endif
Base class for a molecular species (polymer or solvent).
Definition Species.h:35
virtual ~Species()=default
Destructor.
WT q() const
Get the molecular partition function for this species.
Definition Species.h:173
void setMu(double mu)
Set value of mu (chemical potential), if ensemble is closed.
Definition Species.tpp:65
Ensemble ensemble() const
Get the statistical ensemble for this species (open or closed).
Definition Species.h:180
Species()
Constructor.
Definition Species.tpp:20
virtual void readParameters(std::istream &in)
Read phi or mu (but not both) and set ensemble accordingly.
Definition Species.tpp:34
WT mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:166
void setQ(WT q)
Set q and compute phi or mu (depending on the ensemble).
Definition Species.tpp:76
WT phi() const
Get the overall volume fraction for this species.
Definition Species.h:159
void setPhi(double phi)
Set value of phi (volume fraction), if ensemble is closed.
Definition Species.tpp:52
ParamComposite()
Constructor.
Ensemble
Statistical ensemble type for the number of molecules of one species.
Definition Ensemble.h:23
PSCF package top-level namespace.