Changes in src/analysis_bonds.cpp [d74077:952f38]
- File:
-
- 1 edited
-
src/analysis_bonds.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_bonds.cpp
rd74077 r952f38 12 12 #include "bond.hpp" 13 13 #include "element.hpp" 14 #include " info.hpp"15 #include " verbose.hpp"16 #include " log.hpp"14 #include "Helpers/Info.hpp" 15 #include "Helpers/Verbose.hpp" 16 #include "Helpers/Log.hpp" 17 17 #include "molecule.hpp" 18 18 … … 60 60 int AtomNo = 0; 61 61 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 62 if ((*iter)-> getType()== type1)62 if ((*iter)->type == type1) 63 63 for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++) 64 if ((*BondRunner)->GetOtherAtom((*iter))-> getType()== type2) {64 if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) { 65 65 const double distance = (*BondRunner)->GetDistanceSquared(); 66 66 if (Min > distance) … … 87 87 * \return angle between \a *first and \a *second, both relative to origin at \a *origin. 88 88 */ 89 double CalculateAngle( const Vector &first, const Vector ¢ral, const Vector &second)89 double CalculateAngle(Vector *first, Vector *central, Vector *second) 90 90 { 91 91 Vector OHBond; 92 92 Vector OOBond; 93 93 94 OHBond = first - central;95 OOBond = second - central;94 OHBond = (*first) - (*central); 95 OOBond = (*second) - (*central); 96 96 const double angle = OHBond.Angle(OOBond); 97 97 return angle; … … 110 110 111 111 // check angle 112 if (CalculateAngle( Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) {112 if (CalculateAngle(&Hydrogen->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) { 113 113 return true; 114 114 } else { … … 138 138 molecule::iterator Runner = (*MolRunner)->begin(); 139 139 for(;Runner!=(*MolRunner)->end();++Runner){ 140 if (((*Walker)-> getType()->Z == 8) && ((*Runner)->getType()->Z == 8)) {140 if (((*Walker)->type->Z == 8) && ((*Runner)->type->Z == 8)) { 141 141 // check distance 142 const double distance = (*Runner)-> DistanceSquared(*(*Walker));142 const double distance = (*Runner)->x.DistanceSquared((*Walker)->x); 143 143 if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means different atoms 144 144 // on other atom(Runner) we check for bond to interface element and … … 152 152 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 153 153 // if hydrogen, check angle to be greater(!) than 30 degrees 154 if (OtherAtom-> getType()->Z == 1) {155 const double angle = CalculateAngle( OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition());154 if (OtherAtom->type->Z == 1) { 155 const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x); 156 156 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 157 157 Otherangle += angle; 158 158 OtherHydrogens++; 159 159 } 160 InterfaceFlag = InterfaceFlag || (OtherAtom-> getType()== InterfaceElement);161 Interface2Flag = Interface2Flag || (OtherAtom-> getType()== Interface2Element);160 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement); 161 Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element); 162 162 } 163 163 DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl); … … 177 177 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) { 178 178 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 179 if (OtherAtom-> getType()->Z == 1) {179 if (OtherAtom->type->Z == 1) { 180 180 // check angle 181 181 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->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(180./M_PI) << "." << endl);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); 183 183 count++; 184 184 break; … … 210 210 for(;Walker!=(*MolWalker)->end();++Walker){ 211 211 atom * theAtom = *Walker; 212 if ((theAtom-> getType() == first) || (theAtom->getType()== second)) { // first element matches212 if ((theAtom->type == first) || (theAtom->type == second)) { // first element matches 213 213 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 214 214 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 215 if (((OtherAtom-> getType() == first) || (OtherAtom->getType()== second)) && (theAtom->nr < OtherAtom->nr)) {215 if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) { 216 216 count++; 217 217 DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl); … … 246 246 for(;Walker!=(*MolWalker)->end();++Walker){ 247 247 atom *theAtom = *Walker; 248 if (theAtom-> getType()== second) { // first element matches248 if (theAtom->type == second) { // first element matches 249 249 for (int i=0;i<2;i++) 250 250 MatchFlag[i] = false; … … 252 252 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 253 253 for (int i=0;i<2;i++) 254 if ((!MatchFlag[i]) && (OtherAtom-> getType()== ElementArray[i])) {254 if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) { 255 255 MatchFlag[i] = true; 256 256 break; // each bonding atom can match at most one element we are looking for
Note:
See TracChangeset
for help on using the changeset viewer.
