PSCF v1.4.0

Base class for field theoretic PS-FTS simulator. More...

#include <Simulator.h>

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

Public Types

using RFieldT = typename T::RField
 Container for a real-valued periodic field.
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.

Public Member Functions

Initialization
virtual void readParameters (std::istream &in)
 Read parameters for a simulation.
void allocate ()
 Allocate required memory during initialization.
Primary Actions: Simulation and Analysis
virtual void simulate (int nStep)
 Perform a field theoretic Monte-Carlo simulation.
virtual void analyze (int min, int max, std::string classname, std::string filename)
 Read and analyze a trajectory file.
void clearData ()
 Clear field eigen-components and Hamiltonian components.
Timers and Counters
virtual void outputTimers (std::ostream &out) const
 Output timing results.
virtual void outputMdeCounter (std::ostream &out) const
 Output MDE counter.
virtual void clearTimers ()
 Clear timers.
long iStep ()
 Return the current converged simulation step index.
long iTotalStep ()
 Return the current simulation step index.
Projected Chi Matrix
void analyzeChi ()
 Perform eigenvalue analysis of projected chi matrix.
DArray< double > const & chiEvals () const
 Get an array of the eigenvalues of the projected chi matrix.
double chiEval (int a) const
 Get a single eigenvalue of the projected chi matrix.
DMatrix< double > const & chiEvecs () const
 Get the matrix of all eigenvectors of the projected chi matrix.
double chiEvecs (int a, int i) const
 Get one element of an eigenvector of the projected chi matrix.
DArray< double > const & sc () const
 Get all components of the vector S.
double sc (int a) const
 Get a single component of the S vector.
Field Theoretic Hamiltonian
void computeHamiltonian ()
 Compute the Hamiltonian used in PS-FTS.
double hamiltonian () const
 Get the Hamiltonian used in PS-FTS.
double idealHamiltonian () const
 Get an ideal contribution to the Hamiltonian.
double fieldHamiltonian () const
 Get the quadratic field contribution to the Hamiltonian.
double perturbationHamiltonian () const
 Get a perturbation to the standard Hamiltonian.
bool hasHamiltonian () const
 Has the Hamiltonian been computed for the current w and c fields?
Chemical Potential Field (W Field) Components
void computeWc ()
 Compute eigenvector components of the current w fields.
DArray< RFieldT > const & wc () const
 Get all eigenvector components of the current w fields.
RFieldT const & wc (int a) const
 Get one eigenvector component of the current w fields.
bool hasWc () const
 Are eigen-components of the current w fields valid ?
Monomer Concentration Field (C-Field) Components
void computeCc ()
 Compute eigenvector components of the current c fields.
DArray< RFieldT > const & cc () const
 Get all eigenvector components of the current c fields.
RFieldT const & cc (int a) const
 Get one eigenvector component of the current c fields.
bool hasCc () const
 Are eigen-components of the current c fields valid ?
Functional Derivatives of H[W]
void computeDc ()
 Compute functional derivatives of the Hamiltonian.
DArray< RFieldT > const & dc () const
 Get all of the current d fields.
RFieldT const & dc (int i) const
 Get one eigenvector component of the current d fields.
bool hasDc () const
 Are the current d fields valid ?
Save and Restore State
void saveState ()
 Save a copy of the current system state.
void restoreState ()
 Restore the system to the saved state.
void clearState ()
 Clear the saved copy of the system state.
Miscellaneous (Accessors and Boolean Flags)
T::System & system ()
 Get the parent system by reference.
Randomrandom ()
 Get the scalar random number generator by reference.
T::VecRandom & vecRandom ()
 Get the vector random number generator by reference.
bool hasCompressor () const
 Does this Simulator have a Compressor?
T::Compressor const & compressor () const
 Get the Compressor by const reference.
T::Compressor & compressor ()
 Get the Compressor by non-const reference.
bool hasPerturbation () const
 Does this Simulator have a Perturbation?
T::Perturbation const & perturbation () const
 Get a Perturbation by const reference.
T::Perturbation & perturbation ()
 Get a Perturbation by non-const reference.
bool hasRamp () const
 Does this Simulator have a Ramp?
T::Ramp const & ramp () const
 Get a Ramp by const reference.
T::Ramp & ramp ()
 Get a Ramp by non-const reference.
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 readParam (std::istream &in)
 Read the parameter file block.
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

 Simulator (typename T::System &system, typename T::Simulator &simulator)
 Constructor.
 ~Simulator ()
 Destructor.
void readRandomSeed (std::istream &in)
 Optionally read a random seed and initialize RNGs.
virtual void initializeVecRandom ()
 Initialize the vector RNG.
T::CompressorFactory & compressorFactory ()
 Get the Compressor factory by reference.
void readCompressor (std::istream &in, bool &isEnd)
 Optionally read a Compressor parameter file block.
