3 #ifndef MCMD_MC_PAIR_PERTURBATION_H 4 #define MCMD_MC_PAIR_PERTURBATION_H 14 #include <mcMd/perturb/LinearPerturbation.h> 15 #include <mcMd/neighbor/CellList.h> 17 #include <mcMd/mcSimulation/McSystem.h> 18 #include <mcMd/potentials/pair/McPairPotentialImpl.h> 19 #include <mcMd/chemistry/Atom.h> 20 #include <simp/ensembles/EnergyEnsemble.h> 40 template <
class Interaction >
65 virtual void readParameters(std::istream& in);
77 virtual void setParameter();
85 virtual double parameter(
int i)
const;
93 virtual double derivative(
int i)
const;
98 Interaction& interaction()
const;
106 mutable Interaction* interactionPtr_;
121 template <
class Interaction >
131 template <
class Interaction >
138 template <
class Interaction >
148 template <
class Interaction >
158 template <
class Interaction >
161 if (interactionPtr_ == 0) {
166 UTIL_THROW(
"Failed dynamic cast of McPairPotential");
170 return *interactionPtr_;
176 template <
class Interaction >
183 template <
class Interaction >
186 if (i > nParameters_) {
187 UTIL_THROW(
"perturbation parameter index is out of bounds");
195 template <
class Interaction >
199 if (i > nParameters_) {
200 UTIL_THROW(
"perturbation parameter index is out of bounds");
203 UTIL_THROW(
"Perturbation parameter is not set correctly");
205 if (!
system().energyEnsemble().isIsothermal()) {
206 UTIL_THROW(
"Non isothermal ensemble for McPairPerturbation.");
210 Atom *jAtomPtr, *kAtomPtr;
211 int nNeighbor, nInCell;
212 int ic, nc, j, k, jId, kId, jType, kType;
217 for (ic = 0; ic < nc; ++ic) {
221 nNeighbor = neighbors_.
size();
224 for (j = 0; j < nInCell; ++j) {
225 jAtomPtr = neighbors_[j];
226 jId = jAtomPtr->
id();
227 jType = jAtomPtr->
typeId();
230 for (k = 0; k < nNeighbor; ++k) {
231 kAtomPtr = neighbors_[k];
232 kId = kAtomPtr->
id();
233 kType = kAtomPtr->
typeId();
236 if (kId > jId && jType != kType) {
261 UTIL_THROW(
"Non isothermal ensemble for McPairPerturbation.");
270 #endif // #ifndef SIMP_NOPAIR 271 #endif // ifdef MCMD_PERTURB DArray< double > parameter_
Value of the perturbation parameter for the associated System.
virtual double parameter(int i) const
Return the pair parameter epsilon(0,1) for this System.
A System for use in a Markov chain Monte Carlo simulation.
Interaction & interaction() const
Return the pair potential interaction.
const CellList & cellList() const
Get the cellList by const reference.
virtual void setParameter()
Set pair interaction parameter epsilon(0,1) for this System.
A Perturbation that is a linear function of a parameter.
A PairPotential for MC simulations (abstract).
EnergyEnsemble & energyEnsemble() const
Get the EnergyEnsemble by reference.
Mask & mask()
Get the associated Mask by reference.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
Classes used by all simpatico molecular simulations.
virtual void readParameters(std::istream &in)
Read parameter epsilon(0, 1) from file.
bool isMasked(const Atom &atom) const
True if the atom is in the masked set for the target Atom.
double beta() const
Return the inverse temperature.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Implementation template for an McPairPotential.
int typeId() const
Get type index for this Atom.
void getCellNeighbors(int ic, NeighborArray &neighbors, int &nInCell) const
Fill an array with pointers to atoms in a cell and neighboring cells.
bool isIsothermal() const
Is this an Isothermal ensemble?
A point particle within a Molecule.
Utility classes for scientific computation.
int getNParameters() const
Gets the number of parameters per system.
int id() const
Get global index for this Atom within the Simulation.
Interaction & interaction()
Return reference to underlying pair interaction.
int totCells() const
Get total number of cells in this CellList.
A Perturbation in the pair interaction epsilon(0,1) for any pair potential supporting setEpsilon()...
McSystem & system() const
Get the associated System by reference.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
virtual double derivative(int i) const
Return (0-1 pair energy) / ( kT *epsilon(0,1) )
Boundary & boundary() const
Get the Boundary by reference.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void setClassName(const char *className)
Set class name string.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
const Vector & position() const
Get the position Vector by const reference.
McPairPerturbation(McSystem &system, int size, int rank)
Constructor.
int size() const
Return logical size of this array (i.e., number of elements).
void readParameters(std::istream &in)
Read perturbation parameter(s) from file.