Changeset d74077 for src/analysis_bonds.cpp
- Timestamp:
- Jul 31, 2010, 3:23:10 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 8f4df1
- Parents:
- 5fbaeb
- File:
-
- 1 edited
-
src/analysis_bonds.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_bonds.cpp
r5fbaeb rd74077 60 60 int AtomNo = 0; 61 61 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 62 if ((*iter)-> type== type1)62 if ((*iter)->getType() == type1) 63 63 for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++) 64 if ((*BondRunner)->GetOtherAtom((*iter))-> type== type2) {64 if ((*BondRunner)->GetOtherAtom((*iter))->getType() == 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( Vector *first, Vector *central, Vector *second)89 double CalculateAngle(const Vector &first, const Vector ¢ral, const 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->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) {112 if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < 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)-> type->Z == 8) && ((*Runner)->type->Z == 8)) {140 if (((*Walker)->getType()->Z == 8) && ((*Runner)->getType()->Z == 8)) { 141 141 // check distance 142 const double distance = (*Runner)-> x.DistanceSquared((*Walker)->x);142 const double distance = (*Runner)->DistanceSquared(*(*Walker)); 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-> type->Z == 1) {155 const double angle = CalculateAngle( &OtherAtom->x, &(*Runner)->x, &(*Walker)->x);154 if (OtherAtom->getType()->Z == 1) { 155 const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition()); 156 156 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 157 157 Otherangle += angle; 158 158 OtherHydrogens++; 159 159 } 160 InterfaceFlag = InterfaceFlag || (OtherAtom-> type== InterfaceElement);161 Interface2Flag = Interface2Flag || (OtherAtom-> type== Interface2Element);160 InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement); 161 Interface2Flag = Interface2Flag || (OtherAtom->getType() == 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-> type->Z == 1) {179 if (OtherAtom->getType()->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->x, &(*Walker)->x, &(*Runner)->x)*(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->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(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-> type == first) || (theAtom->type== second)) { // first element matches212 if ((theAtom->getType() == first) || (theAtom->getType() == 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-> type == first) || (OtherAtom->type== second)) && (theAtom->nr < OtherAtom->nr)) {215 if (((OtherAtom->getType() == first) || (OtherAtom->getType() == 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-> type== second) { // first element matches248 if (theAtom->getType() == 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-> type== ElementArray[i])) {254 if ((!MatchFlag[i]) && (OtherAtom->getType() == 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.