T::PerturbationFactory & perturbationFactory ()
 Get the Perturbation factory by reference.
void readPerturbation (std::istream &in, bool &isEnd)
 Optionally read a Perturbation parameter file block.
void setPerturbation (typename T::Perturbation *ptr)
 Set the associated Perturbation.
T::RampFactory & rampFactory ()
 Get the Ramp factory by reference.
void readRamp (std::istream &in, bool &isEnd)
 Optionally read a Ramp parameter file block.
void setRamp (typename T::Ramp *ptr)
 Set the associated Ramp.
T::SimState & state ()
 Get the SimState stored internal state by reference.
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.

Protected Attributes

DArray< RFieldTwc_
 Eigenvector components of w fields on a real space grid.
DArray< RFieldTcc_
 Eigenvector components of c fields on a real space grid.
DArray< RFieldTdc_
 Components of d fields on a real space grid.
T::SimState state_
 Previous state saved at the beginning of a step.
double hamiltonian_
 Total field theoretic Hamiltonian H[W] (extensive value).
double idealHamiltonian_
 Ideal gas contribution (-lnQ) to Hamiltonian.
double fieldHamiltonian_
 Quadratic field contribution to Hamiltonian.
double perturbationHamiltonian_
 Perturbation contribution to the Hamiltonian.
long iStep_
 Step counter - number of steps for which the compressor converged.
long iTotalStep_
 Step counter - total number of attempted BD or MC steps.
long seed_
 Random number generator seed (input value).
bool hasHamiltonian_
 Has the Hamiltonian been computed for the current w and c fields?
bool hasWc_
 Have eigen-components of the current w fields been computed ?
bool hasCc_
 Have eigen-components of the current c fields been computed ?
bool hasDc_
 Have functional derivatives of H[W] been computed ?

Additional Inherited Members

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::Simulator< D, T >

Base class for field theoretic PS-FTS simulator.

Purpose : A Simulator base class provides tools needed in field-theoretic simulations that are based on a partial saddle-point approximation. In the Rpc and Rpg program-level namespaces, subclasses designed for field theoretic Monte Carlo (MC) and Brownian dynamics (BD) simulations, named McSimulator and BdSimulator, provide more specialized algorithms and data structures needed by these two sampling methods.

The Simulator class provides functions to compute and diagonalize a projected chi matrix, functions to access components of several types of fields in a basis of eigenvectors of the projected chi matrix, and functions to compute and return contributions to the field theoretic Hamiltonian and its components.

The analyzeChi function constructs and diagonalizes the projected chi matrix. This is a singular nMonomer x nMonomer matrix defined by evaluating the orthogonal projection of the chi matrix into the subspace of fluctuations that preserves total monomer concentration. The eigenvalues and eigenvectors of this matrix are accessed via the chiEvals and chiEvecs functions, respectively.

The functions computeWc, computeCc and computeDc compute components of various types of multi-component fields (i.e., fields that are associated with a monomer type index) in a basis of eigenvectors of the projected chi matrix. Names such as wc, cc and dc that end with a suffix "c" refer to components of multi-component fields that are defined using this eigenvector basis.

Usage : A specialization of Rp::Simulator<D, T> serves as a base class for for each Simulation<D> class defined in namespaces Rpc and Rpg, for D=1, 2 and 3. In this usage, template parameter T is an instance of a template <int D> class Types that is defined in each of these two program-level namespaces, and that defines a set of typename aliases for classes used in each such namespace, for the relevant value of D.

Template parameters and typename aliases :

D - integer dimensionality of space (D=1, 2, or 3) T - Types class, Rpc::Types<D> or Rpg::Types<D>)

See also
BdSimulator (manual page)
McSimulator (manual page)

Definition at line 73 of file rp/fts/simulator/Simulator.h.

Member Typedef Documentation

◆ RFieldT

template<int D, class T>
using Pscf::Rp::Simulator< D, T >::RFieldT = typename T::RField

Container for a real-valued periodic field.

Definition at line 79 of file rp/fts/simulator/Simulator.h.

Constructor & Destructor Documentation

◆ Simulator()

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

Constructor.

Parameters
systemparent System
simulatorenclosing instance of a subclass

Definition at line 30 of file rp/fts/simulator/Simulator.tpp.

References fieldHamiltonian_, hamiltonian_, hasCc_, hasDc_, hasHamiltonian_, hasWc_, idealHamiltonian_, iStep_, iTotalStep_, perturbationHamiltonian_, seed_, Util::ParamComposite::setClassName(), and system().

◆ ~Simulator()

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

Destructor.

Definition at line 68 of file rp/fts/simulator/Simulator.tpp.

Member Function Documentation

◆ readParameters()

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

Read parameters for a simulation.

