PSCF v1.4.0
Pscf::Rp::System< D, T > Class Template Reference

Base class template for classes that represent a complete system. More...

#include <System.h>

Inheritance diagram for Pscf::Rp::System< D, T >:
Util::ParamComposite Util::ParamComponent Util::Serializable Util::MpiFileIo

Public Member Functions

Lifetime Actions
void setOptions (int argc, char **argv)
 Process command line options.
virtual void readParam (std::istream &in)
 Read input parameters (with opening and closing lines).
void readParam ()
 Read input parameters from default param file.
virtual void readParameters (std::istream &in)
 Read body of parameter block (without opening and closing lines).
void readCommands (std::istream &in)
 Read and process commands from an input stream.
void readCommands ()
 Read and process commands from the default command file.
Field Theory Computations
void compute (bool needStress=false)
 Solve the modified diffusion equation once, without iteration.
void computeStress ()
 Compute SCFT stress.
int iterate (bool isContinuation=false)
 Iteratively solve a SCFT problem.
void sweep ()
 Sweep in parameter space, solving an SCF problem at each point.
void simulate (int nStep)
 Perform a field theoretic simulation (PS-FTS).
void clearCFields ()
 Mark c-fields and free energy as outdated or invalid.
Unit Cell Modifiers
void setUnitCell (UnitCell< D > const &unitCell)
 Set parameters of the associated unit cell.
void setUnitCell (FSArray< double, 6 > const &parameters)
 Set parameters of the associated unit cell.
void clearUnitCellData ()
 Notify System members that unit cell parameters have been modified.
Field Containers
T::CFields const & c () const
 Get the monomer concentration (c) fields (const).
T::WFields const & w () const
 Get the chemical potential (w) fields (const).
T::WFields & w ()
 Get the chemical potential (w) fields (non-const).
T::WFields const & h () const
 Get the external potential (h) fields (const).
T::WFields & h ()
 Get the external potential (h) fields (non-const).
T::Mask const & mask () const
 Get the mask (const).
T::Mask & mask ()
 Get the mask (non-const).
Component Object Accessors
T::Mixture const & mixture () const
 Get the Mixture (const).
T::MixtureModifier & mixtureModifier ()
 Get the MixtureModifier (non-const).
T::Interaction const & interaction () const
 Get the Interaction (const).
T::Interaction & interaction ()
 Get the Interaction (non-const).
T::Domain const & domain () const
 Get the Domain (const).
T::WaveList & waveList ()
 Get the WaveList (non-const).
bool hasEnvironment () const
 Does this system have an Environment?
T::Environment const & environment () const
 Get the Environment (const).
T::Environment & environment ()
 Get the Environment (non-const).
T::ScftThermo const & scft () const
 Get the ScftThermo object (const).
T::ScftThermo & scft ()
 Get the ScftThermo object (non-const).
bool hasIterator () const
 Does this system have an Iterator?
T::Iterator const & iterator () const
 Get the Iterator (const).
T::Iterator & iterator ()
 Get the Iterator (non-const).
bool hasSweep () const
 Does this system have a Sweep?
bool hasSimulator () const
 Does this system have a Simulator?
T::Simulator const & simulator () const
 Get the Simulator (const).
T::Simulator & simulator ()
 Get the Simulator (non-const).
FileMaster const & fileMaster () const
 Get the FileMaster (const).
FileMasterfileMaster ()
 Get the FileMaster (non-const).
Property Output
void writeParamNoSweep (std::ostream &out) const
 Write partial parameter file to an ostream.
Timers
void writeTimers (std::ostream &out) const
 Write timer information to an output stream.
void clearTimers ()
 Clear all timers.
Public Member Functions inherited from Util::ParamComposite
 ParamComposite ()
 Constructor.
 ParamComposite (const ParamComposite &other)
 Copy constructor.
 ParamComposite (int capacity)
 Constructor.
virtual ~ParamComposite ()
 Virtual destructor.
void resetParam ()
 Resets ParamComposite to its empty state.
virtual void readParamOptional (std::istream &in)
 Read optional parameter file block.
virtual void writeParam (std::ostream &out) const
 Write all parameters to an output stream.
virtual void load (Serializable::IArchive &ar)
 Load all parameters from an input archive.
virtual void loadOptional (Serializable::IArchive &ar)
 Load an optional ParamComposite.
virtual void loadParameters (Serializable::IArchive &ar)
 Load state from archive, without adding Begin and End lines.
virtual void save (Serializable::OArchive &ar)
 Saves all parameters to an archive.
void saveOptional (Serializable::OArchive &ar)
 Saves isActive flag, and then calls save() iff isActive is true.
