Simpatico
v1.10
|
Coulomb potential for an Md simulation.
This class computes the long-range k-space part of the Coulomb forces and energies in a molecular dynamics (MD) simulation, and provides accessors for both r-space and k-space contributions to the Coulomb energy and stress.
Definition at line 33 of file MdCoulombPotential.h.
#include <MdCoulombPotential.h>
Public Member Functions | |
MdCoulombPotential () | |
Constructor. More... | |
virtual | ~MdCoulombPotential () |
Destructor (does nothing). More... | |
virtual void | set (std::string name, double value) |
Modify an interaction parameter, identified by a string. More... | |
virtual double | get (std::string name) const |
Get an interaction parameter value, identified by a string. More... | |
Waves (data that depends on Boundary). | |
bool | hasWaves () |
Are wavevectors and k-space influence function up to date? More... | |
virtual void | makeWaves ()=0 |
Generate wavevectors and influence function for this boundary. More... | |
void | unsetWaves () |
Unset all data that depends on the Boundary. More... | |
virtual int | nWave () const =0 |
Current number of wavevectors. More... | |
Forces and Energy | |
virtual void | addForces ()=0 |
Add k-space Coulomb forces to forces on all atoms. More... | |
virtual void | computeEnergy ()=0 |
Calculate the long range kspace part of Coulomb energy. More... | |
virtual void | unsetEnergy () |
Unset k-space energy. More... | |
double | kSpaceEnergy () |
Get long-range k-space part of Coulomb energy. More... | |
double | rSpaceEnergy () |
Return short-range r-space part of Coulomb energy. More... | |
double | energy () |
Get total Coulomb energy. More... | |
Stress | |
virtual void | computeStress ()=0 |
Compute kspace part of Coulomb stress. More... | |
virtual void | unsetStress () |
Unset k-space stress. More... | |
Tensor | kSpaceStress () |
Get long-range k-space part of Coulomb stress. More... | |
Tensor | rSpaceStress () |
Return short-range r-space part of Coulomb stress. More... | |
Tensor | stress () |
Get total Coulomb stress. More... | |
void | computeStress (Tensor &stress) |
Get total Coulomb stress. More... | |
void | computeStress (Vector &pressures) |
Get diagonal components of Coulomb stress. More... | |
double | pressure () |
Get total Coulomb pressure. More... | |
void | computeStress (double &pressure) |
Get the total Coulomb pressure. 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 | readParam (std::istream &in) |
Read the parameter file block. More... | |
virtual void | readParamOptional (std::istream &in) |
Read optional parameter file block. More... | |
virtual void | readParameters (std::istream &in) |
Read the body of parameter block, without begin and end lines. More... | |
virtual void | writeParam (std::ostream &out) |
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 > | |
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 > | |
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... | |
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... | |
![]() | |
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... | |
Protected Attributes | |
EwaldRSpaceAccumulator | rSpaceAccumulator_ |
Short-range real space energy and stress contributions. More... | |
Setable< double > | kSpaceEnergy_ |
K-space part of Coulomb energy. More... | |
Setable< Tensor > | kSpaceStress_ |
K-space part of Coulomb stress. More... | |
bool | isInitialized_ |
Have parameters been set? More... | |
bool | hasWaves_ |
Are waves and k-space potential up to date? Unset if boundary or parameters change. 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 > | |
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... | |
McMd::MdCoulombPotential::MdCoulombPotential | ( | ) |
Constructor.
Definition at line 23 of file MdCoulombPotential.cpp.
References Util::ParamComposite::setClassName().
|
virtual |
Destructor (does nothing).
Definition at line 31 of file MdCoulombPotential.cpp.
|
virtual |
Modify an interaction parameter, identified by a string.
name | parameter name |
value | new value of parameter |
Reimplemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Definition at line 41 of file MdCoulombPotential.cpp.
References UTIL_THROW.
|
virtual |
Get an interaction parameter value, identified by a string.
name | parameter name |
Reimplemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Definition at line 53 of file MdCoulombPotential.cpp.
References UTIL_THROW.
|
inline |
Are wavevectors and k-space influence function up to date?
Definition at line 216 of file MdCoulombPotential.h.
Referenced by McMd::MdEwaldPotential::makeWaves(), and McMd::MdSpmePotential::makeWaves().
|
pure virtual |
Generate wavevectors and influence function for this boundary.
Implemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Referenced by McMd::MdSystem::generateMolecules(), McMd::MdSystem::loadConfig(), McMd::MdSystem::readConfig(), and McMd::MdSimulation::simulate().
void McMd::MdCoulombPotential::unsetWaves | ( | ) |
Unset all data that depends on the Boundary.
Unsets stored values of waves, influence function, energy and stress.
Definition at line 62 of file MdCoulombPotential.cpp.
References hasWaves_, unsetEnergy(), and unsetStress().
Referenced by McMd::MdEwaldPotential::set(), and McMd::MdSpmePotential::set().
|
pure virtual |
Current number of wavevectors.
Implemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Referenced by McMd::MdSystem::readConfig().
|
pure virtual |
Add k-space Coulomb forces to forces on all atoms.
Implemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Referenced by McMd::MdSystem::calculateForces().
|
pure virtual |
Calculate the long range kspace part of Coulomb energy.
Implemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Referenced by kSpaceEnergy().
|
virtual |
Unset k-space energy.
Definition at line 72 of file MdCoulombPotential.cpp.
References kSpaceEnergy_, and Util::Setable< T >::unset().
Referenced by McMd::MdSystem::unsetPotentialEnergy(), and unsetWaves().
double McMd::MdCoulombPotential::kSpaceEnergy | ( | ) |
Get long-range k-space part of Coulomb energy.
Recomputes iff necessary (i.e., if not set).
Definition at line 78 of file MdCoulombPotential.cpp.
References computeEnergy(), Util::Setable< T >::isSet(), kSpaceEnergy_, and Util::Setable< T >::value().
Referenced by energy(), and McMd::MdEnergyAnalyzer::sample().
double McMd::MdCoulombPotential::rSpaceEnergy | ( | ) |
Return short-range r-space part of Coulomb energy.
Uses associated pair potential to recompute iff necessary.
Definition at line 89 of file MdCoulombPotential.cpp.
References rSpaceAccumulator_, and McMd::EwaldRSpaceAccumulator::rSpaceEnergy().
Referenced by energy(), and McMd::MdEnergyAnalyzer::sample().
double McMd::MdCoulombPotential::energy | ( | ) |
Get total Coulomb energy.
Invokes kSpaceEnergy() and rSpaceEnergy() internally, and thus recomputes k-space and r-space components as needed.
Definition at line 95 of file MdCoulombPotential.cpp.
References kSpaceEnergy(), and rSpaceEnergy().
Referenced by McMd::MdEwaldPotential::computeEnergy(), McMd::MdSpmePotential::computeEnergy(), McMd::MdSystem::potentialEnergy(), McMd::MdEnergyOutput::sample(), and McMd::MdEnergyAnalyzer::sample().
|
pure virtual |
Compute kspace part of Coulomb stress.
Implemented in McMd::MdEwaldPotential, and McMd::MdSpmePotential.
Referenced by McMd::MdSystem::kineticEnergy(), and kSpaceStress().
|
virtual |
Unset k-space stress.
Definition at line 106 of file MdCoulombPotential.cpp.
References kSpaceStress_.
Referenced by McMd::MdSystem::unsetVirialStress(), and unsetWaves().
Tensor McMd::MdCoulombPotential::kSpaceStress | ( | ) |
Get long-range k-space part of Coulomb stress.
Recomputes iff necessary.
Definition at line 112 of file MdCoulombPotential.cpp.
References computeStress(), and kSpaceStress_.
Referenced by computeStress(), and stress().
Tensor McMd::MdCoulombPotential::rSpaceStress | ( | ) |
Return short-range r-space part of Coulomb stress.
Directs associated pair potential to recompute if necessary.
Definition at line 123 of file MdCoulombPotential.cpp.
References rSpaceAccumulator_, and McMd::EwaldRSpaceAccumulator::rSpaceStress().
Tensor McMd::MdCoulombPotential::stress | ( | ) |
Get total Coulomb stress.
Calls kSpaceStress() and rSpaceStress() internally, and thus recomputes k-space and r-space components as needed.
Definition at line 129 of file MdCoulombPotential.cpp.
References kSpaceStress(), rSpaceAccumulator_, and McMd::EwaldRSpaceAccumulator::rSpaceStress().
Referenced by McMd::MdSpmePotential::computeStress(), computeStress(), and pressure().
void McMd::MdCoulombPotential::computeStress | ( | Tensor & | stress | ) |
Get total Coulomb stress.
Equivalent to Tensor stress().
Definition at line 153 of file MdCoulombPotential.cpp.
References kSpaceStress(), rSpaceAccumulator_, and McMd::EwaldRSpaceAccumulator::rSpaceStress().
void McMd::MdCoulombPotential::computeStress | ( | Vector & | pressures | ) |
Get diagonal components of Coulomb stress.
Definition at line 162 of file MdCoulombPotential.cpp.
References Util::Dimension, and stress().
double McMd::MdCoulombPotential::pressure | ( | ) |
Get total Coulomb pressure.
Definition at line 140 of file MdCoulombPotential.cpp.
References Util::Dimension, and stress().
void McMd::MdCoulombPotential::computeStress | ( | double & | pressure | ) |
Get the total Coulomb pressure.
Get Coulomb pressure.
Equivalent to double pressure().
Definition at line 175 of file MdCoulombPotential.cpp.
References Util::Dimension, and stress().
|
protected |
Short-range real space energy and stress contributions.
Definition at line 195 of file MdCoulombPotential.h.
Referenced by computeStress(), rSpaceEnergy(), rSpaceStress(), and stress().
|
protected |
K-space part of Coulomb energy.
Definition at line 198 of file MdCoulombPotential.h.
Referenced by McMd::MdEwaldPotential::computeEnergy(), McMd::MdSpmePotential::computeEnergy(), kSpaceEnergy(), and unsetEnergy().
K-space part of Coulomb stress.
Definition at line 201 of file MdCoulombPotential.h.
Referenced by McMd::MdEwaldPotential::computeStress(), McMd::MdSpmePotential::computeStress(), kSpaceStress(), and unsetStress().
|
protected |
Have parameters been set?
Definition at line 204 of file MdCoulombPotential.h.
|
protected |
Are waves and k-space potential up to date? Unset if boundary or parameters change.
Definition at line 208 of file MdCoulombPotential.h.
Referenced by McMd::MdEwaldPotential::makeWaves(), McMd::MdSpmePotential::makeWaves(), and unsetWaves().