The default implementation reads an optional random seed, an optional Compressor block, an optional Perturbation, and an optional Ramp, in that order. This default is intended to be used only for unit testing.

Parameters
ininput parameter stream

Reimplemented from Util::ParamComposite.

Definition at line 138 of file rp/fts/simulator/Simulator.tpp.

◆ allocate()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::allocate ( )

Allocate required memory during initialization.

Values of nMonomer and the mesh dimensions must be defined in Mixture and Domain members of the parent System on entry. This function should be called by the readParameters method of any subclass. Made public to allow use in unit tests.

Definition at line 94 of file rp/fts/simulator/Simulator.tpp.

◆ simulate()

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

Perform a field theoretic Monte-Carlo simulation.

Perform a field theoretic simulation of nSteps using the partial saddle-point approximation.

The default implemention is a do-nothing placeholder that throws an error if called, and must be overridden by subclasses.

Parameters
nStepnumber of simulation steps

Definition at line 159 of file rp/fts/simulator/Simulator.tpp.

References UTIL_THROW.

◆ analyze()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::analyze ( int min,
int max,
std::string classname,
std::string filename )
virtual

Read and analyze a trajectory file.

This function uses an instance of the TrajectoryReader class specified by the "classname" argument to read a trajectory file with the specified filename. The function opens the file, performs the analysis, and closes the file before returning.

The default implemention is a do-nothing placeholder that throws an error if called, and must be overridden by subclasses.

Parameters
minfirst frame number
maxlast frame number
classnamename of TrajectoryReader class
filenamename of trajectory file

Definition at line 166 of file rp/fts/simulator/Simulator.tpp.

References UTIL_THROW.

◆ clearData()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::clearData ( )

Clear field eigen-components and Hamiltonian components.

On return from this function, hasHamiltonian(), hasWc(), hasCc(), and hasDc() will all return false.

Definition at line 175 of file rp/fts/simulator/Simulator.tpp.

References hasCc_, hasDc_, hasHamiltonian_, and hasWc_.

◆ outputTimers()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::outputTimers ( std::ostream & out) const
virtual

Output timing results.

Empty default implementation.

Parameters
outoutput stream

Definition at line 668 of file rp/fts/simulator/Simulator.tpp.

◆ outputMdeCounter()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::outputMdeCounter ( std::ostream & out) const
virtual

Output MDE counter.

Output the number of times the modified diffusion equation has been solved.

Parameters
outoutput stream

Definition at line 679 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

◆ clearTimers()

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

Clear timers.

Empty default implementation.

Definition at line 691 of file rp/fts/simulator/Simulator.tpp.

◆ iStep()

template<int D, class T>
long Pscf::Rp::Simulator< D, T >::iStep ( )
inline

Return the current converged simulation step index.

Definition at line 1133 of file rp/fts/simulator/Simulator.h.

References iStep_.

◆ iTotalStep()

template<int D, class T>
long Pscf::Rp::Simulator< D, T >::iTotalStep ( )
inline

Return the current simulation step index.

Definition at line 1138 of file rp/fts/simulator/Simulator.h.

References iTotalStep_.

◆ analyzeChi()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::analyzeChi ( )

Perform eigenvalue analysis of projected chi matrix.

Uses a chi matrix obtained from the Interaction member of the parent System.

Definition at line 297 of file rp/fts/simulator/Simulator.tpp.

References Util::DMatrix< Data >::allocate(), system(), and UTIL_CHECK.

◆ chiEvals()

template<int D, class T>
DArray< double > const & Pscf::Rp::Simulator< D, T >::chiEvals ( ) const
inline

Get an array of the eigenvalues of the projected chi matrix.

The projected chi matrix is given by the matrix product P*chi*P, where P is the symmetric projection matrix that projects onto the subspace orthogonal to the vector e = (1,1,...,1). The projected chi matrix is singular, and has a zero eigenvalue with associated eigenvector e. By convention, this zero eigenvalue and its eigenvector e are listed last, with index nMonomer - 1.

Definition at line 1017 of file rp/fts/simulator/Simulator.h.

◆ chiEval()

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::chiEval ( int a) const
inline

Get a single eigenvalue of the projected chi matrix.

Parameters
aindex of eigenvalue (0, ... , nMonomer - 1)

Definition at line 1022 of file rp/fts/simulator/Simulator.h.

◆ chiEvecs() [1/2]

template<int D, class T>
DMatrix< double > const & Pscf::Rp::Simulator< D, T >::chiEvecs ( ) const
inline

Get the matrix of all eigenvectors of the projected chi matrix.

This function returns the entire nMonomer x nMonomer matrix of the eigenvectors of the projected chi matrix, in which each row is an eigenvector. The first (row) index of this matrix thus identifies an eigenvector, while the second (column) index identifies the monomer type associated with one component of an eigen-vector.

