10 #include "GroupRebridgeBase.h" 14 #include <mcMd/chemistry/getAtomGroups.h> 30 UTIL_THROW(
"GroupEndBase is unusable with dihedrals");
54 int bondType,
double &energy)
60 double lab, lcd, lac, lbd;
94 if (
system().hasAnglePotential()) {
97 const Atom *amPtr(NULL), *bpPtr(NULL), *cmPtr(NULL), *dpPtr(NULL);
101 int iBond, angleType;
107 angleType = angles[0]->typeId();
111 for (iBond = 0; iBond < bonds.
size(); ++iBond) {
112 bondPtr = bonds[iBond];
113 if (&bondPtr->
atom(0) != aPtr && &bondPtr->
atom(0) != bPtr) {
114 amPtr = &bondPtr->
atom(0);
115 }
else if (&bondPtr->
atom(1) != aPtr && &bondPtr->
atom(1) != bPtr){
116 amPtr = &bondPtr->
atom(1);
122 for (iBond = 0; iBond < bonds.
size(); ++iBond) {
123 bondPtr = bonds[iBond];
124 if (&bondPtr->
atom(0) != bPtr && &bondPtr->
atom(0) != aPtr) {
125 bpPtr = &bondPtr->
atom(0);
126 }
else if (&bondPtr->
atom(1) != bPtr && &bondPtr->
atom(1) != aPtr){
127 bpPtr = &bondPtr->
atom(1);
133 for (iBond = 0; iBond < bonds.
size(); ++iBond) {
134 bondPtr = bonds[iBond];
135 if (&bondPtr->
atom(0) != cPtr && &bondPtr->
atom(0) != dPtr) {
136 cmPtr = &bondPtr->
atom(0);
137 }
else if (&bondPtr->
atom(1) != cPtr && &bondPtr->
atom(1) != dPtr){
138 cmPtr = &bondPtr->
atom(1);
144 for (iBond = 0; iBond < bonds.
size(); ++iBond) {
145 bondPtr = bonds[iBond];
146 if (&bondPtr->
atom(0) != dPtr && &bondPtr->
atom(0) != cPtr) {
147 dpPtr = &bondPtr->
atom(0);
148 }
else if (&bondPtr->
atom(1) != cPtr && &bondPtr->
atom(1) != dPtr){
149 dpPtr = &bondPtr->
atom(1);
154 energy -=
angleEnergy(*amPtr, *aPtr, *bPtr, angleType);
155 energy -=
angleEnergy(*aPtr, *bPtr, *bpPtr, angleType);
158 energy -=
angleEnergy(*cmPtr, *cPtr, *dPtr, angleType);
159 energy -=
angleEnergy(*cPtr, *dPtr, *dpPtr, angleType);
162 energy +=
angleEnergy(*amPtr, *aPtr, *cPtr, angleType);
163 energy +=
angleEnergy(*aPtr, *cPtr, *cmPtr, angleType);
166 energy +=
angleEnergy(*bpPtr, *bPtr, *dPtr, angleType);
167 energy +=
angleEnergy(*bPtr, *dPtr, *dpPtr, angleType);
189 Atom* mPtr,
Atom* nPtr,
int bondType,
double &energy)
197 double lam, lmb, lcn, lnd;
198 double lan, lnb, lcm, lmd;
A System for use in a Markov chain Monte Carlo simulation.
A Vector is a Cartesian vector.
virtual double energy(double rsq, int iAtomType, int jAtomType) const =0
Return pair energy for a single pair.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
Include this file to include all MC potential energy classes at once.
BondPotential & bondPotential() const
Return the BondPotential by reference.
bool hasDihedralPotential() const
Does a dihedral potential exist?.
void tetraEnergy(Atom *aPtr, Atom *bPtr, Atom *cPtr, Atom *dPtr, int bondType, double &energy)
Calculate the energy cost for rebriding a tetra group.
File containing preprocessor macros for error handling.
A fixed capacity (static) contiguous array with a variable logical size.
void getAtomAngles(const Atom &atom, AtomAngleArray &groups)
Fill an array of pointers to Angles that contain an Atom.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual ~GroupRebridgeBase()
Destructor.
McSystem & system()
Get parent McSystem.
int typeId() const
Get type index for this Atom.
A point particle within a Molecule.
Utility classes for scientific computation.
GroupRebridgeBase(McSystem &system)
Constructor.
An McMove that acts on one McSystem.
void octaEnergy(Atom *aPtr, Atom *bPtr, Atom *cPtr, Atom *dPtr, Atom *mPtr, Atom *nPtr, int bondType, double &energy)
Calculate the energy cost for rebriding an octa group.
Atom & atom(int i)
Get a specific Atom in the Group by reference.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
virtual double energy(double rSq, int type) const =0
Returns potential energy for one bond.
double angleEnergy(const Atom &a, const Atom &b, const Atom &c, int type)
Calculate the angle energy for a bead triple.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A sequence of NAtom covalently interacting atoms.
const Vector & position() const
Get the position Vector by const reference.
int size() const
Return logical size of this array (i.e., number of elements).
void getAtomBonds(const Atom &atom, AtomBondArray &groups)
Fill an array of pointers to Bonds that contain an Atom.
Boundary & boundary()
Get Boundary object of parent McSystem.