PSCF v1.4.0
MixtureBase.h
1#ifndef PSCF_MIXTURE_BASE_H
2#define PSCF_MIXTURE_BASE_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 <pscf/chem/Monomer.h>
12#include <util/containers/DArray.h>
13
14namespace Pscf
15{
16
17 template <typename WT> class PolymerSpecies;
18 template <typename WT> class SolventSpecies;
19
20 using namespace Util;
21
56 template <typename WT>
58 {
59
60 public:
61
66
70 virtual ~MixtureBase() = default;
71
77 void setVmonomer(double vMonomer);
78
81
85 int nMonomer() const;
86
90 int nPolymer() const;
91
95 int nSolvent() const;
96
100 int nBlock() const;
101
105 double vMonomer() const;
106
114 bool isCanonical() const;
115
119
125 Monomer const & monomer(int id) const;
126
132 virtual
133 PolymerSpecies<WT> const & polymerSpecies(int id) const = 0;
134
140 virtual
141 SolventSpecies<WT> const & solventSpecies(int id) const = 0;
142
144
145 protected:
146
152 Monomer& monomer(int id);
153
158
163
168
173
178
182 double vMonomer_;
183
184 };
185
186 // Inline public member functions
187
188 template <typename WT> inline
190 { return nMonomer_; }
191
192 template <typename WT> inline
194 { return nPolymer_; }
195
196 template <typename WT> inline
198 { return nSolvent_; }
199
200 template <typename WT> inline
202 { return nBlock_; }
203
204 template <typename WT> inline
206 { return vMonomer_; }
207
208 template <typename WT> inline
209 Monomer const & MixtureBase<WT>::monomer(int id) const
210 {
211 UTIL_CHECK(id < nMonomer_);
212 return monomers_[id];
213 }
214
215 // Inline protected member function
216
217 template <typename WT> inline
219 {
220 UTIL_CHECK(id < nMonomer_);
221 return monomers_[id];
222 }
223
224 extern template class MixtureBase<double>;
225
226}
227#endif
Abstract descriptor for a mixture of polymer and solvent species.
Definition MixtureBase.h:58
virtual SolventSpecies< WT > const & solventSpecies(int id) const =0
Set a solvent solver object by const reference.
virtual PolymerSpecies< WT > const & polymerSpecies(int id) const =0
Get a PolymerSpecies by const reference.
MixtureBase()
Constructor.
int nSolvent() const
Get number of solvent (point particle) species.
int nPolymer() const
Get number of polymer species.
void setVmonomer(double vMonomer)
Set new vMonomer value.
virtual ~MixtureBase()=default
Destructor.
int nMonomer() const
Get number of monomer types.
DArray< Monomer > monomers_
Monomer const & monomer(int id) const
Get a Monomer type descriptor by const reference.
Monomer & monomer(int id)
Get a Monomer type descriptor (non-const reference).
bool isCanonical() const
Is this mixture being treated in canonical ensemble?
int nBlock() const
Get total number blocks among all polymer species.
Descriptor for a monomer type.
Definition Monomer.h:39
Descriptor for a linear or acyclic branched block polymer.
Descriptor for a solvent species.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.