void readParamComposite (std::istream &in, ParamComposite &child, bool next=true)
 Add and read a required child ParamComposite.
void readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true)
 Add and attempt to read an optional child ParamComposite.
template<typename Type>
ScalarParam< Type > & read (std::istream &in, const char *label, Type &value)
 Add and read a new required ScalarParam < Type > object.
template<typename Type>
ScalarParam< Type > & readOptional (std::istream &in, const char *label, Type &value)
 Add and read a new optional ScalarParam < Type > object.
template<typename Type>
CArrayParam< Type > & readCArray (std::istream &in, const char *label, Type *value, int n)
 Add and read a required C array parameter.
template<typename Type>
CArrayParam< Type > & readOptionalCArray (std::istream &in, const char *label, Type *value, int n)
 Add and read an optional C array parameter.
template<typename Type>
DArrayParam< Type > & readDArray (std::istream &in, const char *label, DArray< Type > &array, int n)
 Add and read a required DArray < Type > parameter.
template<typename Type>
DArrayParam< Type > & readOptionalDArray (std::istream &in, const char *label, DArray< Type > &array, int n)
 Add and read an optional DArray < Type > parameter.
template<typename Type, int N>
FArrayParam< Type, N > & readFArray (std::istream &in, const char *label, FArray< Type, N > &array)
 Add and read a required FArray < Type, N > array parameter.
template<typename Type, int N>
FArrayParam< Type, N > & readOptionalFArray (std::istream &in, const char *label, FArray< Type, N > &array)
 Add and read an optional FArray < Type, N > array parameter.
template<typename Type, int N>
FSArrayParam< Type, N > & readFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size)
 Add and read a required FSArray < Type, N > array parameter.
template<typename Type, int N>
FSArrayParam< Type, N > & readOptionalFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size)
 Add and read an optional FSArray < Type, N > array parameter.
template<typename Type>
CArray2DParam< Type > & readCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np)
 Add and read a required CArray2DParam < Type > 2D C-array.
template<typename Type>
CArray2DParam< Type > & readOptionalCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np)
 Add and read an optional CArray2DParam < Type > 2D C-array parameter.
template<typename Type>
DMatrixParam< Type > & readDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n)
 Add and read a required DMatrix < Type > matrix parameter.
template<typename Type>
DMatrixParam< Type > & readOptionalDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n)
 Add and read an optional DMatrix < Type > matrix parameter.
template<typename Type>
DSymmMatrixParam< Type > & readDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n)
 Add and read a required symmetrix DMatrix.
template<typename Type>
DSymmMatrixParam< Type > & readOptionalDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n)
 Add and read an optional DMatrix matrix parameter.
BeginreadBegin (std::istream &in, const char *label, bool isRequired=true)
 Add and read a class label and opening bracket.
EndreadEnd (std::istream &in)
 Add and read the closing bracket.
BlankreadBlank (std::istream &in)
 Add and read a new Blank object, representing a blank line.
void loadParamComposite (Serializable::IArchive &ar, ParamComposite &child, bool next=true)
 Add and load a required child ParamComposite.
void loadParamCompositeOptional (Serializable::IArchive &ar, ParamComposite &child, bool next=true)
 Add and load an optional child ParamComposite if isActive.
template<typename Type>
ScalarParam< Type > & loadParameter (Serializable::IArchive &ar, const char *label, Type &value, bool isRequired)
 Add and load a new ScalarParam < Type > object.
template<typename Type>
ScalarParam< Type > & loadParameter (Serializable::IArchive &ar, const char *label, Type &value)
 Add and load new required ScalarParam < Type > object.
template<typename Type>
CArrayParam< Type > & loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n, bool isRequired)
 Add a C array parameter and load its elements.
template<typename Type>
CArrayParam< Type > & loadCArray (Serializable::IArchive &ar, const char *label, Type *value, int n)
 Add and load a required CArrayParam< Type > array parameter.
template<typename Type>
DArrayParam< Type > & loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n, bool isRequired)
 Add an load a DArray < Type > array parameter.
template<typename Type>
DArrayParam< Type > & loadDArray (Serializable::IArchive &ar, const char *label, DArray< Type > &array, int n)
 Add and load a required DArray< Type > array parameter.
template<typename Type, int N>
FArrayParam< Type, N > & loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array, bool isRequired)
 Add and load an FArray < Type, N > fixed-size array parameter.
template<typename Type, int N>
FArrayParam< Type, N > & loadFArray (Serializable::IArchive &ar, const char *label, FArray< Type, N > &array)
 Add and load a required FArray < Type > array parameter.
