PSCF v1.5.0
Pscf::Composition< WT > Class Template Referenceabstract

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).

Detailed Description

template<typename WT>
class Pscf::Composition< WT >

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.

Constructor & Destructor Documentation

◆ Composition()

template<typename WT>
Pscf::Composition< WT >::Composition ( )

Constructor.

Definition at line 19 of file Composition.tpp.

References monomers_, nBlock_, nMonomer_, nPolymer_, nSolvent_, and vMonomer_.

◆ ~Composition()

template<typename WT>
virtual Pscf::Composition< WT >::~Composition ( )
virtualdefault

Destructor.

References setVmonomer(), and vMonomer().

Member Function Documentation

◆ setVmonomer()

template<typename WT>
void Pscf::Composition< WT >::setVmonomer ( double vMonomer)

Set new vMonomer value.

Parameters
vMonomernew vMonomer value

Definition at line 34 of file Composition.tpp.

References UTIL_CHECK, vMonomer(), and vMonomer_.

Referenced by ~Composition().

◆ nMonomer()

◆ nPolymer()

◆ nSolvent()

◆ nBlock()

template<typename WT>
int Pscf::Composition< WT >::nBlock ( ) const
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().

◆ vMonomer()

template<typename WT>
double Pscf::Composition< WT >::vMonomer ( ) const
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().

◆ isCanonical()

template<typename WT>
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.

Exceptions
Exceptionon first call if any species ensemble is unknown

Definition at line 47 of file Composition.tpp.

References nPolymer(), nSolvent(), polymerSpecies(), solventSpecies(), and UTIL_CHECK.

◆ monomer() [1/2]

template<typename WT>
Monomer const & Pscf::Composition< WT >::monomer ( int id) const
inline

Get a Monomer type descriptor by const reference.

Parameters
idinteger monomer type index (0 <= id < nMonomer)

Definition at line 253 of file Composition.h.

References monomers_, nMonomer_, and UTIL_CHECK.

Referenced by solventSpecies().

◆ polymerSpecies()

◆ solventSpecies()

◆ monomer() [2/2]

template<typename WT>
Monomer & Pscf::Composition< WT >::monomer ( int id)
inlineprotected

Get a Monomer type descriptor (non-const reference).

Parameters
idinteger monomer type index (0 <= id < nMonomer)

Definition at line 262 of file Composition.h.

References monomers_, nMonomer_, and UTIL_CHECK.

Member Data Documentation

◆ monomers_

template<typename WT>
DArray<Monomer> Pscf::Composition< WT >::monomers_
protected

Array of monomer type descriptors.

Definition at line 185 of file Composition.h.

Referenced by Composition(), monomer(), and monomer().

◆ nMonomer_

template<typename WT>
int Pscf::Composition< WT >::nMonomer_
protected

Number of monomer types.

Definition at line 190 of file Composition.h.

Referenced by Composition(), monomer(), monomer(), and nMonomer().

◆ nPolymer_

template<typename WT>
int Pscf::Composition< WT >::nPolymer_
protected

Number of polymer species.

Definition at line 195 of file Composition.h.

Referenced by Composition(), and nPolymer().

◆ nSolvent_

template<typename WT>
int Pscf::Composition< WT >::nSolvent_
protected

Number of solvent species.

Definition at line 200 of file Composition.h.

Referenced by Composition(), and nSolvent().

◆ nBlock_

template<typename WT>
int Pscf::Composition< WT >::nBlock_
protected

Number of blocks total, across all polymers.

Definition at line 205 of file Composition.h.

Referenced by Composition(), and nBlock().

◆ vMonomer_

template<typename WT>
double Pscf::Composition< WT >::vMonomer_
protected

Monomer reference volume (set to 1.0 by default).

Definition at line 210 of file Composition.h.

Referenced by Composition(), setVmonomer(), and vMonomer().


The documentation for this class was generated from the following files: