PSCF v1.1
|
Main class for SCFT simulation of one system. More...
#include <System.h>
Public Member Functions | |
Construction and Destruction | |
System () | |
Constructor. More... | |
~System () | |
Destructor. More... | |
Lifetime (Actions) | |
void | setOptions (int argc, char **argv) |
Process command line options. More... | |
virtual void | readParam (std::istream &in) |
Read input parameters (with opening and closing lines). More... | |
void | readParam () |
Read input parameters from default param file. More... | |
virtual void | readParameters (std::istream &in) |
Read body of parameter block (without opening and closing lines). More... | |
void | readCommands (std::istream &in) |
Read command script from a file. More... | |
void | readCommands () |
Read commands from default command file. More... | |
W Field Modifiers | |
void | readWBasis (const std::string &filename) |
Read chemical potential fields in symmetry adapted basis format. More... | |
void | readWRGrid (const std::string &filename) |
Read chemical potential fields in real space grid (r-grid) format. More... | |
void | setWBasis (DArray< DArray< double > > const &fields) |
Set chemical potential fields, in symmetry-adapted basis format. More... | |
void | setWRGrid (DArray< RField< D > > const &fields) |
Set new w fields, in real-space (r-grid) format. More... | |
void | estimateWfromC (const std::string &filename) |
Construct trial w-fields from c-fields. More... | |
Unit Cell Modifiers | |
void | setUnitCell (UnitCell< D > const &unitCell) |
Set parameters of the associated unit cell. More... | |
void | setUnitCell (typename UnitCell< D >::LatticeSystem lattice, FSArray< double, 6 > const ¶meters) |
Set state of the associated unit cell. More... | |
void | setUnitCell (FSArray< double, 6 > const ¶meters) |
Set parameters of the associated unit cell. More... | |
Primary SCFT Computations | |
void | compute (bool needStress=false) |
Solve the modified diffusion equation once, without iteration. More... | |
int | iterate (bool isContinuation=false) |
Iteratively solve a SCFT problem. More... | |
void | sweep () |
Sweep in parameter space, solving an SCF problem at each point. More... | |
Thermodynamic Properties | |
void | computeFreeEnergy () |
Compute free energy density and pressure for current fields. More... | |
double | fHelmholtz () const |
Get precomputed Helmoltz free energy per monomer / kT. More... | |
double | pressure () const |
Get precomputed pressure x monomer volume kT. More... | |
Thermodynamic Data Output | |
void | writeParamNoSweep (std::ostream &out) const |
Write parameter file to an ostream, omitting any sweep block. More... | |
void | writeThermo (std::ostream &out) |
Write thermodynamic properties to a file. More... | |
Field Output | |
void | writeWBasis (const std::string &filename) const |
Write chemical potential fields in symmetrized basis format. More... | |
void | writeWRGrid (const std::string &filename) const |
Write chemical potential fields in real space grid (r-grid) format. More... | |
void | writeCBasis (const std::string &filename) const |
Write concentration fields in symmetrized basis format. More... | |
void | writeCRGrid (const std::string &filename) const |
Write concentration fields in real space grid (r-grid) format. More... | |
void | writeBlockCRGrid (const std::string &filename) const |
Write c-fields for all blocks and solvents in r-grid format. More... | |
Propagator Output | |
void | writeQSlice (std::string const &filename, int polymerId, int blockId, int directionId, int segmentId) const |
Write slice of a propagator at fixed s in r-grid format. More... | |
void | writeQTail (std::string const &filename, int polymerId, int blockId, int directionId) const |
Write the final slice of a propagator in r-grid format. More... | |
void | writeQ (std::string const &filename, int polymerId, int blockId, int directionId) const |
Write one propagator for one block, in r-grid format. More... | |
void | writeQAll (std::string const &basename) |
Write all propagators of all blocks, each to a separate file. More... | |
Crystallographic Information | |
void | writeStars (std::string const &filename) const |
Output information about stars and symmetrized basis functions. More... | |
void | writeWaves (std::string const &filename) const |
Output information about waves. More... | |
void | writeGroup (std::string const &filename) const |
Output all elements of the space group. More... | |
Field File Manipulations | |
void | basisToRGrid (const std::string &inFileName, const std::string &outFileName) |
Convert a field from symmetrized basis format to r-grid format. More... | |
void | rGridToBasis (const std::string &inFileName, const std::string &outFileName) |
Convert a field from real-space grid to symmetrized basis format. More... | |
void | kGridToRGrid (const std::string &inFileName, const std::string &outFileName) |
Convert fields from Fourier (k-grid) to real-space (r-grid) format. More... | |
void | rGridToKGrid (const std::string &inFileName, const std::string &outFileName) |
Convert fields from real-space (r-grid) to Fourier (k-grid) format. More... | |
void | kGridToBasis (const std::string &inFileName, const std::string &outFileName) |
Convert fields from Fourier (k-grid) to symmetrized basis format. More... | |
void | basisToKGrid (const std::string &inFileName, const std::string &outFileName) |
Convert fields from symmetrized basis to Fourier (k-grid) format. More... | |
void | compare (const DArray< DArray< double > > field1, const DArray< DArray< double > > field2) |
Compare two field files in symmetrized basis format. More... | |
void | compare (const DArray< RField< D > > field1, const DArray< RField< D > > field2) |
Compare two field files in symmetrized basis format. More... | |
bool | checkRGridFieldSymmetry (const std::string &inFileName, double epsilon=1.0E-8) |
Check if r-grid fields have the declared space group symmetry. More... | |
Field Accessors | |
WFieldContainer< D > const & | w () const |
Get all of the chemical potential fields (const reference). More... | |
CFieldContainer< D > const & | c () const |
Get all of the monomer concentration fields (const reference). More... | |
WFieldContainer< D > & | h () |
Get all of the external potential fields (reference). More... | |
Mask< D > & | mask () |
Get the mask (field to which total density is constrained). More... | |
Member Object Accessors | |
Mixture< D > & | mixture () |
Get the Mixture by non-const reference. More... | |
Mixture< D > const & | mixture () const |
Get the Mixture by const reference. More... | |
Interaction & | interaction () |
Get Interaction (excess free energy model) by reference. More... | |
Interaction const & | interaction () const |
Get Interaction (excess free energy model) by const reference. More... | |
Domain< D > const & | domain () const |
Get Domain by const reference. More... | |
UnitCell< D > const & | unitCell () const |
Get UnitCell (i.e., type and parameters) by const reference. More... | |
Mesh< D > const & | mesh () const |
Get the spatial discretization mesh by const reference. More... | |
Basis< D > const & | basis () const |
Get the Basis by const reference. More... | |
FFT< D > const & | fft () const |
Get associated FFT object by const reference. More... | |
FieldIo< D > const & | fieldIo () const |
Get associated FieldIo object by const reference. More... | |
Iterator< D > & | iterator () |
Get the iterator. More... | |
Iterator< D > const & | iterator () const |
Get the iterator by const reference. More... | |
Homogeneous::Mixture & | homogeneous () |
Get homogeneous mixture (for reference calculations). More... | |
Homogeneous::Mixture const & | homogeneous () const |
Get const homogeneous mixture (for reference calculations). More... | |
FileMaster & | fileMaster () |
Get the FileMaster. More... | |
FileMaster const & | fileMaster () const |
Get the FileMaster by const reference. More... | |
std::string | groupName () const |
Get the group name string. More... | |
Queries | |
bool | hasCFields () const |
Have c fields been computed from the current w fields? More... | |
bool | hasFreeEnergy () const |
Has the free energy been computed from the current w fields? More... | |
bool | hasExternalFields () const |
Does this system have external potential fields? More... | |
bool | hasMask () const |
Does this system have a mask (inhomogeneous density constraint) More... | |
bool | hasSweep () const |
Does this system have a Sweep object? More... | |
![]() | |
ParamComposite () | |
Constructor. More... | |
ParamComposite (const ParamComposite &other) | |
Copy constructor. More... | |
ParamComposite (int capacity) | |
Constructor. More... | |
virtual | ~ParamComposite () |
Virtual destructor. More... | |
void | resetParam () |
Resets ParamComposite to its empty state. More... | |
virtual void | readParamOptional (std::istream &in) |
Read optional parameter file block. More... | |
virtual void | writeParam (std::ostream &out) const |
Write all parameters to an output stream. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load all parameters from an input archive. More... | |
virtual void | loadOptional (Serializable::IArchive &ar) |
Load an optional ParamComposite. More... | |
virtual void | loadParameters (Serializable::IArchive &ar) |
Load state from archive, without adding Begin and End lines. More... | |
virtual void | save (Serializable::OArchive &ar) |
Saves all parameters to an archive. More... | |
void | saveOptional (Serializable::OArchive &ar) |
Saves isActive flag, and then calls save() iff isActive is true. More... | |
void | readParamComposite (std::istream &in, ParamComposite &child, bool next=true) |
Add and read a required child ParamComposite. More... | |
void | readParamCompositeOptional (std::istream &in, ParamComposite &child, bool next=true) |
Add and attempt to read an optional child ParamComposite. More... | |
template<typename Type > | |
ScalarParam< Type > & | read (std::istream &in, const char *label, Type &value) |
Add and read a new required ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | readOptional (std::istream &in, const char *label, Type &value) |
Add and read a new optional ScalarParam < Type > object. More... | |
template<typename Type > | |
CArrayParam< Type > & | readCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read a required C array parameter. More... | |
template<typename Type > | |
CArrayParam< Type > & | readOptionalCArray (std::istream &in, const char *label, Type *value, int n) |
Add and read an optional C array parameter. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
template<typename Type > | |
DSymmMatrixParam< Type > & | readDSymmMatrix (std::istream &in, const char *label, DMatrix< Type > &matrix, int n) |
Add and read a required symmetrix DMatrix. More... | |
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. More... | |
Begin & | readBegin (std::istream &in, const char *label, bool isRequired=true) |
Add and read a class label and opening bracket. More... | |
End & | readEnd (std::istream &in) |
Add and read the closing bracket. More... | |
Blank & | readBlank (std::istream &in) |
Add and read a new Blank object, representing a blank line. More... | |
void | loadParamComposite (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load a required child ParamComposite. More... | |
void | loadParamCompositeOptional (Serializable::IArchive &ar, ParamComposite &child, bool next=true) |
Add and load an optional child ParamComposite if isActive. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value, bool isRequired) |
Add and load a new ScalarParam < Type > object. More... | |
template<typename Type > | |
ScalarParam< Type > & | loadParameter (Serializable::IArchive &ar, const char *label, Type &value) |
Add and load new required ScalarParam < Type > object. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | addParamComposite (ParamComposite &child, bool next=true) |
Add a child ParamComposite object to the format array. More... | |
Begin & | addBegin (const char *label) |
Add a Begin object representing a class name and bracket. More... | |
End & | addEnd () |
Add a closing bracket. More... | |
Blank & | addBlank () |
Create and add a new Blank object, representing a blank line. More... | |
std::string | className () const |
Get class name string. More... | |
bool | isRequired () const |
Is this ParamComposite required in the input file? More... | |
bool | isActive () const |
Is this parameter active? More... | |
![]() | |
virtual | ~ParamComponent () |
Destructor. More... | |
virtual void | readParam (std::istream &in)=0 |
Read parameter(s) from file. More... | |
virtual void | writeParam (std::ostream &out) const =0 |
Read parameter(s) to file. More... | |
virtual void | load (Serializable::IArchive &ar) |
Load internal state from an archive. More... | |
virtual void | save (Serializable::OArchive &ar) |
Save internal state to an archive. More... | |
virtual void | resetParam () |
Nontrivial implementation provided by ParamComposite subclass. More... | |
void | setIndent (const ParamComponent &parent, bool next=true) |
Set indent level. More... | |
std::string | indent () const |
Return indent string for this object (string of spaces). More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize this ParamComponent as a string. More... | |
![]() | |
virtual | ~Serializable () |
Destructor. More... | |
virtual void | save (OArchive &ar)=0 |
Save to an archive. More... | |
virtual void | load (IArchive &ar)=0 |
Load from an archive. More... | |
![]() | |
MpiFileIo () | |
Constructor. More... | |
MpiFileIo (const MpiFileIo &other) | |
Copy constructor. More... | |
bool | isIoProcessor () const |
Can this processor do file I/O ? More... | |
void | setIoCommunicator (MPI::Intracomm &communicator) |
Set the communicator. More... | |
void | clearCommunicator () |
Clear (nullify) the communicator. More... | |
bool | hasIoCommunicator () const |
Does this object have an associated MPI communicator? More... | |
MPI::Intracomm & | ioCommunicator () const |
Get the MPI communicator by reference. More... | |
Additional Inherited Members | |
![]() | |
typedef BinaryFileOArchive | OArchive |
Type of output archive used by save method. More... | |
typedef BinaryFileIArchive | IArchive |
Type of input archive used by load method. More... | |
![]() | |
static void | initStatic () |
Initialize static echo member to false. More... | |
static void | setEcho (bool echo=true) |
Enable or disable echoing for all subclasses of ParamComponent. More... | |
static bool | echo () |
Get echo parameter. More... | |
![]() | |
void | setClassName (const char *className) |
Set class name string. More... | |
void | setIsRequired (bool isRequired) |
Set or unset the isActive flag. More... | |
void | setIsActive (bool isActive) |
Set or unset the isActive flag. More... | |
void | setParent (ParamComponent ¶m, bool next=true) |
Set this to the parent of a child component. More... | |
void | addComponent (ParamComponent ¶m, bool isLeaf=true) |
Add a new ParamComponent object to the format array. More... | |
template<typename Type > | |
ScalarParam< Type > & | add (std::istream &in, const char *label, Type &value, bool isRequired=true) |
Add a new required ScalarParam < Type > object. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
![]() | |
ParamComponent () | |
Constructor. More... | |
ParamComponent (const ParamComponent &other) | |
Copy constructor. More... | |
Main class for SCFT simulation of one system.
A System has (among other components):
A system may also optionally contain Iterator and Sweep objects. In a parameter file format, the main block is a System{...} block that contains subblocks for sub-objects.
A minimal main program that uses this class template to implement a program for 3-dimensional structures (D=3) looks something like this:
This main program is given for D=1, 2, and 3 dimensional structures in the files pscf_pc1.cpp, pscf_pc2.cpp, and pscf_pc3.cpp
Definition at line 75 of file pspc/System.h.
Pscf::Pspc::System< D >::System |
Constructor.
Definition at line 45 of file pspc/System.tpp.
References Util::BracketPolicy::set(), and Util::ParamComposite::setClassName().
Pscf::Pspc::System< D >::~System |
Destructor.
Definition at line 85 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::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.
argc | number of command line arguments |
argv | array of pointers to command line arguments |
Definition at line 108 of file pspc/System.tpp.
References Util::Log::file(), Util::ParamComponent::setEcho(), and UTIL_THROW.
|
virtual |
Read input parameters (with opening and closing lines).
in | input parameter stream |
Reimplemented from Util::ParamComposite.
Definition at line 240 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::readParam |
Read input parameters from default param file.
This function reads the parameter file set by the -p command line option.
Definition at line 251 of file pspc/System.tpp.
|
virtual |
Read body of parameter block (without opening and closing lines).
in | input parameter stream |
Reimplemented from Util::ParamComposite.
Definition at line 181 of file pspc/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::readCommands | ( | std::istream & | in | ) |
Read command script from a file.
in | command script file. |
Definition at line 258 of file pspc/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::readCommands |
Read commands from default command file.
This function reads the parameter file set by the -c command line option.
Definition at line 549 of file pspc/System.tpp.
References UTIL_THROW.
void Pscf::Pspc::System< D >::readWBasis | ( | const std::string & | filename | ) |
Read chemical potential fields in symmetry adapted basis format.
This function opens and reads the file with the name given by the "filename" string parameter, which must contain chemical potential fields in symmetry-adapted basis format. The function sets the system w fields equal to those given in this file, by copying elements of the representation in basis format and computing the representation in r-grid format. On exit, both w().basis() and w().rgrid() have been reset, w().hasData and w().isSymmetric() are true, and hasCFields() is false.
filename | name of input w-field basis file |
Definition at line 563 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::readWRGrid | ( | const std::string & | filename | ) |
Read chemical potential fields in real space grid (r-grid) format.
This function opens and reads the file with the name given by the "filename" string, which must contain chemical potential fields in real space grid (r-grid) format. The function sets values for system w fields in r-grid format. It does not set attempt to set field values in symmetry-adapted basis format, because it cannot be known whether the r-grid field exhibits the declared space group symmetry. On exit, w().rgrid() is reset and w().hasData() is true, while w().isSymmetric() and hasCFields() are false.
filename | name of input w-field basis file |
Definition at line 583 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::setWBasis | ( | DArray< DArray< double > > const & | fields | ) |
Set chemical potential fields, in symmetry-adapted basis format.
This function sets values for w fields in both symmetry adapted and r-grid format. On exit, values of both w().basis() and w().rgrid() are reset, w().hasData() and w().isSymmetric() are true, and hasCFields() is false.
fields | array of new w (chemical potential) fields |
Definition at line 604 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::setWRGrid | ( | DArray< RField< D > > const & | fields | ) |
Set new w fields, in real-space (r-grid) format.
This function set values for w fields in r-grid format, but does not set components the symmetry-adapted basis format. On return, w.rgrid() is reset, w().hasData() is true, w().isSymmetric() is false, and hasCFields() is false.
fields | array of new w (chemical potential) fields |
Definition at line 617 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::estimateWfromC | ( | const std::string & | filename | ) |
Construct trial w-fields from c-fields.
This function reads concentration fields in symmetrized basis format and constructs an initial guess for corresponding chemical potential fields by setting the Lagrange multiplier field xi to zero. The result is stored in the System w fields container
Upon return, w().hasData() and w().isSymmetric() are set true, while hasCFields is set false.
filename | name of input c-field file (basis format) |
Definition at line 631 of file pspc/System.tpp.
References Util::DArray< Data >::allocate(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::setUnitCell | ( | UnitCell< D > const & | unitCell | ) |
Set parameters of the associated unit cell.
The lattice set in this UnitCell must agree with any lattice value that was set previously in the parameter file.
unitCell | new UnitCell<D> (i.e., new parameters) |
Definition at line 680 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::setUnitCell | ( | typename UnitCell< D >::LatticeSystem< D > | lattice, |
FSArray< double, 6 > const & | parameters | ||
) |
Set state of the associated unit cell.
The lattice parameter must agree with any lattice value that was set previously in the parameter file.
lattice | lattice system |
parameters | array of new unit cell parameters. |
Definition at line 694 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::setUnitCell | ( | FSArray< double, 6 > const & | parameters | ) |
Set parameters of the associated unit cell.
The size of the FSArray<double> parameters must match the expected number of parameters for the current lattice type.
parameters | array of new unit cell parameters. |
Definition at line 708 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::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 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 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). Upon return, the flag hasCFields is set true.
If argument needStress == true, then this function also calls Mixture<D>::computeStress() to compute the stress.
needStress | true if stress is needed, false otherwise |
Definition at line 723 of file pspc/System.tpp.
References UTIL_CHECK.
int Pscf::Pspc::System< D >::iterate | ( | bool | isContinuation = false | ) |
Iteratively solve a SCFT problem.
This function calls the iterator to attempt to solve the SCFT problem for the current mixture and system parameters, using the current chemical potential fields and current unit cell parameter values as initial guesses. On exit, hasCFields is set true whether or not convergence is obtained to within the desired tolerance. The Helmholtz free energy and pressure are computed if and only if convergence is obtained.
isContinuation | true if continuation within a sweep. |
Definition at line 751 of file pspc/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::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 SCF problem at a sequence of points along a line in parameter space. The nature of this sequence of points is determined by implementation of a subclass of Sweep and the parameters passed to the sweep object in the parameter file. The Iterator that is initialized in the parameter file is called at each state point.
An Exception is thrown if this is called when no Sweep has been created (i.e., if hasSweep() == false).
Definition at line 780 of file pspc/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
Referenced by pscfpp.output.Sweep::__getitem__(), pscfpp.output.Sweep::__init__(), pscfpp.output.Sweep::__len__(), pscfpp.output.Sweep::summary(), and pscfpp.output.Sweep::summaryString().
void Pscf::Pspc::System< D >::computeFreeEnergy |
Compute free energy density and pressure for current fields.
This function should be called after a successful call of System::iterate() or Iterator::solve(). Resulting values are stored and then accessed by the fHelmholtz() and pressure() functions.
Definition at line 798 of file pspc/System.tpp.
References Pscf::PolymerTmpl< Block >::length(), Pscf::Species::mu(), Pscf::Species::phi(), Pscf::SolventDescriptor::size(), and UTIL_CHECK.
|
inline |
Get precomputed Helmoltz free energy per monomer / kT.
The value retrieved by this function is computed by the computeFreeEnergy() function.
Definition at line 1131 of file pspc/System.h.
References UTIL_CHECK.
Referenced by pscfpp.output.Thermo::__init__(), and pscfpp.output.Thermo::read().
|
inline |
Get precomputed pressure x monomer volume kT.
The value retrieved by this function is computed by the computeFreeEnergy() function.
Definition at line 1139 of file pspc/System.h.
References UTIL_CHECK.
Referenced by pscfpp.output.Thermo::__init__(), and pscfpp.output.Thermo::read().
void Pscf::Pspc::System< D >::writeParamNoSweep | ( | std::ostream & | out | ) | const |
Write parameter file to an ostream, omitting any sweep block.
This function omits the Sweep block of the parameter file, if any, in order to allow the output produced during a sweep to refer only to parameters relevant to a single state point, and to be rerunnable as a parameter file for a single SCFT calculation.
out | output stream |
Definition at line 938 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::writeThermo | ( | std::ostream & | out | ) |
Write thermodynamic properties to a file.
This function outputs Helmholtz free energy per monomer, pressure (in units of kT per monomer volume), the volume fraction and chemical potential of each species, and all unit cell parameters.
If parameter "out" is a file that already exists, this function will append this information to the end of the file, rather than overwriting that file. Calling writeParamNoSweep and writeThermo in succession with the same file will thus produce a single file containing both input parameters and resulting thermodynanic properties.
out | output stream |
Definition at line 954 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::writeWBasis | ( | const std::string & | filename | ) | const |
Write chemical potential fields in symmetrized basis format.
filename | name of output file |
Definition at line 1018 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeWRGrid | ( | const std::string & | filename | ) | const |
Write chemical potential fields in real space grid (r-grid) format.
filename | name of output file |
Definition at line 1032 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeCBasis | ( | const std::string & | filename | ) | const |
Write concentration fields in symmetrized basis format.
filename | name of output file |
Definition at line 1044 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeCRGrid | ( | const std::string & | filename | ) | const |
Write concentration fields in real space grid (r-grid) format.
filename | name of output file |
Definition at line 1058 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeBlockCRGrid | ( | const std::string & | filename | ) | const |
Write c-fields for all blocks and solvents in r-grid format.
Writes concentrations for all blocks of all polymers and all solvent species in r-grid format. Columns associated with blocks appear ordered by polymer id and then by block id, with blocks of the same polymer listed sequentially, followed by columns associated with solvent species ordered by solvent id.
filename | name of output file |
Definition at line 1071 of file pspc/System.tpp.
References Util::DArray< Data >::allocate(), Util::Array< Data >::capacity(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::writeQSlice | ( | std::string const & | filename, |
int | polymerId, | ||
int | blockId, | ||
int | directionId, | ||
int | segmentId | ||
) | const |
Write slice of a propagator at fixed s in r-grid format.
filename | name of output file |
polymerId | integer id of the polymer |
blockId | integer id of the block within the polymer |
directionId | integer id of the direction (0 or 1) |
segmentId | integer integration step index |
Definition at line 1094 of file pspc/System.tpp.
References Pscf::PolymerTmpl< Block >::nBlock(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspc::Propagator< D >::q(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::writeQTail | ( | std::string const & | filename, |
int | polymerId, | ||
int | blockId, | ||
int | directionId | ||
) | const |
Write the final slice of a propagator in r-grid format.
filename | name of output file |
polymerId | integer id of the polymer |
blockId | integer id of the block within the polymer |
directionId | integer id of the direction (0 or 1) |
Definition at line 1117 of file pspc/System.tpp.
References Pscf::PolymerTmpl< Block >::nBlock(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspc::Propagator< D >::tail(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::writeQ | ( | std::string const & | filename, |
int | polymerId, | ||
int | blockId, | ||
int | directionId | ||
) | const |
Write one propagator for one block, in r-grid format.
filename | name of output file |
polymerId | integer id of the polymer |
blockId | integer id of the block within the polymer |
directionId | integer id of the direction (0 or 1) |
Definition at line 1138 of file pspc/System.tpp.
References Pscf::PolymerTmpl< Block >::nBlock(), Pscf::Pspc::Propagator< D >::ns(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspc::Propagator< D >::q(), and UTIL_CHECK.
void Pscf::Pspc::System< D >::writeQAll | ( | std::string const & | basename | ) |
Write all propagators of all blocks, each to a separate file.
Write all propagators for both directions for all blocks of all polymers, with each propagator in a separate file. The function writeQ is called internally for each propagator, and is passed an automatically generated file name. The file name for each propagator is given by a string of the form (basename)_(ip)_(ib)_(id), where (basename) denotes the value of the std::string function parameter basename, and where (ip), (ib), and (id) denote the string representations of a polymer indiex ip, a block index ib, and direction index id, with id = 0 or 1. For example, if basename == "out/q", then the file name of the propagator for direction 1 of block 2 of polymer 0 would be "out/q_0_2_1".
basename | common prefix for output file names |
Definition at line 1178 of file pspc/System.tpp.
References Util::toString().
void Pscf::Pspc::System< D >::writeStars | ( | std::string const & | filename | ) | const |
Output information about stars and symmetrized basis functions.
This function opens a file with the specified filename, calls Basis<D>::outputStars, and closes the file before returning.
filename | name of output file |
Definition at line 1205 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeWaves | ( | std::string const & | filename | ) | const |
Output information about waves.
This function opens a file with the specified filename, calls Basis<D>::outputWaves, and closes the file before returning.
filename | name of output file |
Definition at line 1220 of file pspc/System.tpp.
References UTIL_CHECK.
void Pscf::Pspc::System< D >::writeGroup | ( | std::string const & | filename | ) | const |
Output all elements of the space group.
filename | name of output file |
Definition at line 1235 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::basisToRGrid | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert a field from symmetrized basis format to r-grid format.
This function reads a field file in basis format, converts the fields to r-grid format, and writes the fields in r-grid format to a different file.
This and other field conversion functions do not change the w or c fields stored by this System - all required calculations are performed using temporary or mutable memory.
inFileName | name of input file (basis format) |
outFileName | name of output file (r-grid format) |
Definition at line 1246 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::rGridToBasis | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert a field from real-space grid to symmetrized basis format.
This function checks if the input fields have the declared space group symmetry, and prints a warning if it detects deviations that exceed some small threshhold, but proceeds to attempt the conversion even if such an error is detected. Converting a field that does not have the declared space group symmetry to basis format is a destructive operation that modifies the field in unpredictable ways.
inFileName | name of input file (r-grid format) |
outFileName | name of output file (basis format) |
Definition at line 1268 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::kGridToRGrid | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert fields from Fourier (k-grid) to real-space (r-grid) format.
inFileName | name of input file (k-grid format) |
outFileName | name of output file (r-grid format) |
Definition at line 1290 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::rGridToKGrid | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert fields from real-space (r-grid) to Fourier (k-grid) format.
inFileName | name of input file (r-grid format) |
outFileName | name of output file (k-grid format) |
Definition at line 1315 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::kGridToBasis | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert fields from Fourier (k-grid) to symmetrized basis format.
This function checks if the input fields have the declared space group symmetry, and prints a warning if it detects deviations that exceed some small threshhold, but proceeds to attempt the conversion even if such an error is detected. Converting a field that does not have the declared space group symmetry to basis format is a destructive operation that modifies the field in unpredictable ways.
inFileName | name of input file (k-grid format) |
outFileName | name of output file (basis format) |
Definition at line 1341 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::basisToKGrid | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert fields from symmetrized basis to Fourier (k-grid) format.
inFileName | name of input file (basis format) |
outFileName | name of output file (k-grid format) |
Definition at line 1365 of file pspc/System.tpp.
void Pscf::Pspc::System< D >::compare | ( | const DArray< DArray< double > > | field1, |
const DArray< DArray< double > > | field2 | ||
) |
Compare two field files in symmetrized basis format.
Outputs maximum and root-mean-squared differences.
field1 | first array of fields (basis format) |
field2 | second array of fields (basis format) |
Definition at line 1421 of file pspc/System.tpp.
References Pscf::FieldComparison< FT >::compare(), Util::Log::file(), Pscf::FieldComparison< FT >::maxDiff(), and Pscf::FieldComparison< FT >::rmsDiff().
void Pscf::Pspc::System< D >::compare | ( | const DArray< RField< D > > | field1, |
const DArray< RField< D > > | field2 | ||
) |
Compare two field files in symmetrized basis format.
Outputs maximum and root-mean-squared differences.
field1 | first array of fields (r-grid format) |
field2 | second array of fields (r-grid format) |
Definition at line 1439 of file pspc/System.tpp.
References Pscf::FieldComparison< FT >::compare(), Util::Log::file(), Pscf::FieldComparison< FT >::maxDiff(), and Pscf::FieldComparison< FT >::rmsDiff().
bool Pscf::Pspc::System< D >::checkRGridFieldSymmetry | ( | const std::string & | inFileName, |
double | epsilon = 1.0E-8 |
||
) |
Check if r-grid fields have the declared space group symmetry.
inFileName | name of input file |
epsilon | error threshold used when testing for symmetry |
Definition at line 1389 of file pspc/System.tpp.
|
inline |
Get all of the chemical potential fields (const reference).
Definition at line 1090 of file pspc/System.h.
|
inline |
Get all of the monomer concentration fields (const reference).
Definition at line 1096 of file pspc/System.h.
|
inline |
Get all of the external potential fields (reference).
Definition at line 1101 of file pspc/System.h.
|
inline |
Get the mask (field to which total density is constrained).
Definition at line 1106 of file pspc/System.h.
|
inline |
Get the Mixture by non-const reference.
Definition at line 992 of file pspc/System.h.
|
inline |
Get the Mixture by const reference.
Definition at line 997 of file pspc/System.h.
|
inline |
Get Interaction (excess free energy model) by reference.
Definition at line 1057 of file pspc/System.h.
References UTIL_ASSERT.
|
inline |
Get Interaction (excess free energy model) by const reference.
Definition at line 1065 of file pspc/System.h.
References UTIL_ASSERT.
|
inline |
Get Domain by const reference.
Definition at line 1002 of file pspc/System.h.
|
inline |
Get UnitCell (i.e., type and parameters) by const reference.
Definition at line 1007 of file pspc/System.h.
|
inline |
Get the spatial discretization mesh by const reference.
Definition at line 1012 of file pspc/System.h.
|
inline |
Get the Basis by const reference.
Definition at line 1017 of file pspc/System.h.
|
inline |
Get associated FFT object by const reference.
Definition at line 1022 of file pspc/System.h.
|
inline |
Get associated FieldIo object by const reference.
Definition at line 1027 of file pspc/System.h.
|
inline |
|
inline |
Get the iterator by const reference.
Definition at line 1081 of file pspc/System.h.
References UTIL_ASSERT.
|
inline |
Get homogeneous mixture (for reference calculations).
Definition at line 1047 of file pspc/System.h.
|
inline |
Get const homogeneous mixture (for reference calculations).
Definition at line 1052 of file pspc/System.h.
|
inline |
Get the FileMaster.
Access by non-const reference is used in some unit tests.
Definition at line 1037 of file pspc/System.h.
|
inline |
Get the FileMaster by const reference.
Definition at line 1042 of file pspc/System.h.
|
inline |
Get the group name string.
Definition at line 1032 of file pspc/System.h.
|
inline |
Have c fields been computed from the current w fields?
Definition at line 1126 of file pspc/System.h.
|
inline |
Has the free energy been computed from the current w fields?
Definition at line 1147 of file pspc/System.h.
|
inline |
Does this system have external potential fields?
Definition at line 1116 of file pspc/System.h.
|
inline |
Does this system have a mask (inhomogeneous density constraint)
Definition at line 1121 of file pspc/System.h.
|
inline |
Does this system have a Sweep object?
Definition at line 1111 of file pspc/System.h.