8 #include "HybridNphMdMove.h" 9 #include <mcMd/mcSimulation/McSystem.h> 10 #include <mcMd/mdIntegrators/MdIntegrator.h> 11 #include <mcMd/mdSimulation/MdSystem.h> 12 #include <mcMd/simulation/Simulation.h> 13 #include <mcMd/chemistry/Atom.h> 15 #include <mcMd/potentials/pair/MdPairPotential.h> 16 #include <mcMd/potentials/pair/McPairPotential.h> 18 #include <simp/ensembles/BoundaryEnsemble.h> 19 #include <simp/boundary/OrthorhombicBoundary.h> 40 oldPositions_.allocate(
simulation().atomCapacity());
59 read<int>(in,
"nStep", nStep_);
65 mode_ = nphIntegratorPtr_->
mode();
74 loadParameter<int>(ar,
"nStep", nStep_);
79 mode_ = nphIntegratorPtr_->
mode();
100 double oldEnergy, newEnergy;
106 if (nphIntegratorPtr_ == NULL) {
116 for (iSpec = 0; iSpec < nSpec; ++iSpec) {
117 mdSystemPtr_->
begin(iSpec, molIter);
118 for ( ; molIter.
notEnd(); ++molIter) {
119 for (molIter->begin(atomIter); atomIter.
notEnd(); ++atomIter) {
120 oldPositions_[atomIter->id()] = atomIter->position();
131 nphIntegratorPtr_->
setup();
140 if (mode_ == Cubic) {
143 double sigma = sqrt(temp/barostatMass_);
145 }
else if (mode_ == Tetragonal) {
148 double sigma1 = sqrt(temp/barostatMass_);
150 double sigma2 = sqrt(temp/barostatMass_/2.0);
152 }
else if (mode_ == Orthorhombic) {
155 double sigma = sqrt(temp/barostatMass_);
168 for (
int iStep = 0; iStep < nStep_; ++iStep) {
169 nphIntegratorPtr_->
step();
200 for (iSpec = 0; iSpec < nSpec; ++iSpec) {
201 mdSystemPtr_->
begin(iSpec, molIter);
202 for ( ; molIter.
notEnd(); ++molIter) {
203 molIter->begin(atomIter);
204 for ( ; atomIter.
notEnd(); ++atomIter) {
205 atomIter->position() = oldPositions_[atomIter->id()];
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
virtual void readParameters(std::istream &in)
Read nStep and MdSystem parameters from file.
A System for use in a Markov chain Monte Carlo simulation.
A Vector is a Cartesian vector.
virtual void setup()
Setup private variables before main loop.
void buildCellList()
Build the CellList with current configuration.
void calculateForces()
Compute all forces in this System.
void incrementNAttempt()
Increment the number of attempted moves.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
double pressure() const
Get the target pressure.
~HybridNphMdMove()
Destructor.
bool notEnd() const
Is the current pointer not at the end of the array?
double volume() const
Return unit cell volume.
void setOrthorhombic(const Vector &lengths)
Set unit cell dimensions for orthorhombic boundary.
const Vector & lengths() const
Get Vector of unit cell lengths by const reference.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void loadParamComposite(Serializable::IArchive &ar, ParamComposite &child, bool next=true)
Add and load a required child ParamComposite.
EnergyEnsemble & energyEnsemble() const
Get the EnergyEnsemble by reference.
virtual double barostatEnergy()
Get the barostat energy.
MdIntegrator & mdIntegrator()
Return the MdIntegrator by reference.
virtual void step()
Take a complete NVE MD integration step.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
BoundaryEnsemble & boundaryEnsemble() const
Get the BoundaryEnsemble by reference.
double potentialEnergy()
Compute and return total potential energy.
Classes used by all simpatico molecular simulations.
bool move()
Generate, attempt and accept or reject a move.
virtual LatticeSystem mode() const
Get the integrator mode.
Saving / output archive for binary ostream.
double boltzmann(double energy)
Boltzmann weight associated with an energy difference.
MdPairPotential & pairPotential() const
Return MdPairPotential by reference.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
McSystem & system()
Get parent McSystem.
void incrementNAccept()
Increment the number of accepted moves.
virtual double barostatMass() const
Get the barostat mass.
HybridNphMdMove(McSystem &system)
Constructor.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
void setBoltzmannVelocities(double temperature)
Set all velocities to Boltzmann distributed random values.
An McMove that acts on one McSystem.
double gaussian(void)
Return a Gaussian random number with zero average and unit variance.
virtual void setEta(unsigned int index, double eta)
Get the barostat momentum.
Forward iterator for an Array or a C array.
double kineticEnergy() const
Compute and return total kinetic energy.
Forward iterator for a PArray.
Random & random()
Get Random number generator of parent Simulation.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
An explictly reversible/measure-preserving Parrinello-Rahman type NPH integrator. ...
Boundary & boundary() const
Get the Boundary by reference.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
void buildPairList()
Build the internal PairList.
void readProbability(std::istream &in)
Read the probability from file.
void setClassName(const char *className)
Set class name string.
void readParamComposite(std::istream &in, ParamComposite &child, bool next=true)
Add and read a required child ParamComposite.
bool metropolis(double ratio)
Metropolis algorithm for whether to accept a MC move.
A System for Molecular Dynamics simulation.
Simulation & simulation()
Get parent Simulation object.
double temperature() const
Return the temperature.
EnergyEnsemble & energyEnsemble()
Get EnergyEnsemble object of parent McSystem.
virtual void saveParameters(Serializable::OArchive &ar)
Save parameters to an archive, without configuration.
Random & random()
Get the random number generator by reference.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.