template<typename Type, int N>
FSArrayParam< Type, N > & loadFSArray (Serializable::IArchive &ar, const char *label, FSArray< Type, N > &array, int size, bool isRequired)
 Add and load an FSArray < Type, N > array parameter.
template<typename Type, int N>
FSArrayParam< Type, N > & loadFSArray (Serializable::IArchive &ar, const char *label, FSArray< Type, N > &array, int size)
 Add and load a required FSArray < Type > array parameter.
template<typename Type>
CArray2DParam< Type > & loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np, bool isRequired)
 Add and load a CArray2DParam < Type > C 2D array parameter.
template<typename Type>
CArray2DParam< Type > & loadCArray2D (Serializable::IArchive &ar, const char *label, Type *value, int m, int n, int np)
 Add and load a required < Type > matrix parameter.
template<typename Type>
DMatrixParam< Type > & loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired)
 Add and load a DMatrixParam < Type > matrix parameter.
template<typename Type>
DMatrixParam< Type > & loadDMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int m, int n)
 Add and load a required DMatrixParam < Type > matrix parameter.
template<typename Type>
DSymmMatrixParam< Type > & loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n, bool isRequired)
 Add and load a symmetric DSymmMatrixParam < Type > matrix parameter.
template<typename Type>
DSymmMatrixParam< Type > & loadDSymmMatrix (Serializable::IArchive &ar, const char *label, DMatrix< Type > &matrix, int n)
 Add and load a required DSymmMatrixParam < Type > matrix parameter.
void addParamComposite (ParamComposite &child, bool next=true)
 Add a child ParamComposite object to the format array.
BeginaddBegin (const char *label)
 Add a Begin object representing a class name and bracket.
EndaddEnd ()
 Add a closing bracket.
BlankaddBlank ()
 Create and add a new Blank object, representing a blank line.
std::string className () const
 Get class name string.
bool isRequired () const
 Is this ParamComposite required in the input file?
bool isActive () const
 Is this parameter active?
Public Member Functions inherited from Util::ParamComponent
virtual ~ParamComponent ()
 Destructor.
void setIndent (const ParamComponent &parent, bool next=true)
 Set indent level.
std::string indent () const
 Return indent string for this object (string of spaces).
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
 Serialize this ParamComponent as a string.
Public Member Functions inherited from Util::Serializable
virtual ~Serializable ()
 Destructor.
Public Member Functions inherited from Util::MpiFileIo
 MpiFileIo ()
 Constructor.
 MpiFileIo (const MpiFileIo &other)
 Copy constructor.
bool isIoProcessor () const
 Can this processor do file I/O ?

Protected Member Functions

virtual void setThreadCount (int nThread)
 Set the number of threads given as a command line argument.
Construction and Destruction
 System (typename T::System &system)
 Constructor.
 ~System ()
 Destructor.
void setClassName (const char *className)
 Set class name string.
void setIsRequired (bool isRequired)
 Set or unset the isActive flag.
void setIsActive (bool isActive)
 Set or unset the isActive flag.
void setParent (ParamComponent &param, bool next=true)
 Set this to the parent of a child component.
void addComponent (ParamComponent &param, bool isLeaf=true)
 Add a new ParamComponent object to the format array.
template<typename Type>
ScalarParam< Type > & add (std::istream &in, const char *label, Type &value, bool isRequired=true)
 Add a new required ScalarParam < Type > object.
template<typename Type>
CArrayParam< Type > & addCArray (std::istream &in, const char *label, Type *value, int n, bool isRequired=true)
 Add (but do not read) a required C array parameter.
template<typename Type>
DArrayParam< Type > & addDArray (std::istream &in, const char *label, DArray< Type > &array, int n, bool isRequired=true)
 Add (but do not read) a DArray < Type > parameter.
template<typename Type, int N>
FArrayParam< Type, N > & addFArray (std::istream &in, const char *label, FArray< Type, N > &array, bool isRequired=true)
 Add (but do not read) a FArray < Type, N > array parameter.
template<typename Type, int N>
FSArrayParam< Type, N > & addFSArray (std::istream &in, const char *label, FSArray< Type, N > &array, int size, bool isRequired=true)
 Add (but do not read) a FSArray < Type, N > array parameter.
template<typename Type>
CArray2DParam< Type > & addCArray2D (std::istream &in, const char *label, Type *value, int m, int n, int np, bool isRequired=true)
 Add (but do not read) a CArray2DParam < Type > 2D C-array.
template<typename Type>
DMatrixParam< Type > & addDMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int m, int n, bool isRequired=true)
 Add and read a required DMatrix < Type > matrix parameter.