Each eigenvector is normalized such that the sum of the squares of its elements is equal to nMonomer, the number of monomer types. The sign of each vector is chosen so as to make the first (0) component non-negative. The last eigenvector is always the null vector e = (1,1,...,1).

For the case nMonomer = 2 of an AB system, the resulting two eigenvectors are (1,-1) and (1,1).

Definition at line 1027 of file rp/fts/simulator/Simulator.h.

◆ chiEvecs() [2/2]

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::chiEvecs ( int a,
int i ) const
inline

Get one element of an eigenvector of the projected chi matrix.

See documentation of chiEvecs(), which returns the entire matrix.

Parameters
aeigenvector index (0, ..., nMonomer - 1)
imonomoner type index (0, ..., nMonomer - 1)

Definition at line 1032 of file rp/fts/simulator/Simulator.h.

◆ sc() [1/2]

template<int D, class T>
DArray< double > const & Pscf::Rp::Simulator< D, T >::sc ( ) const
inline

Get all components of the vector S.

The value of component \( S_{a} \) may be expressed using Einstein summation convention as

\[ S_{a} \equiv \frac{1}{M^2} v_{ai}\chi_{ij}e_{j} \]

for any \( a = 0, \ldots, M - 1 \), where M = nMonomer (the number of monomer types), \( e_{j} =1 \) for any j, and \( v_{ai} \) is component associated with monomer type i of eigenvector a of the projected chi matrix, with the convention \( v_{ia} = e_{i} = 1 \) for a = nMonomer - 1.

Definition at line 1037 of file rp/fts/simulator/Simulator.h.

◆ sc() [2/2]

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::sc ( int a) const
inline

Get a single component of the S vector.

This function retrieves on component of the vector defined in the documentation for function sc().

Parameters
aeigenvector index (0, ..., nMonomer - 1)

Definition at line 1042 of file rp/fts/simulator/Simulator.h.

◆ computeHamiltonian()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::computeHamiltonian ( )

Compute the Hamiltonian used in PS-FTS.

Definition at line 187 of file rp/fts/simulator/Simulator.tpp.

References hasHamiltonian_, hasWc_, system(), and UTIL_CHECK.

◆ hamiltonian()

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::hamiltonian ( ) const
inline

Get the Hamiltonian used in PS-FTS.

This function returns the real, thermodynamically extensive Hamiltonian used in simulations based on partial saddle-point approximation (PS-FTS). The value returned by this function is equal to the sum of values returned by idealHamiltonian(), fieldHamiltonian() and perturbationHamiltonian() functions.

Definition at line 1054 of file rp/fts/simulator/Simulator.h.

References hamiltonian_, hasHamiltonian_, and UTIL_CHECK.

Referenced by saveState().

◆ idealHamiltonian()

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::idealHamiltonian ( ) const
inline

Get an ideal contribution to the Hamiltonian.

The ideal Hamiltonian contribution returned by this function is given by the quantity denoted by \( \tilde{H}_{\rm id} \), as defined here, given by

\[ H_{\rm id} = \frac{V}{v} \sum_{a} \frac{\overline{\phi}_{a}}{N_{a}} \left [ \ln \left ( \frac{\overline{\phi}_{a}}{Q_{a}} \right ) - 1 \right ] - \frac{1}{v}\int W_{+}^{*}({\bf r}) \\ \]

Here, \( a \) is an index for molecular species, while \( \overline{\phi}_{a} \), \( N_{a} \) and \( Q_{a} \) are the volume fraction, number of monomers per molecule (i.e., ratio of molecular to monomer volume), and the normalized single-molecule partition function for polymer or solvent species \( a \), respectively.

Definition at line 1062 of file rp/fts/simulator/Simulator.h.

References hasHamiltonian_, idealHamiltonian_, and UTIL_CHECK.

Referenced by saveState().

◆ fieldHamiltonian()

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::fieldHamiltonian ( ) const
inline

Get the quadratic field contribution to the Hamiltonian.

The field Hamiltonian contribution returned by this function is given by the quantity denoted by \( \tilde{H}_{\rm id} \), as defined here, given by

\[ H_{\rm f} = \frac{1}{v} \int \! d{\bf r} \; \left \{ \sum_{\alpha=0}^{M-2} \frac{M (W_{\alpha} - S_{\alpha})^2 }{ 2 |\lambda_{\alpha}|} + \frac{S_{+}}{2} \right \} \quad, \]

where \( \alpha \) is an index for eigenvectors of the projected \( \chi \) matrix, \( S_{\alpha} = v_{\alpha i} \chi_{ij} e_{j}/M^{2} \), and \( S_{+} = S_{M-1} = e_{i} \chi_{ij} e_{j}/M^{2} \).

Definition at line 1070 of file rp/fts/simulator/Simulator.h.

