8 #include "RingTetraRebridgeMove.h" 9 #include <mcMd/mcSimulation/McSystem.h> 10 #include <mcMd/simulation/Simulation.h> 12 #include <mcMd/potentials/pair/McPairPotential.h> 14 #include <mcMd/chemistry/Molecule.h> 15 #include <mcMd/chemistry/Bond.h> 16 #include <mcMd/chemistry/Atom.h> 17 #include <simp/species/Ring.h> 18 #include <simp/boundary/Boundary.h> 69 loadParameter<int>(ar,
"speciesId",
speciesId_);
84 UTIL_THROW(
"nAtom < 4 for tetra rebridge move.");
117 Atom *aPtr, *bPtr, *cPtr, *dPtr;
118 Atom *lPtr, *hPtr, *lTmp, *hTmp;
121 int ibc, ida, iLow, iHigh, nSwap;
136 if (!found)
return false;
142 aPtr = &(molPtr->
atom(ia));
143 bPtr = &(molPtr->
atom(ib));
144 cPtr = &(molPtr->
atom(ic));
145 dPtr = &(molPtr->
atom(
id));
148 tetraEnergy(aPtr, bPtr, cPtr, dPtr, bondType, energy);
157 if (ibc < 0) ibc +=
nAtom_;
160 if (ida < 0) ida +=
nAtom_;
170 nSwap = (ibc + 1) / 2;
179 nSwap = (ida + 1) / 2;
183 for (
int j = 0; j < nSwap; ++j) {
223 double lenSq, minSq, maxSq;
238 if (lenSq >= maxSq || lenSq <= minSq) {
245 for (i = 1; i <
nAtom_; ++i) {
249 R_[i].add(
R_[i-1], dR);
254 idList =
new int[nAtom_ - 3];
255 for (i = 1; i < nAtom_ - 2; ++i) {
256 ic =
modId(ib+i,nAtom_);
257 id =
modId(ic+1,nAtom_);
262 if (lenSq > minSq && lenSq < maxSq) {
266 if (lenSq > minSq && lenSq < maxSq) {
270 if (lenSq > minSq && lenSq < maxSq) {
Bond & bond(int localId)
Get a specific Bond in this Molecule by non-const reference.
A System for use in a Markov chain Monte Carlo simulation.
A Vector is a Cartesian vector.
void incrementNAttempt()
Increment the number of attempted moves.
int nAtom() const
Get number of atoms per molecule for this Species.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
int modId(int id, int n)
Shift Atom index along a Ring.
bool scanBridge(Molecule *molPtr, int aId, int &cId)
Scan potential rebridging sites.
double upperBridge_
Upper bounds for trial length of a bridge.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void tetraEnergy(Atom *aPtr, Atom *bPtr, Atom *cPtr, Atom *dPtr, int bondType, double &energy)
Calculate the energy cost for rebriding a tetra group.
int typeId() const
Get the typeId for this covalent group.
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.
virtual void save(Serializable::OArchive &ar)
Save state to an archive.
A Species of ring polymers (abstract).
Saving / output archive for binary ostream.
double boltzmann(double energy)
Boltzmann weight associated with an energy difference.
virtual void readParameters(std::istream &in)
Read species to which displacement is applied.
virtual bool move()
Generate and accept or reject configuration bias move.
#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.
Simulation & simulation() const
Get the parent Simulation by reference.
A point particle within a Molecule.
Utility classes for scientific computation.
int speciesId_
Integer index for molecular species.
long uniformInt(long range1, long range2)
Return random long int x uniformly distributed in range1 <= x < range2.
Random & random()
Get Random number generator of parent Simulation.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
double lowerBridge_
Lower bounds for trial length of a bridge.
Boundary & boundary() const
Get the Boundary by reference.
DArray< Vector > R_
Arrays of atom positions of the correct molecule shape.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Vector & subtract(const Vector &v1, const Vector &v2)
Subtract vector v2 from v1.
void readProbability(std::istream &in)
Read the probability from file.
void setClassName(const char *className)
Set class name string.
RingTetraRebridgeMove(McSystem &system)
Constructor.
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.
int nAtom_
Number of atoms per molecule.
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.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
Species & species(int i)
Get a specific Species by reference.
double square() const
Return square magnitude of this vector.
void updateAtomCell(Atom &atom)
Update the cell list to reflect a new position.
Boundary & boundary()
Get Boundary object of parent McSystem.
Base class for rebridging a group of atoms forming a tetrahedron.