Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_bonds.cpp

    rd74077 r952f38  
    1212#include "bond.hpp"
    1313#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"
    1717#include "molecule.hpp"
    1818
     
    6060  int AtomNo = 0;
    6161  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    62     if ((*iter)->getType() == type1)
     62    if ((*iter)->type == type1)
    6363      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) {
    6565          const double distance = (*BondRunner)->GetDistanceSquared();
    6666          if (Min > distance)
     
    8787 * \return angle between \a *first and \a *second, both relative to origin at \a *origin.
    8888 */
    89 double CalculateAngle(const Vector &first, const Vector &central, const Vector &second)
     89double CalculateAngle(Vector *first, Vector *central, Vector *second)
    9090{
    9191  Vector OHBond;
    9292  Vector OOBond;
    9393
    94   OHBond = first - central;
    95   OOBond = second - central;
     94  OHBond = (*first) - (*central);
     95  OOBond = (*second) - (*central);
    9696  const double angle = OHBond.Angle(OOBond);
    9797  return angle;
     
    110110
    111111  // 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.)) {
    113113    return true;
    114114  } else {
     
    138138        molecule::iterator Runner = (*MolRunner)->begin();
    139139        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)) {
    141141            // check distance
    142             const double distance = (*Runner)->DistanceSquared(*(*Walker));
     142            const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
    143143            if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
    144144              // on other atom(Runner) we check for bond to interface element and
     
    152152                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    153153                // 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);
    156156                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
    157157                  Otherangle += angle;
    158158                  OtherHydrogens++;
    159159                }
    160                 InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement);
    161                 Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element);
     160                InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
     161                Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
    162162              }
    163163              DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
     
    177177                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
    178178                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    179                   if (OtherAtom->getType()->Z == 1) {
     179                  if (OtherAtom->type->Z == 1) {
    180180                    // check angle
    181181                    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);
    183183                      count++;
    184184                      break;
     
    210210    for(;Walker!=(*MolWalker)->end();++Walker){
    211211      atom * theAtom = *Walker;
    212       if ((theAtom->getType() == first) || (theAtom->getType() == second)) {  // first element matches
     212      if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
    213213        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
    214214          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)) {
    216216            count++;
    217217            DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
     
    246246    for(;Walker!=(*MolWalker)->end();++Walker){
    247247      atom *theAtom = *Walker;
    248       if (theAtom->getType() == second) {  // first element matches
     248      if (theAtom->type == second) {  // first element matches
    249249        for (int i=0;i<2;i++)
    250250          MatchFlag[i] = false;
     
    252252          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    253253          for (int i=0;i<2;i++)
    254             if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) {
     254            if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
    255255              MatchFlag[i] = true;
    256256              break;  // each bonding atom can match at most one element we are looking for
Note: See TracChangeset for help on using the changeset viewer.