|
PSCF v1.5.0
|
Descriptor for a mixture of polymer and solvent species. More...
#include <Composition.h>
Public Member Functions | |
| Composition () | |
| Constructor. | |
| virtual | ~Composition ()=default |
| Destructor. | |
| void | setVmonomer (double vMonomer) |
| Set new vMonomer value. | |
Accessors (by value) | |
| int | nMonomer () const |
| Get number of monomer types. | |
| int | nPolymer () const |
| Get number of polymer species. | |
| int | nSolvent () const |
| Get number of solvent (point particle) species. | |
| int | nBlock () const |
| Get total number blocks among all polymer species. | |
| double | vMonomer () const |
| Get monomer reference volume (set to 1.0 by default). | |
| bool | isCanonical () const |
| Is this mixture being treated in a canonical (closed) ensemble? | |
Accessors (by const reference) | |
| Monomer const & | monomer (int id) const |
| Get a Monomer type descriptor by const reference. | |
| virtual PolymerSpecies< WT > const & | polymerSpecies (int id) const =0 |
| Get a PolymerSpecies by const reference. | |
| virtual SolventSpecies< WT > const & | solventSpecies (int id) const =0 |
| Set a solvent solver object by const reference. | |
Protected Member Functions | |
| Monomer & | monomer (int id) |
| Get a Monomer type descriptor (non-const reference). | |
Protected Attributes | |
| DArray< Monomer > | monomers_ |
| Array of monomer type descriptors. | |
| int | nMonomer_ |
| Number of monomer types. | |
| int | nPolymer_ |
| Number of polymer species. | |
| int | nSolvent_ |
| Number of solvent species. | |
| int | nBlock_ |
| Number of blocks total, across all polymers. | |
| double | vMonomer_ |
| Monomer reference volume (set to 1.0 by default). | |
Descriptor for a mixture of polymer and solvent species.
A Composition describes the contents of a a mixture that may contain polymer and solvent molecular species. An instance of this class contains an array of Monomer objects and provides access to PolymerSpecies and SolventSpecies objects that describe all molecular species in the mixture.
Composition is an abstract base class for "solver" subclasses that can also solve the single-molecule statistical mechanics problem for every species in a mixture. Each program level sub-namespace of Pscf (R1d or Rp) contains a class or class template named Mixture that is derived from Pscf::Composition, and that acts as an MDE solver for the mixture, as well a descriptor. A reference to the Composition sub-object of such a Mixture solver object can be used in generic algorithms that require a description of the contents of a mixture, but that do not actually need to solve the MDE.
Within each program-level namespace, each Mixture class or class template is derived from a specialization of the class template Pscf::MixtureTmpl<class Polymer, class Solvent>. Specializations of this template are, in turn, derived from Pscf::Composition. The template parameters Polymer and Solvent of the MixtureTmpl template are classes that are used to represent polymer and solvent species in the relevant program level namespace, respectively. The Polymer class or class template in each program level namespace is an MDE solver for a polymer species that is derived from the class Pscf::PolymerSpecies, which is a polymer species descriptor. Similarly, the Solvent class or class template in each program level namespace is an MDE solver for a solvent species that is derived from Pscf::SolventSpecies, which is a corresponding species descriptor.
The MixtureTmpl<Polymer, Solvent> template contains private member variables that are arrays of Polymer and Solvent solver objects.
The MixtureTmpl template also defines implementations of the virtual functions polymerSpecies(int id) and solventSpecies(int id), which are declared as pure virtual member functions of Composition. These functions return const references to the PolymerSpecies sub-object of a Polymer solver object or to the SolventSpecies sub-object of of a Solvent solver object, respectively.
Definition at line 67 of file Composition.h.
| Pscf::Composition< WT >::Composition | ( | ) |
|
virtualdefault |
Destructor.
References setVmonomer(), and vMonomer().
| void Pscf::Composition< WT >::setVmonomer | ( | double | vMonomer | ) |
Set new vMonomer value.
| vMonomer | new vMonomer value |
Definition at line 34 of file Composition.tpp.
References UTIL_CHECK, vMonomer(), and vMonomer_.
Referenced by ~Composition().
|
inline |
Get number of monomer types.
Definition at line 233 of file Composition.h.
References nMonomer_.
Referenced by Pscf::R1::Sweep::checkAllocation(), Pscf::R1::SweepParameter::checkIds(), Pscf::Rp::RampParameter< D, T >::checkIds(), Pscf::Rp::SweepParameter< D, T >::checkIds(), Pscf::R1::System::computeFreeEnergy(), Pscf::Rp::Simulator< D, T >::computeHamiltonian(), Pscf::R1::Sweep::extrapolate(), Pscf::FhMixture::initialize(), Pscf::R1::BinaryRelaxIterator::solve(), and Pscf::R1::NrIterator::solve().
|
inline |
Get number of polymer species.
Definition at line 237 of file Composition.h.
References nPolymer_.
Referenced by Pscf::R1::SweepParameter::checkIds(), Pscf::Rp::RampParameter< D, T >::checkIds(), Pscf::Rp::SweepParameter< D, T >::checkIds(), Pscf::R1::HomogeneousComparison::compute(), Pscf::R1::System::computeFreeEnergy(), Pscf::Rp::Simulator< D, T >::computeHamiltonian(), Pscf::FhMixture::initialize(), isCanonical(), Pscf::R1::HomogeneousComparison::output(), Pscf::R1::BinaryRelaxIterator::solve(), Pscf::R1::NrIterator::solve(), Pscf::R1::FieldIo::writeBlockCFields(), Pscf::R1::System::writeThermo(), and Pscf::R1::FieldIo::writeVertexQ().
|
inline |
Get number of solvent (point particle) species.
Definition at line 241 of file Composition.h.
References nSolvent_.
Referenced by Pscf::R1::SweepParameter::checkIds(), Pscf::Rp::RampParameter< D, T >::checkIds(), Pscf::Rp::SweepParameter< D, T >::checkIds(), Pscf::R1::HomogeneousComparison::compute(), Pscf::R1::System::computeFreeEnergy(), Pscf::Rp::Simulator< D, T >::computeHamiltonian(), Pscf::FhMixture::initialize(), isCanonical(), Pscf::R1::HomogeneousComparison::output(), Pscf::R1::BinaryRelaxIterator::solve(), Pscf::R1::NrIterator::solve(), Pscf::R1::FieldIo::writeBlockCFields(), and Pscf::R1::System::writeThermo().
|
inline |
Get total number blocks among all polymer species.
Definition at line 245 of file Composition.h.
References nBlock_.
Referenced by Pscf::R1::FieldIo::writeBlockCFields().
|
inline |
Get monomer reference volume (set to 1.0 by default).
Definition at line 249 of file Composition.h.
References vMonomer_.
Referenced by Pscf::R1::HomogeneousComparison::output(), setVmonomer(), and ~Composition().
| bool Pscf::Composition< WT >::isCanonical | ( | ) | const |
Is this mixture being treated in a canonical (closed) ensemble?
Returns true if and only if every polymer and solvent species has a closed ensemble (Ensemble::Closed), or false if any species has an open ensemble (Ensemble::Open).
This function computes and stores a value the first time it is called and returns the stored value on all subsequent calls. It may only be called after known ensemble values have been set for all species. The correctness of this behavior relies on the fact that the ensemble of a Species is initialized to Species::Unknown, and may only be set to open or closed once, by invoking Species::readParameters.
| Exception | on first call if any species ensemble is unknown |
Definition at line 47 of file Composition.tpp.
References nPolymer(), nSolvent(), polymerSpecies(), solventSpecies(), and UTIL_CHECK.
|
inline |
Get a Monomer type descriptor by const reference.
| id | integer monomer type index (0 <= id < nMonomer) |
Definition at line 253 of file Composition.h.
References monomers_, nMonomer_, and UTIL_CHECK.
Referenced by solventSpecies().
|
pure virtual |
Get a PolymerSpecies by const reference.
This function must be implemented by a specialization of the Pscf::MixtureTmpl <Polymer, Solvent> class template, which is derived from Composition.
| id | integer polymer species index (0 <= id < nPolymer) |
Implemented in Pscf::MixtureTmpl< PT, ST, WT >, Pscf::MixtureTmpl< Polymer, Solvent >, Pscf::MixtureTmpl< Polymer< D, CPT >, Solvent< D, CPT >, double >, Pscf::MixtureTmpl< Polymer< D, CUT >, Solvent< D, CUT >, double >, Pscf::MixtureTmpl< Polymer< D, Pscf::CPT >, Solvent< D, Pscf::CPT >, double >, Pscf::MixtureTmpl< Polymer< D, Pscf::CUT >, Solvent< D, Pscf::CUT >, double >, Pscf::MixtureTmpl< Polymer< D, T >, Solvent< D, T >, double >, Pscf::MixtureTmpl< PolymerT, SolventT, double >, Pscf::Rp::Mixture< D, T >, Pscf::Rp::Mixture< D, CPT >, Pscf::Rp::Mixture< D, CUT >, Pscf::Rp::Mixture< D, Pscf::CPT >, and Pscf::Rp::Mixture< D, Pscf::CUT >.
Referenced by Pscf::FhMixture::initialize(), and isCanonical().
|
pure virtual |
Set a solvent solver object by const reference.
This function must be implemented by a specialization of the Pscf::MixtureTmpl <Polymer, Solvent> class template, which is derived from Composition.
| id | integer solvent species index (0 <= id < nSolvent) |
Implemented in Pscf::MixtureTmpl< PT, ST, WT >, Pscf::MixtureTmpl< Polymer, Solvent >, Pscf::MixtureTmpl< Polymer< D, CPT >, Solvent< D, CPT >, double >, Pscf::MixtureTmpl< Polymer< D, CUT >, Solvent< D, CUT >, double >, Pscf::MixtureTmpl< Polymer< D, Pscf::CPT >, Solvent< D, Pscf::CPT >, double >, Pscf::MixtureTmpl< Polymer< D, Pscf::CUT >, Solvent< D, Pscf::CUT >, double >, Pscf::MixtureTmpl< Polymer< D, T >, Solvent< D, T >, double >, Pscf::MixtureTmpl< PolymerT, SolventT, double >, Pscf::Rp::Mixture< D, T >, Pscf::Rp::Mixture< D, CPT >, Pscf::Rp::Mixture< D, CUT >, Pscf::Rp::Mixture< D, Pscf::CPT >, and Pscf::Rp::Mixture< D, Pscf::CUT >.
References monomer().
Referenced by Pscf::FhMixture::initialize(), and isCanonical().
|
inlineprotected |
Get a Monomer type descriptor (non-const reference).
| id | integer monomer type index (0 <= id < nMonomer) |
Definition at line 262 of file Composition.h.
References monomers_, nMonomer_, and UTIL_CHECK.
|
protected |
Array of monomer type descriptors.
Definition at line 185 of file Composition.h.
Referenced by Composition(), monomer(), and monomer().
|
protected |
Number of monomer types.
Definition at line 190 of file Composition.h.
Referenced by Composition(), monomer(), monomer(), and nMonomer().
|
protected |
Number of polymer species.
Definition at line 195 of file Composition.h.
Referenced by Composition(), and nPolymer().
|
protected |
Number of solvent species.
Definition at line 200 of file Composition.h.
Referenced by Composition(), and nSolvent().
|
protected |
Number of blocks total, across all polymers.
Definition at line 205 of file Composition.h.
Referenced by Composition(), and nBlock().
|
protected |
Monomer reference volume (set to 1.0 by default).
Definition at line 210 of file Composition.h.
Referenced by Composition(), setVmonomer(), and vMonomer().