PSCF v1.1
|
Main class in 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 file (without opening, closing lines). More... | |
void | readCommands (std::istream &in) |
Read command script. 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< RDField< D > > const &fields) |
Set new w fields, in real-space (r-grid) format. More... | |
void | setWRGrid (DField< cudaReal > &fields) |
Set new w fields, in unfolded real-space (r-grid) format. More... | |
void | symmetrizeWFields () |
Symmetrize r-grid w-fields, compute basis components. 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 times monomer volume / kT. More... | |
Thermodynamic Data Output | |
void | writeParamNoSweep (std::ostream &out) const |
Write parameter file to an ostream, omitting the sweep block. More... | |
void | writeThermo (std::ostream &out) |
Write thermodynamic properties to a file. More... | |
Field Output | |
void | writeWBasis (const std::string &filename) |
Write chemical potential fields in symmetry adapted 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) |
Write concentrations in symmetry-adapted 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 specified 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 Data Output | |
void | writeStars (const std::string &filename) const |
Output information about stars and symmetrized basis functions. More... | |
void | writeWaves (const std::string &filename) const |
Output information about waves. More... | |
void | writeGroup (std::string const &filename) const |
Output all elements of the space group. More... | |
Field File Operations | |
void | basisToRGrid (const std::string &inFileName, const std::string &outFileName) |
Convert a field from symmetry-adapted basis 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... | |
Member Object Accessors | |
WFieldContainer< D > const & | w () const |
Get container of chemical potential fields. More... | |
CFieldContainer< D > const & | c () const |
Get container of monomer concentration / volume fration fields. More... | |
Mixture< D > & | mixture () |
Get Mixture by reference. More... | |
Interaction & | interaction () |
Get interaction (i.e., excess free energy model) by reference. More... | |
Interaction const & | interaction () const |
Get interaction (i.e., excess free energy model) by const ref. More... | |
Domain< D > const & | domain () const |
Get Domain by const reference. More... | |
Iterator< D > & | iterator () |
Get the iterator by reference. More... | |
UnitCell< D > const & | unitCell () const |
Get crystal UnitCell by const reference. More... | |
Mesh< D > const & | mesh () const |
Get spatial discretization Mesh by const reference. More... | |
Basis< D > const & | basis () const |
Get the Basis by reference. More... | |
FieldIo< D > const & | fieldIo () const |
Get the FieldIo by const reference. More... | |
FFT< D > const & | fft () const |
Get the FFT object by reference. More... | |
Homogeneous::Mixture & | homogeneous () |
Get homogeneous mixture (for reference calculations). More... | |
FileMaster & | fileMaster () |
Get FileMaster by reference. More... | |
Queries | |
bool | hasCFields () const |
Have monomer concentration fields (c fields) been computed? More... | |
bool | hasSweep () const |
Does this system have an associated 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 in SCFT simulation of one system.
A System has (among other components):
A System may also optionally contain Iterator and Sweep 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_pg1.cpp, pscf_pg2.cpp, and pscf_pg3.cpp
Definition at line 70 of file pspg/System.h.
Pscf::Pspg::System< D >::System |
Constructor.
Definition at line 43 of file pspg/System.tpp.
References Pscf::Pspg::ThreadGrid::init(), Util::BracketPolicy::set(), and Util::ParamComposite::setClassName().
Pscf::Pspg::System< D >::~System |
Destructor.
Definition at line 80 of file pspg/System.tpp.
void Pscf::Pspg::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 103 of file pspg/System.tpp.
References Util::Log::file(), Util::ParamComponent::setEcho(), Pscf::Pspg::ThreadGrid::setThreadsPerBlock(), and UTIL_THROW.
|
virtual |
Read input parameters (with opening and closing lines).
in | input parameter stream |
Reimplemented from Util::ParamComposite.
Definition at line 187 of file pspg/System.tpp.
void Pscf::Pspg::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 198 of file pspg/System.tpp.
|
virtual |
Read body of parameter file (without opening, closing lines).
in | input parameter stream |
Reimplemented from Util::ParamComposite.
Definition at line 204 of file pspg/System.tpp.
References Util::Log::file(), UTIL_CHECK, and UTIL_THROW.
void Pscf::Pspg::System< D >::readCommands | ( | std::istream & | in | ) |
Read command script.
in | command script file. |
Definition at line 285 of file pspg/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
void Pscf::Pspg::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 479 of file pspg/System.tpp.
References UTIL_THROW.
void Pscf::Pspg::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, which must contain chemical potential fields in symmetry-adapted basis format. The function copies these fields to set new values for the system w fields in basis format, and also computes and resets the system w fields in r-space 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 493 of file pspg/System.tpp.
void Pscf::Pspg::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 contains 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 511 of file pspg/System.tpp.
void Pscf::Pspg::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 531 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::setWRGrid | ( | DArray< RDField< 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 exit, w.rgrid() is reset, w().hasData() is true, hasCFields() is false and w().isSymmetric() is false.
fields | array of new w (chemical potential) fields |
Definition at line 541 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::setWRGrid | ( | DField< cudaReal > & | fields | ) |
Set new w fields, in unfolded real-space (r-grid) format.
The function parameter "fields" is an unfolded array containing r-grid fields for all monomer types in a single array, with the field for monomer 0 first, followed by the field for monomer 1, etc. This function sets w().rgrid() but does not set w().basis(). On exit, w().hasData is true, while w().isSymmetric() and hasCFields() are both false.
fields | unfolded array of new chemical potential fields |
Definition at line 551 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::symmetrizeWFields |
Symmetrize r-grid w-fields, compute basis components.
On exit, w().hasData() and w().isSymmetric() are true, while hasCFields() is false.
Definition at line 611 of file pspg/System.tpp.
void Pscf::Pspg::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 field container.
Upon return, w().hasData() and w().isSymmetric() are true, while hasCFields() is false.
filename | name of input c-field file (basis format) |
Definition at line 563 of file pspg/System.tpp.
References Util::DArray< Data >::allocate(), and UTIL_CHECK.
void Pscf::Pspg::System< D >::setUnitCell | ( | UnitCell< D > const & | unitCell | ) |
Set parameters of the associated unit cell.
The lattice system declared within the input unitCell must agree with Domain::lattice() on input if Domain::lattice() is not null.
unitCell | new UnitCell<D> (i.e., new parameters) |
Definition at line 620 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::setUnitCell | ( | typename UnitCell< D >::LatticeSystem< D > | lattice, |
FSArray< double, 6 > const & | parameters | ||
) |
Set state of the associated unit cell.
The lattice argument must agree with Domain::lattice() on input if Domain::lattice() is not null, and the size of the parameters array must agree with the expected number of lattice parameters.
lattice | lattice system |
parameters | array of new unit cell parameters. |
Definition at line 634 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::setUnitCell | ( | FSArray< double, 6 > const & | parameters | ) |
Set parameters of the associated unit cell.
The size of the FSArray<double, 6> parameters must agree with the expected number of parameters for the current lattice type.
parameters | array of new unit cell parameters. |
Definition at line 648 of file pspg/System.tpp.
void Pscf::Pspg::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 (wFields and wFieldRGrid). 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, and 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 663 of file pspg/System.tpp.
References UTIL_CHECK.
int Pscf::Pspg::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 (wFields and wFieldRGrid) and current unit cell parameter values as initial guesses. Upon exist, 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 iff continuation within a sweep |
Definition at line 685 of file pspg/System.tpp.
References Util::Log::file(), and UTIL_CHECK.
void Pscf::Pspg::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 is determined by implementation of a subclass of Sweep and the parameters passed to the sweep object in the parameter file.
Definition at line 716 of file pspg/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::Pspg::System< D >::computeFreeEnergy |
Compute free energy density and pressure for current fields.
This function should be called after a successful call of iterator().solve(). Resulting values are returned by the freeEnergy() and pressure() accessor functions.
Definition at line 735 of file pspg/System.tpp.
References Pscf::PolymerTmpl< Block >::length(), Pscf::Species::mu(), Pscf::Species::phi(), Pscf::Pspg::ThreadGrid::setThreadsLogical(), Pscf::SolventDescriptor::size(), and UTIL_CHECK.
|
inline |
Get precomputed Helmoltz free energy per monomer / kT.
The value retrieved by this function is pre-computed by the computeFreeEnergy() function.
Definition at line 983 of file pspg/System.h.
Referenced by pscfpp.output.Thermo::__init__(), and pscfpp.output.Thermo::read().
|
inline |
Get precomputed pressure times monomer volume / kT.
The value retrieved by this function is pre-computed by the computeFreeEnergy() function.
Definition at line 988 of file pspg/System.h.
Referenced by pscfpp.output.Thermo::__init__(), and pscfpp.output.Thermo::read().
void Pscf::Pspg::System< D >::writeParamNoSweep | ( | std::ostream & | out | ) | const |
Write parameter file to an ostream, omitting the 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.
Definition at line 852 of file pspg/System.tpp.
void Pscf::Pspg::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 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 865 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::writeWBasis | ( | const std::string & | filename | ) |
Write chemical potential fields in symmetry adapted basis format.
filename | name of output file |
Definition at line 922 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::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 933 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::System< D >::writeCBasis | ( | const std::string & | filename | ) |
Write concentrations in symmetry-adapted basis format.
filename | name of output file |
Definition at line 943 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::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 954 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::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, followed by solvent species ordered by solvent id.
filename | name of output file |
Definition at line 965 of file pspg/System.tpp.
References Util::DArray< Data >::allocate(), Util::Array< Data >::capacity(), and UTIL_CHECK.
void Pscf::Pspg::System< D >::writeQSlice | ( | std::string const & | filename, |
int | polymerId, | ||
int | blockId, | ||
int | directionId, | ||
int | segmentId | ||
) | const |
Write specified 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 986 of file pspg/System.tpp.
References Pscf::Pspg::RDField< D >::allocate(), Pscf::Pspg::DField< Data >::cDField(), Pscf::PolymerTmpl< Block >::nBlock(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspg::Propagator< D >::q(), and UTIL_CHECK.
void Pscf::Pspg::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 1011 of file pspg/System.tpp.
References Pscf::Pspg::RDField< D >::allocate(), Pscf::Pspg::DField< Data >::cDField(), Pscf::PolymerTmpl< Block >::nBlock(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspg::Propagator< D >::tail(), and UTIL_CHECK.
void Pscf::Pspg::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 1036 of file pspg/System.tpp.
References Pscf::Pspg::RDField< D >::allocate(), Pscf::Pspg::DField< Data >::cDField(), Pscf::PolymerTmpl< Block >::nBlock(), Pscf::Pspg::Propagator< D >::ns(), Pscf::PolymerTmpl< Block >::propagator(), Pscf::Pspg::Propagator< D >::q(), and UTIL_CHECK.
void Pscf::Pspg::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 1079 of file pspg/System.tpp.
References Util::toString().
void Pscf::Pspg::System< D >::writeStars | ( | const std::string & | filename | ) | const |
Output information about stars and symmetrized basis functions.
This function opens a file with the specified filename and then calls Basis::outputStars.
filename | name of output file |
Definition at line 1108 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::System< D >::writeWaves | ( | const std::string & | filename | ) | const |
Output information about waves.
This function opens a file with the specified filename and then calls Basis::outputWaves.
filename | name of output file |
Definition at line 1122 of file pspg/System.tpp.
References UTIL_CHECK.
void Pscf::Pspg::System< D >::writeGroup | ( | std::string const & | filename | ) | const |
Output all elements of the space group.
filename | name of output file |
Definition at line 1136 of file pspg/System.tpp.
void Pscf::Pspg::System< D >::basisToRGrid | ( | const std::string & | inFileName, |
const std::string & | outFileName | ||
) |
Convert a field from symmetry-adapted basis to r-grid format.
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 |
outFileName | name of output file |
Definition at line 1147 of file pspg/System.tpp.
void Pscf::Pspg::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 fields.
inFileName | name of input file |
outFileName | name of output file |
Definition at line 1169 of file pspg/System.tpp.
void Pscf::Pspg::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 |
outFileName | name of output file |
Definition at line 1191 of file pspg/System.tpp.
void Pscf::Pspg::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 |
outFileName | name of output file |
Definition at line 1215 of file pspg/System.tpp.
void Pscf::Pspg::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 fields.
inFileName | name of input file |
outFileName | name of output file |
Definition at line 1240 of file pspg/System.tpp.
void Pscf::Pspg::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 1262 of file pspg/System.tpp.
|
inline |
Get container of chemical potential fields.
Definition at line 972 of file pspg/System.h.
|
inline |
Get container of monomer concentration / volume fration fields.
Definition at line 978 of file pspg/System.h.
|
inline |
Get Mixture by reference.
Definition at line 903 of file pspg/System.h.
|
inline |
Get interaction (i.e., excess free energy model) by reference.
Definition at line 908 of file pspg/System.h.
References UTIL_ASSERT.
|
inline |
Get interaction (i.e., excess free energy model) by const ref.
Definition at line 916 of file pspg/System.h.
References UTIL_ASSERT.
|
inline |
Get Domain by const reference.
Definition at line 923 of file pspg/System.h.
|
inline |
Get the iterator by reference.
Definition at line 952 of file pspg/System.h.
References UTIL_ASSERT.
|
inline |
Get crystal UnitCell by const reference.
Definition at line 927 of file pspg/System.h.
|
inline |
Get spatial discretization Mesh by const reference.
Definition at line 932 of file pspg/System.h.
|
inline |
Get the Basis by reference.
Definition at line 937 of file pspg/System.h.
|
inline |
Get the FieldIo by const reference.
Definition at line 947 of file pspg/System.h.
|
inline |
Get the FFT object by reference.
Definition at line 942 of file pspg/System.h.
|
inline |
Get homogeneous mixture (for reference calculations).
Definition at line 966 of file pspg/System.h.
|
inline |
Get FileMaster by reference.
Definition at line 960 of file pspg/System.h.
|
inline |
Have monomer concentration fields (c fields) been computed?
Returns true if and only if monomer concentration fields have been computed by solving the modified diffusion equation for the current w fields.
Definition at line 993 of file pspg/System.h.
|
inline |
Does this system have an associated Sweep object?
Definition at line 998 of file pspg/System.h.