Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_bonds.cpp

    r2fe971 rbf3817  
    66 */
    77
     8// include config.h
     9#ifdef HAVE_CONFIG_H
     10#include <config.h>
     11#endif
     12
    813#include "Helpers/MemDebug.hpp"
    914
     
    1217#include "bond.hpp"
    1318#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"
    1722#include "molecule.hpp"
    1823
     
    6065  int AtomNo = 0;
    6166  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    62     if ((*iter)->type == type1)
     67    if ((*iter)->getType() == type1)
    6368      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) {
    6570          const double distance = (*BondRunner)->GetDistanceSquared();
    6671          if (Min > distance)
     
    8792 * \return angle between \a *first and \a *second, both relative to origin at \a *origin.
    8893 */
    89 double CalculateAngle(Vector *first, Vector *central, Vector *second)
     94double CalculateAngle(const Vector &first, const Vector &central, const Vector &second)
    9095{
    9196  Vector OHBond;
    9297  Vector OOBond;
    9398
    94   OHBond = (*first) - (*central);
    95   OOBond = (*second) - (*central);
     99  OHBond = first - central;
     100  OOBond = second - central;
    96101  const double angle = OHBond.Angle(OOBond);
    97102  return angle;
     
    110115
    111116  // 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.)) {
    113118    return true;
    114119  } else {
     
    138143        molecule::iterator Runner = (*MolRunner)->begin();
    139144        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)) {
    141146            // check distance
    142             const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
     147            const double distance = (*Runner)->DistanceSquared(*(*Walker));
    143148            if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
    144149              // on other atom(Runner) we check for bond to interface element and
     
    152157                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    153158                // 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());
    156161                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
    157162                  Otherangle += angle;
    158163                  OtherHydrogens++;
    159164                }
    160                 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
    161                 Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
     165                InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement);
     166                Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element);
    162167              }
    163168              DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
     
    177182                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
    178183                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    179                   if (OtherAtom->type->Z == 1) {
     184                  if (OtherAtom->getType()->Z == 1) {
    180185                    // check angle
    181186                    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);
    183188                      count++;
    184189                      break;
     
    210215    for(;Walker!=(*MolWalker)->end();++Walker){
    211216      atom * theAtom = *Walker;
    212       if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
     217      if ((theAtom->getType() == first) || (theAtom->getType() == second)) {  // first element matches
    213218        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
    214219          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)) {
    216221            count++;
    217222            DoLog(1) && (Log() << Verbose(1) << *first << "-" << *second << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
     
    246251    for(;Walker!=(*MolWalker)->end();++Walker){
    247252      atom *theAtom = *Walker;
    248       if (theAtom->type == second) {  // first element matches
     253      if (theAtom->getType() == second) {  // first element matches
    249254        for (int i=0;i<2;i++)
    250255          MatchFlag[i] = false;
     
    252257          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    253258          for (int i=0;i<2;i++)
    254             if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
     259            if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) {
    255260              MatchFlag[i] = true;
    256261              break;  // each bonding atom can match at most one element we are looking for
Note: See TracChangeset for help on using the changeset viewer.