PSCF v1.3.1
Pscf::Prdc::SystemTmpl< D, T > Class Template Reference

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

#include <SystemTmpl.h>

Inheritance diagram for Pscf::Prdc::SystemTmpl< D, T >:
Util::ParamComposite Util::ParamComponent Util::Serializable Util::MpiFileIo

Public Member Functions

Construction and Destruction
 SystemTmpl (typename T::System &system)
 Constructor.
 ~SystemTmpl ()
 Destructor.
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 & w ()
 Get the chemical potential (w) fields (non-const).
T::WFields const & w () const
 Get the chemical potential (w) fields (const).
T::WFields & h ()
 Get the external potential (h) fields (non-const).
T::WFields const & h () const
 Get the external potential (h) fields (const).
T::Mask & mask ()
 Get the mask (non-const).
T::Mask const & mask () const
 Get the mask (const).
Component Object Accessors
T::Mixture const & mixture () const
 Get the Mixture (const).
T::MixtureModifier & mixtureModifier ()
 Get the MixtureModifier (non-const).
T::Interaction & interaction ()
 Get the Interaction (non-const).
T::Interaction const & interaction () const
 Get the Interaction (const).
T::Domain const & domain () const
 Get the Domain (const).
bool hasEnvironment () const
 Does this system have an Environment?
T::Environment & environment ()
 Get the Environment (non-const).
T::Environment const & environment () const
 Get the Environment (const).
T::ScftThermo & scft ()
 Get the ScftThermo object (non-const).
T::ScftThermo const & scft () const
 Get the ScftThermo object (const).
bool hasIterator () const
 Does this system have an Iterator?
T::Iterator & iterator ()
 Get the Iterator (non-const).
T::Iterator const & iterator () const
 Get the Iterator (const).
bool hasSweep () const
 Does this system have a Sweep?
bool hasSimulator () const
 Does this system have a Simulator?
T::Simulator & simulator ()
 Get the Simulator (non-const).
T::Simulator const & simulator () const
 Get the Simulator (const).
FileMasterfileMaster ()
 Get the FileMaster (non-const).
