8 #include "EndSwapMove.h" 9 #include <mcMd/simulation/Simulation.h> 10 #include <mcMd/mcSimulation/McSystem.h> 12 #include <mcMd/chemistry/Molecule.h> 13 #include <mcMd/chemistry/Atom.h> 15 #include <simp/boundary/Boundary.h> 16 #include <simp/species/Species.h> 17 #include <simp/species/Linear.h> 44 UTIL_THROW(
"CfbEndBase unusable with heterogeneous dihedrals");
49 UTIL_THROW(
"CfbEndBase unusable with heterogeneous dihedrals");
65 int nAtom = speciesPtr->
nAtom();
68 if (speciesPtr->isMutable()) {
73 UTIL_THROW(
"EndSwapMove on Species that is not a Linear");
81 for (
int i = 0; i < nAtom; ++i) {
92 loadParameter<int>(ar,
"speciesId",
speciesId_);
97 int nAtom = speciesPtr->
nAtom();
99 UTIL_THROW(
"EndSwapMove applied to mutable species");
102 if (linearPtr == 0) {
103 UTIL_THROW(
"EndSwapMove applied to species that is not Linear");
105 if (nAtom != atomTypeIds_.capacity()) {
106 UTIL_THROW(
"Inconsistent capacity for atomTypeIds array");
127 double newEnergy, oldEnergy;
135 nAtom = molPtr->
nAtom();
143 if (
system().hasExternalPotential()) {
144 for (i = 0; i < nAtom; ++i) {
145 atomPtr = &molPtr->
atom(i);
152 for (i = 0; i < nAtom; ++i) {
163 if (
system().hasExternalPotential()) {
164 for (i = 0; i < nAtom; ++i) {
166 atomPtr = &molPtr->
atom(i);
173 for (i = 0; i < nAtom; ++i) {
183 for (i = 0; i < nAtom; ++i) {
188 for (i = 0; i < nAtom; ++i) {
189 atomPtr = &molPtr->
atom(i);
A System for use in a Markov chain Monte Carlo simulation.
virtual double atomEnergy(const Atom &atom) const =0
Calculate the external energy for one Atom.
void incrementNAttempt()
Increment the number of attempted moves.
int nAtom() const
Get number of atoms per molecule for this Species.
Include this file to include all MC potential energy classes at once.
bool hasDihedralPotential() const
Does a dihedral potential exist?.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
bool hasAnglePotential() const
Does angle potential exist?.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
Saving / output archive for binary ostream.
double boltzmann(double energy)
Boltzmann weight associated with an energy difference.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
McSystem & system()
Get parent McSystem.
Molecule & randomMolecule(int speciesId)
Get a random Molecule of a specified species in this System.
void incrementNAccept()
Increment the number of accepted moves.
int typeId() const
Get type index for this Atom.
ExternalPotential & externalPotential() const
Return ExternalPotential by reference.
A point particle within a Molecule.
virtual double moleculeEnergy(const Molecule &molecule) const =0
Calculate the nonbonded pair energy for an entire Molecule.
Utility classes for scientific computation.
An McMove that acts on one McSystem.
int speciesId_
Integer index for molecular species.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
virtual void readParameters(std::istream &in)
Read species to which displacement is applied.
Random & random()
Get Random number generator of parent Simulation.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void setTypeId(int typeId)
Set the atomic type index.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
virtual bool move()
Generate and accept or reject a move.
bool isMutable() const
Is this a mutable Species?
void readProbability(std::istream &in)
Read the probability from file.
DArray< int > atomTypeIds_
Array of atom type indices.
void setClassName(const char *className)
Set class name string.
const Atom & atom(int localId) const
Get a specific Atom in this Molecule.
bool metropolis(double ratio)
Metropolis algorithm for whether to accept a MC move.
void allocate(int capacity)
Allocate the underlying C array.
Simulation & simulation()
Get parent Simulation object.
A physical molecule (a set of covalently bonded Atoms).
const Vector & position() const
Get the position Vector by const reference.
EndSwapMove(McSystem &system)
Constructor.
A Species represents a set of chemically similar molecules.
Species & species(int i)
Get a specific Species by reference.
void updateAtomCell(Atom &atom)
Update the cell list to reflect a new position.
A Species of linear polymers (abstract).
DArray< Vector > positions_
Array of atomic positions (temporary).
int nAtom() const
Get the number of Atoms in this Molecule.