PSCF v1.3
MixtureBase.cpp
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 */
19 : monomers_(),
20 nMonomer_(0),
21 nPolymer_(0),
22 nSolvent_(0),
23 nBlock_(0),
24 vMonomer_(1.0)
25 {}
26
27 /*
28 * Destructor.
29 */
32
34 {
35 UTIL_CHECK(vMonomer > 0.0);
37 }
38
39 /*
40 * Is the ensemble closed for every species.
41 */
43 {
44 // Check ensemble of all polymer species
45 for (int i = 0; i < nPolymer(); ++i) {
46 if (polymerSpecies(i).ensemble() == Species::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() == Species::Open) {
54 return false;
55 }
56 }
57
58 // Returns true if false was not returned earlier
59 return true;
60 }
61
62}
virtual SolventSpecies const & solventSpecies(int id) const =0
Set a solvent solver object by const reference.
int nMonomer_
Number of monomer types.
int nPolymer_
Number of polymer species.
int nBlock_
Number of blocks total, across all polymers.
virtual PolymerSpecies const & polymerSpecies(int id) const =0
Get a PolymerSpecies by const reference.
int nPolymer() const
Get number of polymer species.
int nSolvent_
Number of solvent species.
void setVmonomer(double vMonomer)
Set new vMonomer value.
double vMonomer_
Monomer reference volume (set to 1.0 by default).
int nSolvent() const
Get number of solvent (point particle) species.
MixtureBase()
Constructor.
double vMonomer() const
Get monomer reference volume (set to 1.0 by default).
DArray< Monomer > monomers_
Array of monomer type descriptors.
bool isCanonical() const
Is this mixture being treated in canonical ensemble?
~MixtureBase()
Destructor.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.
Definition param_pc.dox:1