FileMaster const & fileMaster () const
 Get the FileMaster (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 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.
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::Prdc::SystemTmpl< 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 SystemTmpl<D, T> is a base class for each System<D> class defined in namespaces Rpc and Rpg, for D=1, 2, or 3. In this use, template parameter T is taken to be an instance of a template <int D> class Types that is defined in each of these two namespaces. For example, in namespace Rpc, for each value of D, class Rpc::System<D> is derived from class Prdc::SystemTmpl< D, Rpc::Types<D> >. For each such instance, Types<D> defines a set of typename aliases for classes used in the relevant namespace, for the specified value of D. For example, the typename Rpc::Types<D>::Mixture is an alias for the type Rpc::Mixture<D> used to represent a mixture in the Rpc namespace for systems of dimension D. See the definitions of Rpc::Types and Rpg::Types for lists of all of the typenames defined in these two class templates.

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

Class Components : A SystemTmpl 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 WFields container of monomer chemical potential (w) fields
  • a CFields container of monomer concentration (c) 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 in inhomgeneous imposed environements (such as in thin films) and are otherwise left empty and unused.

A SystemTmpl may also optionally have:

  • an Environment
  • an Iterator
  • a Sweep,
  • a Simulator

Optional components are constructed when the parameter file is read only if corresponding optional parameter file blocks are present. The Environment is only used to generate external and mask fields to describe inhomogeneos environments, and is omitted in standard calculations of structures formed in a homogeneous environment. Iterator and Sweep objects are only used for SCFT calculations. A Simulator is only used for PS-FTS calculations, for, i.e., field theoretic simulations based on a partial saddle-point approximation.

See also:

Definition at line 100 of file SystemTmpl.h.

Constructor & Destructor Documentation

◆ SystemTmpl()

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

Constructor.

When an instance of SystemTmpl<D,T> is used as a base class for a concrete system class, such as Rpc::System<D>, typename T::System must be the name of this resulting subclass. In this usage, in the member initialization list of the T::System subclass constructor,
a reference to the subclass instance should be passed as "*this" to this SystemTmpl base class constructor. The address of the instance of the T::System subclass is then retained in the SystemTmpl by by private member variable of type T::System* (named systemPtr_). See definitions of constructors for the Rpc::System and Rpc::System class templates for this usage.

Parameters
systeminstance of System subclass

Definition at line 37 of file SystemTmpl.tpp.

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

◆ ~SystemTmpl()

template<int D, class T>
Pscf::Prdc::SystemTmpl< D, T >::~SystemTmpl ( )

Destructor.

Definition at line 135 of file SystemTmpl.tpp.

Member Function Documentation

◆ setOptions()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 d be passed to this function unaltered, to allow this function to process the command line options.

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

Definition at line 175 of file SystemTmpl.tpp.

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

◆ readParam() [1/2]

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 380 of file SystemTmpl.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::Prdc::SystemTmpl< 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 391 of file SystemTmpl.tpp.

References readParam().

◆ readParameters()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 280 of file SystemTmpl.tpp.

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

Referenced by readParam().

◆ readCommands() [1/2]

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

Read and process commands from an input stream.

Parameters
incommand script input stream

Definition at line 398 of file SystemTmpl.tpp.

References compute(), Util::Log::file(), hasSimulator(), iterate(), scft(), setUnitCell(), simulate(), simulator(), sweep(), UTIL_CHECK, w(), and writeParamNoSweep().

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

◆ readCommands() [2/2]

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 772 of file SystemTmpl.tpp.

References readCommands(), and UTIL_THROW.

◆ compute()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 786 of file SystemTmpl.tpp.

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

Referenced by readCommands().

◆ computeStress()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 826 of file SystemTmpl.tpp.

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

Referenced by compute(), and iterate().

◆ iterate()

template<int D, class T>
int Pscf::Prdc::SystemTmpl< 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 846 of file SystemTmpl.tpp.

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

Referenced by readCommands().

◆ sweep()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 893 of file SystemTmpl.tpp.

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

Referenced by readCommands().

◆ simulate()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 915 of file SystemTmpl.tpp.

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

Referenced by readCommands().

◆ clearCFields()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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, environment().needsUpdate() will return true.

Definition at line 928 of file SystemTmpl.tpp.

References scft().

Referenced by clearUnitCellData(), compute(), iterate(), simulate(), and SystemTmpl().

◆ setUnitCell() [1/2]

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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> unitCell input parameter must agree with the 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 940 of file SystemTmpl.tpp.

References UTIL_CHECK.

Referenced by readCommands().

◆ setUnitCell() [2/2]

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 968 of file SystemTmpl.tpp.

References UTIL_CHECK.

◆ clearUnitCellData()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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(), domain().wavelist().clearUnitCellData(), clearCFields(), and, if an Environment exists, environment().reset().

Definition at line 999 of file SystemTmpl.tpp.

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

Referenced by SystemTmpl().

◆ c()

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

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

Definition at line 839 of file SystemTmpl.h.

◆ w() [1/2]

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

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

Definition at line 844 of file SystemTmpl.h.

Referenced by readCommands().

◆ w() [2/2]

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

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

Definition at line 849 of file SystemTmpl.h.

◆ h() [1/2]

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

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

Definition at line 854 of file SystemTmpl.h.

◆ h() [2/2]

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

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

Definition at line 859 of file SystemTmpl.h.

◆ mask() [1/2]

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

Get the mask (non-const).

Definition at line 864 of file SystemTmpl.h.

Referenced by computeStress().

◆ mask() [2/2]

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

Get the mask (const).

Definition at line 869 of file SystemTmpl.h.

◆ mixture()

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

Get the Mixture (const).

Definition at line 711 of file SystemTmpl.h.

Referenced by computeStress(), and iterate().

◆ mixtureModifier()

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

Get the MixtureModifier (non-const).

Definition at line 716 of file SystemTmpl.h.

References UTIL_ASSERT.

Referenced by SystemTmpl().

◆ interaction() [1/2]

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

Get the Interaction (non-const).

Definition at line 724 of file SystemTmpl.h.

References UTIL_ASSERT.

Referenced by writeParamNoSweep().

◆ interaction() [2/2]

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

Get the Interaction (const).

Definition at line 732 of file SystemTmpl.h.

References UTIL_ASSERT.

◆ domain()

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

Get the Domain (const).

Definition at line 740 of file SystemTmpl.h.

◆ hasEnvironment()

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

Does this system have an Environment?

Definition at line 745 of file SystemTmpl.h.

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

◆ environment() [1/2]

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

Get the Environment (non-const).

Definition at line 750 of file SystemTmpl.h.

References UTIL_ASSERT.

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

◆ environment() [2/2]

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

Get the Environment (const).

Definition at line 758 of file SystemTmpl.h.

References UTIL_ASSERT.

◆ scft() [1/2]

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

Get the ScftThermo object (non-const).

Definition at line 766 of file SystemTmpl.h.

References UTIL_ASSERT.

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

◆ scft() [2/2]

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

Get the ScftThermo object (const).

Definition at line 774 of file SystemTmpl.h.

References UTIL_ASSERT.

◆ hasIterator()

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

Does this system have an Iterator?

Definition at line 782 of file SystemTmpl.h.

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

◆ iterator() [1/2]

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

Get the Iterator (non-const).

Definition at line 787 of file SystemTmpl.h.

References UTIL_ASSERT.

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

◆ iterator() [2/2]

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

Get the Iterator (const).

Definition at line 795 of file SystemTmpl.h.

References UTIL_ASSERT.

◆ hasSweep()

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

Does this system have a Sweep?

Definition at line 803 of file SystemTmpl.h.

Referenced by sweep().

◆ hasSimulator()

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

Does this system have a Simulator?

Definition at line 808 of file SystemTmpl.h.

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

◆ simulator() [1/2]

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

Get the Simulator (non-const).

Definition at line 813 of file SystemTmpl.h.

References UTIL_ASSERT.

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

◆ simulator() [2/2]

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

Get the Simulator (const).

Definition at line 821 of file SystemTmpl.h.

References UTIL_ASSERT.

◆ fileMaster() [1/2]

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

Get the FileMaster (non-const).

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

Definition at line 829 of file SystemTmpl.h.

◆ fileMaster() [2/2]

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

Get the FileMaster (const).

Definition at line 834 of file SystemTmpl.h.

◆ writeParamNoSweep()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< 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 1015 of file SystemTmpl.tpp.

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

Referenced by readCommands().

◆ writeTimers()

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

Write timer information to an output stream.

Parameters
outoutput stream

Definition at line 1036 of file SystemTmpl.tpp.

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

◆ clearTimers()

template<int D, class T>
void Pscf::Prdc::SystemTmpl< D, T >::clearTimers ( )

Clear timers.

Definition at line 1052 of file SystemTmpl.tpp.

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

◆ setThreadCount()

template<int D, class T>
virtual void Pscf::Prdc::SystemTmpl< 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 543 of file SystemTmpl.h.


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