Changes in src/analysis_bonds.cpp [2fe971:bf3817]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_bonds.cpp
r2fe971 rbf3817 6 6 */ 7 7 8 // include config.h 9 #ifdef HAVE_CONFIG_H 10 #include <config.h> 11 #endif 12 8 13 #include "Helpers/MemDebug.hpp" 9 14 … … 12 17 #include "bond.hpp" 13 18 #include "element.hpp" 14 #include " info.hpp"15 #include " verbose.hpp"16 #include " log.hpp"19 #include "Helpers/Info.hpp" 20 #include "Helpers/Verbose.hpp" 21 #include "Helpers/Log.hpp" 17 22 #include "molecule.hpp" 18 23 … … 60 65 int AtomNo = 0; 61 66 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 62 if ((*iter)-> type== type1)67 if ((*iter)->getType() == type1) 63 68 for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++) 64 if ((*BondRunner)->GetOtherAtom((*iter))-> type== type2) {69 if ((*BondRunner)->GetOtherAtom((*iter))->getType() == type2) { 65 70 const double distance = (*BondRunner)->GetDistanceSquared(); 66 71 if (Min > distance) … … 87 92 * \return angle between \a *first and \a *second, both relative to origin at \a *origin. 88 93 */ 89 double CalculateAngle( Vector *first, Vector *central, Vector *second)94 double CalculateAngle(const Vector &first, const Vector ¢ral, const Vector &second) 90 95 { 91 96 Vector OHBond; 92 97 Vector OOBond; 93 98 94 OHBond = (*first) - (*central);95 OOBond = (*second) - (*central);99 OHBond = first - central; 100 OOBond = second - central; 96 101 const double angle = OHBond.Angle(OOBond); 97 102 return angle; … … 110 115 111 116 // check angle 112 if (CalculateAngle( &Hydrogen->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) {117 if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) { 113 118 return true; 114 119 } else { … … 138 143 molecule::iterator Runner = (*MolRunner)->begin(); 139 144 for(;Runner!=(*MolRunner)->end();++Runner){ 140 if (((*Walker)-> type->Z == 8) && ((*Runner)->type->Z == 8)) {145 if (((*Walker)->getType()->Z == 8) && ((*Runner)->getType()->Z == 8)) { 141 146 // check distance 142 const double distance = (*Runner)-> x.DistanceSquared((*Walker)->x);147 const double distance = (*Runner)->DistanceSquared(*(*Walker)); 143 148 if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means different atoms 144 149 // on other atom(Runner) we check for bond to interface element and … … 152 157 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 153 158 // if hydrogen, check angle to be greater(!) than 30 degrees 154 if (OtherAtom-> type->Z == 1) {155 const double angle = CalculateAngle( &OtherAtom->x, &(*Runner)->x, &(*Walker)->x);159 if (OtherAtom->getType()->Z == 1) { 160 const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition()); 156 161 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 157 162 Otherangle += angle; 158 163 OtherHydrogens++; 159 164 } 160 InterfaceFlag = InterfaceFlag || (OtherAtom-> type== InterfaceElement);161 Interface2Flag = Interface2Flag || (OtherAtom-> type== Interface2Element);165 InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement); 166 Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element); 162 167 } 163 168 DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl); … … 177 182 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) { 178 183 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 179 if (OtherAtom-> type->Z == 1) {184 if (OtherAtom->getType()->Z == 1) { 180 185 // check angle 181 186 if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) { 182 DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle( &OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);187 DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(OtherAtom->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(180./M_PI) << "." << endl); 183 188 count++; 184 189 break; … … 210 215 for(;Walker!=(*MolWalker)->end();++Walker){ 211 216 atom * theAtom = *Walker; 212 if ((theAtom-> type == first) || (theAtom->type== second)) { // first element matches217 if ((theAtom->getType() == first) || (theAtom->getType() == second)) { // first element matches 213 218 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 214 219 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 215 if (((OtherAtom-> type == first) || (OtherAtom->type== second)) && (theAtom->nr < OtherAtom->nr)) {220 if (((OtherAtom->getType() == first) || (OtherAtom->getType() == second)) && (theAtom->nr < OtherAtom->nr)) { 216 221 count++; 217 222 DoLog(1) && (Log() << Verbose(1) << *first << "-" << *second << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl); … … 246 251 for(;Walker!=(*MolWalker)->end();++Walker){ 247 252 atom *theAtom = *Walker; 248 if (theAtom-> type== second) { // first element matches253 if (theAtom->getType() == second) { // first element matches 249 254 for (int i=0;i<2;i++) 250 255 MatchFlag[i] = false; … … 252 257 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 253 258 for (int i=0;i<2;i++) 254 if ((!MatchFlag[i]) && (OtherAtom-> type== ElementArray[i])) {259 if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) { 255 260 MatchFlag[i] = true; 256 261 break; // each bonding atom can match at most one element we are looking for
Note:
See TracChangeset
for help on using the changeset viewer.