Protected Member Functions inherited from Util::ParamComponent
 ParamComponent ()
 Constructor.
 ParamComponent (const ParamComponent &other)
 Copy constructor.

Additional Inherited Members

Public Types inherited from Util::Serializable
typedef BinaryFileOArchive OArchive
 Type of output archive used by save method.
typedef BinaryFileIArchive IArchive
 Type of input archive used by load method.
Static Public Member Functions inherited from Util::ParamComponent
static void initStatic ()
 Initialize static echo member to false.
static void setEcho (bool echo=true)
 Enable or disable echoing for all subclasses of ParamComponent.
static bool echo ()
 Get echo parameter.

Detailed Description

template<int D, class T>
class Pscf::Rp::System< D, T >

Base class template for classes that represent a complete system.

Template parameters and typename aliases:

D - integer dimensionality of space (D=1, 2, or 3) T - "Types" class collection of aliases for other classes

Usage : A specialization of Rp::System<D, T> is used as a base class for each System<D> class defined in the Rpc and Rpg program-level namespaces, for D=1, 2, or 3. In this usage, template parameter T is an instance of a class template named Types that is defined in each of these two namespaces. For example, in the Pscf::Rpc namespace, for each value of D, class Rpc::System<D> is derived from the class Prdc::System< D, Rpc::Types<D> >.

For each such specialization, class T = Types<D> defines a set of typename aliases for classes used in the relevant program-level namespace, for the specified value of D. For example, for each value of D, the typename Rpc::Types<D>Mixture is an alias for the type Rpc::Mixture<D> that used to represent a mixture in the Rpc namespace for systems of spatial dimension D. See the definitions of Rpc::Types and Rpg::Types (src/rpc/system/Types.h and src/rpg/system/Types.h) for lists of all of the typenames defined in these class templates.

In the remainder of this documentation for the Rp::System template, unqualified names such as "Mixture", "Iterator", etc. are used as shorthand for typename aliases such as T::Mixture or T::Iterator that are defined in the types class T (i.e., in Rpc::Types<D> or Rpg::Types<D>), which are aliases for class names such as Rpc::Mixture<D> or Rpg::Iterator<D>.

Class Components : A System object has (among other components):

  • a Mixture (container for polymer and solvent solvers)
  • an Interaction (list of binary interaction parameters)
  • a Domain (description of unit cell and discretization)
  • a CFields container of monomer concentration (c) fields
  • a WFields container of monomer chemical potential (w) fields
  • a WFields container of external (h) fields
  • a Mask field that defines an inhomogeneous density constraint

The container of external fields and the Mask are only needed to describe systems that are subjected to inhomogeneous imposed environments (such as in thin films) and are otherwise left empty and unused. The h().hasData() and mask().hasData() bool functions may be queried to determine if these components are actually in use.

A System may also optionally have:

Each optional component is constructed if and only if the parameter file that is used to initialize the System contains a corresponding optional parameter file block. An Environment is used to generate external and mask fields to describe inhomogeneous environments, and is omitted in standard calculations for structures formed in a homogeneous environment. An Iterator is used for SCFT calculations. A Sweep is used for "sweep" calculations that solve a sequence of SCFT problems along a path through parameter space. A Simulator is only used for PS-FTS calculations, i.e., field theoretic simulations based on a partial saddle-point approximation. The Iterator and Sweep objects is thus normally omitted for PS-FTS calculations, while the Simulator object is normally omitted for SCFT calculations. The hasEnvironment(), hasIterator(), hasSweep(), and hasSimulator() bool member functions may be queried after processing of the parameter file to determine which of these optional components exist.

See also:

Definition at line 116 of file rp/system/System.h.

Constructor & Destructor Documentation

◆ System()

template<int D, class T>
Pscf::Rp::System< D, T >::System ( typename T::System< D, T > & system)
protected

Constructor.

When a specialization of System<D,T> is used as a base class for a subclass defined in the Rpc or Rpg program-level namespace, such as Rpc::System<D>, typename T::System is an alias for the System subclass defined in Rpc or Rpg. In the constructor such a derived class, the relevant instance of the derived class must be passed to the Rp::System<D,T> base class constructor via the standard "this" pointer. The address of this T::System subclass instance is retained in the Rp::System base class instance by a private member variable named systemPtr_ of type T::System*. See definitions of the constructors for the Rpc::System and Rpc::System class templates for examples of this usage.

Parameters
systeminstance of System subclass

Definition at line 44 of file rp/system/System.tpp.