References fieldHamiltonian_, hasHamiltonian_, and UTIL_CHECK.

Referenced by saveState().

◆ perturbationHamiltonian()

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::perturbationHamiltonian ( ) const
inline

Get a perturbation to the standard Hamiltonian.

A perturbation to the Hamiltonian, if any, is computed by an associated Perturbation object.

When no perturbation exists, this function returns zero.

Definition at line 1078 of file rp/fts/simulator/Simulator.h.

References hasHamiltonian_, perturbationHamiltonian_, and UTIL_CHECK.

Referenced by saveState().

◆ hasHamiltonian()

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

Has the Hamiltonian been computed for the current w and c fields?

Definition at line 1049 of file rp/fts/simulator/Simulator.h.

References hasHamiltonian_.

Referenced by saveState().

◆ computeWc()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::computeWc ( )

Compute eigenvector components of the current w fields.

Compute and store the components of the values of the w fields on nodes of a real-space grid (r-grid) in a basis of the eigenvectors of the projected chi matrix. The component field \( W_{a}({\bf r}) \) at grid point \( {\bf r} \) is given using Einstein summation by

\[ W_{a}({\bf r}) = v_{ai} w_{i}({\bf r}) / M \]

where \( w_{i}({\bf r}) \) is the w-field associated with monomer type \( i \), \( v_{ai} \) is eigenvector a of the projected chi matrix, and M = nMonomer.

Definition at line 451 of file rp/fts/simulator/Simulator.tpp.

References Pscf::VecOp::eqS(), system(), UTIL_CHECK, and wc_.

Referenced by computeDc().

◆ wc() [1/2]

template<int D, class T>
DArray< typename T::RField > const & Pscf::Rp::Simulator< D, T >::wc ( ) const
inline

Get all eigenvector components of the current w fields.

This function returns a DArray of fields in which each field is a chemical field component \( W_{a}({\bf r}) \) as defined in the documentation of computeWc(), for a = 0, ..., nMonomer - 1.

Definition at line 1093 of file rp/fts/simulator/Simulator.h.

References wc_.

◆ wc() [2/2]

template<int D, class T>
T::RField const & Pscf::Rp::Simulator< D, T >::wc ( int a) const
inline

Get one eigenvector component of the current w fields.

See documentation of functions computeWc() and wc() for details.

Parameters
aeigenvector index in range 0 , ..., nMonomer -1

Definition at line 1098 of file rp/fts/simulator/Simulator.h.

References wc_.

◆ hasWc()

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

Are eigen-components of the current w fields valid ?

Definition at line 1088 of file rp/fts/simulator/Simulator.h.

References hasWc_.

Referenced by saveState().

◆ computeCc()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::computeCc ( )

Compute eigenvector components of the current c fields.

Compute and store the components of the values of the c fields on nodes of a real-space grid (r-grid) in a basis of the eigenvectors of the projected chi matrix.

Definition at line 481 of file rp/fts/simulator/Simulator.tpp.

References Pscf::VecOp::addEqVc(), cc_, Pscf::VecOp::eqS(), system(), and UTIL_CHECK.

◆ cc() [1/2]

template<int D, class T>
DArray< typename T::RField > const & Pscf::Rp::Simulator< D, T >::cc ( ) const
inline

Get all eigenvector components of the current c fields.

Each component \(C_{a}({\bf r}) \) is a point-wise projection of the monomer c fields onto a corresponding eigenvector of the projected chi matrix. The resulting value \( C_{a}({\bf r}) \) for eigen-component a at grid point \( {\bf r} \) is given using Einstein notation as

\[ C_{a}({\bf r}) = v_{ai} c_{i}({\bf r}) \]

where \( c_{i}({\bf r}) \) is the concentration / volume fraction field associated with monomer type i.

Note: The above definition \( C_{a} \) uses a different prefactor than that used to define the corresponding w-field component \( W_{a} \) given in the documentation of the function wc(), without the prefactor of 1/nMonomer. This is intentional, and is convenient for other aspects of the underlying theory.

Definition at line 1108 of file rp/fts/simulator/Simulator.h.

References cc_.

Referenced by saveState().

◆ cc() [2/2]

template<int D, class T>
T::RField const & Pscf::Rp::Simulator< D, T >::cc ( int a) const
inline

Get one eigenvector component of the current c fields.

This returns a reference to a field \( C_{a}({\bf r}) \) as defined in the documentation of function cc().

Parameters
aeigenvector / eigenvalue index

Definition at line 1113 of file rp/fts/simulator/Simulator.h.

References cc_.

◆ hasCc()

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

Are eigen-components of the current c fields valid ?

Definition at line 1103 of file rp/fts/simulator/Simulator.h.

References hasCc_.

Referenced by saveState().

◆ computeDc()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::computeDc ( )

