PSCF v1.4.0
MixtureBase.tpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "MixtureBase.h"
9#include "PolymerSpecies.h"
10#include "SolventSpecies.h"
11
12namespace Pscf
13{
14
15 /*
16 * Constructor.
17 */
18 template <typename WT>
20 : monomers_(),
21 nMonomer_(0),
22 nPolymer_(0),
23 nSolvent_(0),
24 nBlock_(0),
25 vMonomer_(1.0)
26 {}
27
28 /*
29 * Set the monomer volume value.
30 */
31 template <typename WT>
37
38 /*
39 * Is the ensemble closed for all species?
40 */
41 template <typename WT>
43 {
44 // Check ensemble of all polymer species
45 for (int i = 0; i < nPolymer(); ++i) {
46 if (polymerSpecies(i).ensemble() == Ensemble::Open) {
47 return false;
48 }
49 }
50
51 // Check ensemble of all solvent species
52 for (int i = 0; i < nSolvent(); ++i) {
53 if (solventSpecies(i).ensemble() == Ensemble::Open) {
54 return false;
55 }
56 }
57
58 // Returns true if false was not returned earlier
59 return true;
60 }
61
62}
int nMonomer_
Number of monomer types.
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.
int nPolymer_
Number of polymer species.
MixtureBase()
Constructor.
int nSolvent_
Number of solvent species.
double vMonomer() const
Get monomer reference volume (set to 1.0 by default).
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.
DArray< Monomer > monomers_
Array of monomer type descriptors.
int nBlock_
Number of blocks total, across all polymers.
double vMonomer_
Monomer reference volume (set to 1.0 by default).
bool isCanonical() const
Is this mixture being treated in canonical ensemble?
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.