References Util::Signal< T >::addObserver(), clearUnitCellData(), h(), mask(), mixtureModifier(), Util::BracketPolicy::set(), Util::ParamComposite::setClassName(), and w().

◆ ~System()

template<int D, class T>
Pscf::Rp::System< D, T >::~System ( )
protected

Destructor.

Definition at line 155 of file rp/system/System.tpp.

Member Function Documentation

◆ setOptions()

template<int D, class T>
void Pscf::Rp::System< D, T >::setOptions ( int argc,
char ** argv )

Process command line options.

This function takes the same arguments as any C/C++ main program function. The arguments of the "main" function should be passed to this function unaltered, to allow this function to process the command line options passed to the program executable.

Parameters
argcnumber of command line arguments
argvarray of pointers to command line arguments

Definition at line 199 of file rp/system/System.tpp.

Referenced by Pscf::Rpc::run(), and Pscf::Rpg::run().

◆ readParam() [1/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::readParam ( std::istream & in)
virtual

Read input parameters (with opening and closing lines).

Parameters
ininput parameter stream

Reimplemented from Util::ParamComposite.

Definition at line 415 of file rp/system/System.tpp.

References Util::ParamComposite::className(), Util::ParamComposite::readBegin(), Util::ParamComposite::readEnd(), and readParameters().

Referenced by readParam(), Pscf::Rpc::run(), and Pscf::Rpg::run().

◆ readParam() [2/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::readParam ( )

Read input parameters from default param file.

This function reads the parameter file set by the -p command line option.

Definition at line 426 of file rp/system/System.tpp.

References fileMaster(), and readParam().

◆ readParameters()

template<int D, class T>
void Pscf::Rp::System< D, T >::readParameters ( std::istream & in)
virtual

Read body of parameter block (without opening and closing lines).

Parameters
ininput parameter stream

Reimplemented from Util::ParamComposite.

Definition at line 304 of file rp/system/System.tpp.

References Pscf::PolymerModel::isLocked(), Pscf::PolymerModel::nSet(), Util::ParamComposite::readOptional(), Util::ParamComposite::readParamComposite(), and Pscf::PolymerModel::setModel().

Referenced by readParam().

◆ readCommands() [1/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::readCommands ( std::istream & in)

Read and process commands from an input stream.

Parameters
incommand script input stream

Definition at line 433 of file rp/system/System.tpp.

References c(), compute(), Util::Log::file(), iterate(), scft(), setUnitCell(), sweep(), UTIL_CHECK, w(), and waveList().

Referenced by readCommands(), Pscf::Rpc::run(), and Pscf::Rpg::run().

◆ readCommands() [2/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::readCommands ( )

Read and process commands from the default command file.

This function reads the parameter file set by the -c command line option.

Definition at line 807 of file rp/system/System.tpp.

References fileMaster(), readCommands(), and UTIL_THROW.

◆ compute()

template<int D, class T>
void Pscf::Rp::System< D, T >::compute ( bool needStress = false)

Solve the modified diffusion equation once, without iteration.

This function calls the Mixture::compute() function to solve the statistical mechanics problem for a non-interacting system subjected to the currrent system chemical potential fields. This requires solution of the modified diffusion equation for all polymers, computation of Boltzmann weights for all solvents, computation of molecular partition functions for all species, computation of concentration fields for all blocks and solvents, and computation of overall concentrations for all monomer types. This function does not compute the canonical (Helmholtz) free energy or grand-canonical free energy (i.e., pressure).

This function also computes the stress, by calling computeStress(), if and only if the argument needStress is true.

Precondition
w().hasData() == true
Postcondition
c().hasData() == true
hasStress() == true iff needStress == true
Parameters
needStresstrue if stress is needed, false otherwise

Definition at line 821 of file rp/system/System.tpp.

References c(), clearCFields(), computeStress(), environment(), hasEnvironment(), mask(), scft(), UTIL_CHECK, and w().

Referenced by readCommands().

◆ computeStress()

template<int D, class T>
void Pscf::Rp::System< D, T >::computeStress ( )

Compute SCFT stress.

This function computes the standard definition of stress maintained by the Mixture class. If an Environment exists, it also allows the Environment to compute a modified definition of the stress.

Precondition
w().hasData() == true
c().hasData() == true
Postcondition
hasStress() == true

Definition at line 861 of file rp/system/System.tpp.

References environment(), hasEnvironment(), iterator(), and mask().

Referenced by compute(), and iterate().

◆ iterate()

template<int D, class T>
int Pscf::Rp::System< D, T >::iterate ( bool isContinuation = false)

Iteratively solve a SCFT problem.

This function calls the iterator to solve the SCFT problem for the current system parameters, using the current chemical potential fields and unit cell parameters as initial guesses. Upon exit, c().hasData() == true whether or not convergence is obtained to within the desired tolerance, but the SCFT Helmholtz free energy and pressure are computed only if convergence is successful.

Precondition
hasIterator() == true
w().hasData() == true
w().isSymmetric() == true if the iterator is symmetric
Postcondition
c().hasData() == true
scft().hasData() == true upon successful convergence
Returns
returns 0 for successful convergence, 1 for failure
Parameters
isContinuationtrue if a continuation within a sweep

Definition at line 881 of file rp/system/System.tpp.

References c(), clearCFields(), computeStress(), environment(), Util::Log::file(), hasEnvironment(), hasIterator(), iterator(), scft(), UTIL_CHECK, and w().

Referenced by readCommands().

◆ sweep()

template<int D, class T>
void Pscf::Rp::System< D, T >::sweep ( )

Sweep in parameter space, solving an SCF problem at each point.

This function uses a Sweep object that was initialized in the parameter file to solve the SCFT problem at a sequence of points along a path in parameter space. The nature of this sequence is determined by implementation of a subclass of Sweep and the parameters passed to the sweep object in the parameter file.

Precondition
hasSweep() == true
All preconditions of the iterate() function must be satisfied

Definition at line 928 of file rp/system/System.tpp.

References Util::Log::file(), hasIterator(), hasSweep(), iterator(), UTIL_CHECK, and w().

Referenced by readCommands().

◆ simulate()

template<int D, class T>
void Pscf::Rp::System< D, T >::simulate ( int nStep)

Perform a field theoretic simulation (PS-FTS).

Perform a field theoretic simulation using the partial saddle-point approximation (PS-FTS). The type of simulation (BD or MC) is determined by the type of Simulator (BdSimulator or McSimulator) that is created in the parameter file. The number of BD steps or attempted MC moves to be performed is given by the parameter "nStep".

Precondition
Function hasSimulator() == true
Function w().hasData() == true
Parameters
nStepnumber of simulation (BD or MC) steps

Definition at line 950 of file rp/system/System.tpp.

References clearCFields(), hasSimulator(), simulator(), and UTIL_CHECK.

◆ clearCFields()

template<int D, class T>
void Pscf::Rp::System< D, T >::clearCFields ( )

Mark c-fields and free energy as outdated or invalid.

This function should be called whenever any of the inputs to the solution of the modified diffusion equation are modified, including the w fields, unit cell parameters, external fields, or mask. Upon return, c().hasData(), scft().hasData(), and mixture().hasStress() will all return false. If the system has an Environment, then environment().needsUpdate() will also return true.

Definition at line 963 of file rp/system/System.tpp.

References scft().

Referenced by clearUnitCellData(), compute(), iterate(), Pscf::Rp::System< D >::readParam(), Pscf::Rp::System< D >::setOptions(), and simulate().

◆ setUnitCell() [1/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::setUnitCell ( UnitCell< D > const & unitCell)

Set parameters of the associated unit cell.

The lattice (i.e., lattice system type) set in the UnitCell<D> input parameter must agree with a lattice enum value that was set previously in the parameter file.

If a space group has been declared but a basis has not yet been initialized, then a symmetry-adapted basis will be constructed.

Parameters
unitCellnew UnitCell<D> (with new parameters)

Definition at line 975 of file rp/system/System.tpp.

References UTIL_CHECK, and waveList().

Referenced by readCommands().

◆ setUnitCell() [2/2]

template<int D, class T>
void Pscf::Rp::System< D, T >::setUnitCell ( FSArray< double, 6 > const & parameters)

Set parameters of the associated unit cell.

The lattice type must have been set before this function is called. The logical size of the FSArray<double, 6> "parameters" array must match the expected number of parameters for the current lattice type.

If a space group has been declared but a basis has not yet been initialized, then a symmetry-adapted basis will be constructed.

Parameters
parametersarray of new unit cell parameters

Definition at line 1003 of file rp/system/System.tpp.

References UTIL_CHECK, and waveList().

◆ clearUnitCellData()

template<int D, class T>
void Pscf::Rp::System< D, T >::clearUnitCellData ( )

Notify System members that unit cell parameters have been modified.

This function should be called whenever the unit cell parameters are modified. It calls functions mixture().clearUnitCellData(), wavelist().clearUnitCellData(), clearCFields(), and, if an Environment exists, environment().reset().

Definition at line 1034 of file rp/system/System.tpp.

References clearCFields(), environment(), and hasEnvironment().

Referenced by System().

◆ c()

template<int D, class T>
T::CFields const & Pscf::Rp::System< D, T >::c ( ) const
inline

Get the monomer concentration (c) fields (const).

Definition at line 786 of file rp/system/System.h.

Referenced by compute(), iterate(), and readCommands().

◆ w() [1/2]

template<int D, class T>
T::WFields const & Pscf::Rp::System< D, T >::w ( ) const
inline

Get the chemical potential (w) fields (const).

Definition at line 791 of file rp/system/System.h.

Referenced by compute(), iterate(), readCommands(), sweep(), and System().

◆ w() [2/2]

template<int D, class T>
T::WFields & Pscf::Rp::System< D, T >::w ( )
inline

Get the chemical potential (w) fields (non-const).

Definition at line 796 of file rp/system/System.h.

◆ h() [1/2]

template<int D, class T>
T::WFields const & Pscf::Rp::System< D, T >::h ( ) const
inline

Get the external potential (h) fields (const).

Definition at line 801 of file rp/system/System.h.

Referenced by System().

◆ h() [2/2]

template<int D, class T>
T::WFields & Pscf::Rp::System< D, T >::h ( )
inline

Get the external potential (h) fields (non-const).

Definition at line 806 of file rp/system/System.h.

◆ mask() [1/2]

template<int D, class T>
T::Mask const & Pscf::Rp::System< D, T >::mask ( ) const
inline

Get the mask (const).

Definition at line 811 of file rp/system/System.h.

Referenced by compute(), computeStress(), and System().

◆ mask() [2/2]

template<int D, class T>
T::Mask & Pscf::Rp::System< D, T >::mask ( )
inline

Get the mask (non-const).

Definition at line 816 of file rp/system/System.h.

◆ mixture()

template<int D, class T>
T::Mixture const & Pscf::Rp::System< D, T >::mixture ( ) const
inline

Get the Mixture (const).

Definition at line 745 of file rp/system/System.h.

Referenced by writeParamNoSweep().

◆ mixtureModifier()

template<int D, class T>
T::MixtureModifier & Pscf::Rp::System< D, T >::mixtureModifier ( )
inline

Get the MixtureModifier (non-const).

Definition at line 750 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by System().

◆ interaction() [1/2]

template<int D, class T>
T::Interaction const & Pscf::Rp::System< D, T >::interaction ( ) const
inline

Get the Interaction (const).

Definition at line 758 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by writeParamNoSweep().

◆ interaction() [2/2]

template<int D, class T>
T::Interaction & Pscf::Rp::System< D, T >::interaction ( )
inline

Get the Interaction (non-const).

Definition at line 766 of file rp/system/System.h.

References UTIL_ASSERT.

◆ domain()

template<int D, class T>
T::Domain const & Pscf::Rp::System< D, T >::domain ( ) const
inline

Get the Domain (const).

Definition at line 774 of file rp/system/System.h.

Referenced by writeParamNoSweep().

◆ waveList()

template<int D, class T>
T::WaveList & Pscf::Rp::System< D, T >::waveList ( )
inline

Get the WaveList (non-const).

This function provides direct non-const access to the WaveList. The WaveList is owned by the Domain, and const (i.e., read-only) access is also provided via the domain() member function. This function exists to allow access to non-const member functions that update data structures that are maintained by the WaveList via a reference to the parent system.

Definition at line 779 of file rp/system/System.h.

Referenced by readCommands(), setUnitCell(), and setUnitCell().

◆ hasEnvironment()

template<int D, class T>
bool Pscf::Rp::System< D, T >::hasEnvironment ( ) const
inline

Does this system have an Environment?

Definition at line 823 of file rp/system/System.h.

Referenced by clearUnitCellData(), compute(), computeStress(), iterate(), and writeParamNoSweep().

◆ environment() [1/2]

template<int D, class T>
T::Environment const & Pscf::Rp::System< D, T >::environment ( ) const
inline

Get the Environment (const).

Definition at line 828 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by clearUnitCellData(), compute(), computeStress(), iterate(), and writeParamNoSweep().

◆ environment() [2/2]

template<int D, class T>
T::Environment & Pscf::Rp::System< D, T >::environment ( )
inline

Get the Environment (non-const).

Definition at line 836 of file rp/system/System.h.

References UTIL_ASSERT.

◆ scft() [1/2]

template<int D, class T>
T::ScftThermo const & Pscf::Rp::System< D, T >::scft ( ) const
inline

Get the ScftThermo object (const).

Definition at line 844 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by clearCFields(), compute(), iterate(), and readCommands().

◆ scft() [2/2]

template<int D, class T>
T::ScftThermo & Pscf::Rp::System< D, T >::scft ( )
inline

Get the ScftThermo object (non-const).

Definition at line 852 of file rp/system/System.h.

References UTIL_ASSERT.

◆ hasIterator()

template<int D, class T>
bool Pscf::Rp::System< D, T >::hasIterator ( ) const
inline

Does this system have an Iterator?

Definition at line 860 of file rp/system/System.h.

Referenced by clearTimers(), iterate(), sweep(), writeParamNoSweep(), and writeTimers().

◆ iterator() [1/2]

template<int D, class T>
T::Iterator const & Pscf::Rp::System< D, T >::iterator ( ) const
inline

Get the Iterator (const).

Definition at line 865 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by clearTimers(), computeStress(), iterate(), sweep(), writeParamNoSweep(), and writeTimers().

◆ iterator() [2/2]

template<int D, class T>
T::Iterator & Pscf::Rp::System< D, T >::iterator ( )
inline

Get the Iterator (non-const).

Definition at line 873 of file rp/system/System.h.

References UTIL_ASSERT.

◆ hasSweep()

template<int D, class T>
bool Pscf::Rp::System< D, T >::hasSweep ( ) const
inline

Does this system have a Sweep?

Definition at line 881 of file rp/system/System.h.

Referenced by sweep().

◆ hasSimulator()

template<int D, class T>
bool Pscf::Rp::System< D, T >::hasSimulator ( ) const
inline

Does this system have a Simulator?

Definition at line 886 of file rp/system/System.h.

Referenced by clearTimers(), simulate(), and writeTimers().

◆ simulator() [1/2]

template<int D, class T>
T::Simulator const & Pscf::Rp::System< D, T >::simulator ( ) const
inline

Get the Simulator (const).

Definition at line 891 of file rp/system/System.h.

References UTIL_ASSERT.

Referenced by clearTimers(), simulate(), and writeTimers().

◆ simulator() [2/2]

template<int D, class T>
T::Simulator & Pscf::Rp::System< D, T >::simulator ( )
inline

Get the Simulator (non-const).

Definition at line 899 of file rp/system/System.h.

References UTIL_ASSERT.

◆ fileMaster() [1/2]

template<int D, class T>
FileMaster const & Pscf::Rp::System< D, T >::fileMaster ( ) const
inline

Get the FileMaster (const).

Definition at line 907 of file rp/system/System.h.

Referenced by readCommands(), and readParam().

◆ fileMaster() [2/2]

template<int D, class T>
FileMaster & Pscf::Rp::System< D, T >::fileMaster ( )
inline

Get the FileMaster (non-const).

Access (non-const) is used in some unit tests.

Definition at line 912 of file rp/system/System.h.

◆ writeParamNoSweep()

template<int D, class T>
void Pscf::Rp::System< D, T >::writeParamNoSweep ( std::ostream & out) const

Write partial parameter file to an ostream.

This function writes the Mixture, Interaction, and Domain blocks of a parameter file, as well as any Environment and Iterator blocks, but omits any Sweep or Simulator blocks. The intent is to produce an output during an SCFT sweep that only refers to parameters relevant to a single state point, in a form that could be used as a parameter file for a single SCFT calculation.

Parameters
outoutput stream

Definition at line 1050 of file rp/system/System.tpp.

References domain(), environment(), hasEnvironment(), hasIterator(), interaction(), iterator(), and mixture().

◆ writeTimers()

template<int D, class T>
void Pscf::Rp::System< D, T >::writeTimers ( std::ostream & out) const

Write timer information to an output stream.

Parameters
outoutput stream

Definition at line 1071 of file rp/system/System.tpp.

References Util::Log::file(), hasIterator(), hasSimulator(), iterator(), and simulator().

◆ clearTimers()

template<int D, class T>
void Pscf::Rp::System< D, T >::clearTimers ( )

Clear all timers.

Definition at line 1087 of file rp/system/System.tpp.

References hasIterator(), hasSimulator(), iterator(), and simulator().

◆ setThreadCount()

template<int D, class T>
virtual void Pscf::Rp::System< D, T >::setThreadCount ( int nThread)
inlineprotectedvirtual

Set the number of threads given as a command line argument.

This function is called in the setOpts function that processes command line arguments. The argument nThread may be passed to the main program as the argument of the -t option. This value gives the number of threads in a threaded CPU implementation or an explicit choice for the maximum number of threads per block in GPU code.

The do-nothing default implementation is used by CPU code that has not implemented threading (the current status).

Parameters
nThreadthread count

Reimplemented in Pscf::Rpg::System< D >.

Definition at line 563 of file rp/system/System.h.


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