Compute functional derivatives of the Hamiltonian.

Compute and store the functional derivatives of the field theoretic Hamiltonian with respect to eigenvector components of the w fields (i.e., with respect to components of wc).

Definition at line 513 of file rp/fts/simulator/Simulator.tpp.

References computeWc(), hasWc_, and UTIL_CHECK.

◆ dc() [1/2]

template<int D, class T>
DArray< typename T::RField > const & Pscf::Rp::Simulator< D, T >::dc ( ) const
inline

Get all of the current d fields.

This function returns an array of fields in which element a is the functional derivative of the Hamiltonian H[W] with respect to the field component \( W_{a} \) that is returned by the member function wc(a).

Definition at line 1123 of file rp/fts/simulator/Simulator.h.

References dc_.

Referenced by saveState().

◆ dc() [2/2]

template<int D, class T>
T::RField const & Pscf::Rp::Simulator< D, T >::dc ( int i) const
inline

Get one eigenvector component of the current d fields.

Parameters
ieigenvector / eigenvalue index

Definition at line 1128 of file rp/fts/simulator/Simulator.h.

References dc_.

◆ hasDc()

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

Are the current d fields valid ?

Definition at line 1118 of file rp/fts/simulator/Simulator.h.

References hasDc_.

Referenced by saveState().

◆ saveState()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::saveState ( )

Save a copy of the current system state.

This function and restoreState() are intended for use in the implementation of field theoretic moves. This function stores the current w fields and the corresponding Hamiltonian value. Current cc fields and dc fields are saved based on save policy. This is normally the first step of a Monte-Carlo (MC) move, prior to an attempted modification of the fields stored in the system w field container.

Definition at line 550 of file rp/fts/simulator/Simulator.tpp.

References cc(), cc_, dc(), dc_, fieldHamiltonian(), hamiltonian(), hasCc(), hasDc(), hasHamiltonian(), hasPerturbation(), hasWc(), idealHamiltonian(), perturbation(), perturbationHamiltonian(), state(), system(), UTIL_CHECK, and wc_.

◆ restoreState()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::restoreState ( )

Restore the system to the saved state.

This function and saveState() are intended to be used together in the implementation of FTS moves. If an attempted Monte-Carlo move is rejected, or if the compressor fails to converge after any attempted FTS move, restoreState() is called to restore the fields and Hamiltonian value that were saved by a previous call to the function saveState().

Definition at line 606 of file rp/fts/simulator/Simulator.tpp.

References state(), system(), and UTIL_CHECK.

◆ clearState()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::clearState ( )

Clear the saved copy of the system state.

This function, restoreState(), and saveState() are intended to be used together in the implementation of reversible FTS moves. If an attempted move is accepted, clearState() is called to clear the stored state and indicate acceptance.

Definition at line 661 of file rp/fts/simulator/Simulator.tpp.

References state().

◆ system()

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

Get the parent system by reference.

Definition at line 923 of file rp/fts/simulator/Simulator.h.

References UTIL_ASSERT.

Referenced by analyzeChi(), computeCc(), computeHamiltonian(), computeWc(), restoreState(), saveState(), and Simulator().

◆ random()

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

Get the scalar random number generator by reference.

Definition at line 931 of file rp/fts/simulator/Simulator.h.

References UTIL_ASSERT.

Referenced by readRandomSeed().

◆ vecRandom()

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

Get the vector random number generator by reference.

Definition at line 939 of file rp/fts/simulator/Simulator.h.

References UTIL_ASSERT.

◆ hasCompressor()

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

Does this Simulator have a Compressor?

Definition at line 947 of file rp/fts/simulator/Simulator.h.

Referenced by readCompressor().

◆ compressor() [1/2]

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

Get the Compressor by const reference.

Definition at line 960 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

◆ compressor() [2/2]

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

Get the Compressor by non-const reference.

Definition at line 952 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

◆ hasPerturbation()

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

Does this Simulator have a Perturbation?

Definition at line 968 of file rp/fts/simulator/Simulator.h.

Referenced by readPerturbation(), and saveState().

◆ perturbation() [1/2]

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

Get a Perturbation by const reference.

Definition at line 973 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

Referenced by saveState().

◆ perturbation() [2/2]

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

Get a Perturbation by non-const reference.

Definition at line 981 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

◆ hasRamp()

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

Does this Simulator have a Ramp?

Definition at line 989 of file rp/fts/simulator/Simulator.h.

Referenced by readRamp().

◆ ramp() [1/2]

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

Get a Ramp by const reference.

Definition at line 994 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

◆ ramp() [2/2]

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

Get a Ramp by non-const reference.

Definition at line 1002 of file rp/fts/simulator/Simulator.h.

References UTIL_CHECK.

◆ readRandomSeed()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::readRandomSeed ( std::istream & in)
protected

Optionally read a random seed and initialize RNGs.

Parameters
ininput parameter stream

Definition at line 703 of file rp/fts/simulator/Simulator.tpp.

References initializeVecRandom(), random(), Util::ParamComposite::readOptional(), and seed_.

◆ initializeVecRandom()

template<int D, class T>
virtual void Pscf::Rp::Simulator< D, T >::initializeVecRandom ( )
inlineprotectedvirtual

Initialize the vector RNG.

Empty default implementation can be used by Rpc::Simulator<D>.

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

Definition at line 630 of file rp/fts/simulator/Simulator.h.

Referenced by readRandomSeed().

◆ compressorFactory()

template<int D, class T>
T::CompressorFactory & Pscf::Rp::Simulator< D, T >::compressorFactory ( )
protected

Get the Compressor factory by reference.

Definition at line 740 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

Referenced by readCompressor().

◆ readCompressor()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::readCompressor ( std::istream & in,
bool & isEnd )
protected

Optionally read a Compressor parameter file block.

If isEnd is true on entry, this function returns without attempting to read the Compressor block.

Parameters
ininput parameter stream
isEndHas the end bracket of the Simulator block been read?

Definition at line 721 of file rp/fts/simulator/Simulator.tpp.

References Util::ParamComposite::className(), compressorFactory(), Util::ParamComponent::echo(), Util::Log::file(), hasCompressor(), Util::ParamComponent::indent(), and UTIL_CHECK.

◆ perturbationFactory()

template<int D, class T>
T::PerturbationFactory & Pscf::Rp::Simulator< D, T >::perturbationFactory ( )
protected

Get the Perturbation factory by reference.

Definition at line 771 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

Referenced by readPerturbation().

◆ readPerturbation()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::readPerturbation ( std::istream & in,
bool & isEnd )
protected

Optionally read a Perturbation parameter file block.

If isEnd is true on entry, this function returns without attempting to read the Perturbation block.

Parameters
ininput parameter stream
isEndHas the end bracket of the Simulator block been read?

Definition at line 752 of file rp/fts/simulator/Simulator.tpp.

References Util::ParamComposite::className(), Util::ParamComponent::echo(), Util::Log::file(), hasPerturbation(), Util::ParamComponent::indent(), perturbationFactory(), and UTIL_CHECK.

◆ setPerturbation()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::setPerturbation ( typename T::Perturbation * ptr)
protected

Set the associated Perturbation.

Parameters
ptrpointer to a new Perturbation

Definition at line 781 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

◆ rampFactory()

template<int D, class T>
T::RampFactory & Pscf::Rp::Simulator< D, T >::rampFactory ( )
protected

Get the Ramp factory by reference.

Definition at line 811 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

Referenced by readRamp().

◆ readRamp()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::readRamp ( std::istream & in,
bool & isEnd )
protected

Optionally read a Ramp parameter file block.

If isEnd is true on entry, this function returns without attempting to read the Ramp block.

Parameters
ininput parameter stream
isEndHas the end bracket of the Simulator block been read?

Definition at line 793 of file rp/fts/simulator/Simulator.tpp.

References Util::ParamComposite::className(), Util::ParamComponent::echo(), Util::Log::file(), hasRamp(), Util::ParamComponent::indent(), rampFactory(), and UTIL_CHECK.

◆ setRamp()

template<int D, class T>
void Pscf::Rp::Simulator< D, T >::setRamp ( typename T::Ramp * ptr)
protected

Set the associated Ramp.

Parameters
ptrpointer to a new Ramp

Definition at line 821 of file rp/fts/simulator/Simulator.tpp.

References UTIL_CHECK.

◆ state()

template<int D, class T>
T::SimState & Pscf::Rp::Simulator< D, T >::state ( )
inlineprotected

Get the SimState stored internal state by reference.

The T::SimState object is used to store the previous internal state of the system. This allows restoration after a rejected MC move or failure of the Compressor to converge during either a BD or MC move.

Definition at line 1010 of file rp/fts/simulator/Simulator.h.

References state_.

Referenced by clearState(), restoreState(), and saveState().

Member Data Documentation

◆ wc_

template<int D, class T>
DArray<RFieldT> Pscf::Rp::Simulator< D, T >::wc_
protected

Eigenvector components of w fields on a real space grid.

Each field component corresponds to a point-wise projection of the monomer w fields onto an eigenvector of the projected chi matrix. The number of components is equal to the number of monomer types, nMonomer. The last component is a pressure-like field.

Definition at line 716 of file rp/fts/simulator/Simulator.h.

Referenced by computeWc(), saveState(), wc(), and wc().

◆ cc_

template<int D, class T>
DArray<RFieldT> Pscf::Rp::Simulator< D, T >::cc_
protected

Eigenvector components of c fields on a real space grid.

Each field component corresponds to a point-wise projection of the monomer c fields onto an eigenvector of the projected chi matrix. The number of components is equal to the number of monomer types, nMonomer. The last component must satisfy an incompressibility constraint.

Definition at line 727 of file rp/fts/simulator/Simulator.h.

Referenced by cc(), cc(), computeCc(), and saveState().

◆ dc_

template<int D, class T>
DArray<RFieldT> Pscf::Rp::Simulator< D, T >::dc_
protected

Components of d fields on a real space grid.

Each field component is the functional derivative of H[W] with respect to one eigenvector w-field component.

Definition at line 735 of file rp/fts/simulator/Simulator.h.

Referenced by dc(), dc(), and saveState().

◆ state_

template<int D, class T>
T::SimState Pscf::Rp::Simulator< D, T >::state_
mutableprotected

Previous state saved at the beginning of a step.

This data structure is used to restore a previous state if the compressor fails to converge or if a MC move is rejected.

Definition at line 743 of file rp/fts/simulator/Simulator.h.

Referenced by state().

◆ hamiltonian_

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::hamiltonian_
protected

Total field theoretic Hamiltonian H[W] (extensive value).

Definition at line 748 of file rp/fts/simulator/Simulator.h.

Referenced by hamiltonian(), and Simulator().

◆ idealHamiltonian_

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::idealHamiltonian_
protected

Ideal gas contribution (-lnQ) to Hamiltonian.

Definition at line 753 of file rp/fts/simulator/Simulator.h.

Referenced by idealHamiltonian(), and Simulator().

◆ fieldHamiltonian_

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::fieldHamiltonian_
protected

Quadratic field contribution to Hamiltonian.

Definition at line 758 of file rp/fts/simulator/Simulator.h.

Referenced by fieldHamiltonian(), and Simulator().

◆ perturbationHamiltonian_

template<int D, class T>
double Pscf::Rp::Simulator< D, T >::perturbationHamiltonian_
protected

Perturbation contribution to the Hamiltonian.

A perturbation Hamiltonian component, if any, is computed by an associated Perturbation object and added to the ideal and field components to obtain the total hamiltonian_ value.

Definition at line 767 of file rp/fts/simulator/Simulator.h.

Referenced by perturbationHamiltonian(), and Simulator().

◆ iStep_

template<int D, class T>
long Pscf::Rp::Simulator< D, T >::iStep_
protected

Step counter - number of steps for which the compressor converged.

Steps for which the compressor fails to converge are returned to the previous state so that another random displacement can be chosen. Attempted MC moves for which the compressor converges but which are then rejected based on a Metropolis criterion are included in iStep_. The difference iTotalStep_ - iStep_ is the number of moves that failed because the compressor failed to converge.

Definition at line 780 of file rp/fts/simulator/Simulator.h.

Referenced by iStep(), and Simulator().

◆ iTotalStep_

template<int D, class T>
long Pscf::Rp::Simulator< D, T >::iTotalStep_
protected

Step counter - total number of attempted BD or MC steps.

Definition at line 785 of file rp/fts/simulator/Simulator.h.

Referenced by iTotalStep(), and Simulator().

◆ seed_

template<int D, class T>
long Pscf::Rp::Simulator< D, T >::seed_
protected

Random number generator seed (input value).

Definition at line 790 of file rp/fts/simulator/Simulator.h.

Referenced by readRandomSeed(), and Simulator().

◆ hasHamiltonian_

template<int D, class T>
bool Pscf::Rp::Simulator< D, T >::hasHamiltonian_
protected

Has the Hamiltonian been computed for the current w and c fields?

Definition at line 797 of file rp/fts/simulator/Simulator.h.

Referenced by clearData(), computeHamiltonian(), fieldHamiltonian(), hamiltonian(), hasHamiltonian(), idealHamiltonian(), perturbationHamiltonian(), and Simulator().

◆ hasWc_

template<int D, class T>
bool Pscf::Rp::Simulator< D, T >::hasWc_
protected

Have eigen-components of the current w fields been computed ?

Definition at line 802 of file rp/fts/simulator/Simulator.h.

Referenced by clearData(), computeDc(), computeHamiltonian(), hasWc(), and Simulator().

◆ hasCc_

template<int D, class T>
bool Pscf::Rp::Simulator< D, T >::hasCc_
protected

Have eigen-components of the current c fields been computed ?

Definition at line 807 of file rp/fts/simulator/Simulator.h.

Referenced by clearData(), hasCc(), and Simulator().

◆ hasDc_

template<int D, class T>
bool Pscf::Rp::Simulator< D, T >::hasDc_
protected

Have functional derivatives of H[W] been computed ?

Definition at line 812 of file rp/fts/simulator/Simulator.h.

Referenced by clearData(), hasDc(), and Simulator().


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