Changeset 1024cb for src/analysis_bonds.cpp
- Timestamp:
- May 31, 2010, 5:32:27 PM (16 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:
- e08c46
- Parents:
- 42af9e (diff), a7b761b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (05/31/10 17:29:30)
- git-committer:
- Frederik Heber <heber@…> (05/31/10 17:32:27)
- File:
-
- 1 edited
-
src/analysis_bonds.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/analysis_bonds.cpp
r42af9e r1024cb 26 26 Mean = 0.; 27 27 28 atom *Walker = mol->start;29 28 int AtomCount = 0; 30 while (Walker->next != mol->end) { 31 Walker = Walker->next; 32 const int count = Walker->ListOfBonds.size(); 29 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 30 const int count = (*iter)->ListOfBonds.size(); 33 31 if (Max < count) 34 32 Max = count; … … 58 56 59 57 int AtomNo = 0; 60 atom *Walker = mol->start; 61 while (Walker->next != mol->end) { 62 Walker = Walker->next; 63 if (Walker->type == type1) 64 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) 65 if ((*BondRunner)->GetOtherAtom(Walker)->type == type2) { 58 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 59 if ((*iter)->type == type1) 60 for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++) 61 if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) { 66 62 const double distance = (*BondRunner)->GetDistanceSquared(); 67 63 if (Min > distance) … … 126 122 int CountHydrogenBridgeBonds(MoleculeListClass *molecules, const element * InterfaceElement = NULL) 127 123 { 128 atom *Walker = NULL;129 atom *Runner = NULL;130 124 int count = 0; 131 125 int OtherHydrogens = 0; … … 133 127 bool InterfaceFlag = false; 134 128 bool OtherHydrogenFlag = true; 135 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) { 136 Walker = (*MolWalker)->start; 137 while (Walker->next != (*MolWalker)->end) { 138 Walker = Walker->next; 139 for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); MolRunner++) { 140 Runner = (*MolRunner)->start; 141 while (Runner->next != (*MolRunner)->end) { 142 Runner = Runner->next; 143 if ((Walker->type->Z == 8) && (Runner->type->Z == 8)) { 129 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); ++MolWalker) { 130 molecule::iterator Walker = (*MolWalker)->begin(); 131 for(;Walker!=(*MolWalker)->end();++Walker){ 132 for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); ++MolRunner) { 133 molecule::iterator Runner = (*MolRunner)->begin(); 134 for(;Runner!=(*MolRunner)->end();++Runner){ 135 if (((*Walker)->type->Z == 8) && ((*Runner)->type->Z == 8)) { 144 136 // check distance 145 const double distance = Runner->x.DistanceSquared(Walker->x);137 const double distance = (*Runner)->x.DistanceSquared((*Walker)->x); 146 138 if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means different atoms 147 139 // on other atom(Runner) we check for bond to interface element and … … 151 143 OtherHydrogens = 0; 152 144 InterfaceFlag = (InterfaceElement == NULL); 153 for (BondList::const_iterator BondRunner = Runner->ListOfBonds.begin(); BondRunner != Runner->ListOfBonds.end(); BondRunner++) {154 atom * const OtherAtom = (*BondRunner)->GetOtherAtom( Runner);145 for (BondList::const_iterator BondRunner = (*Runner)->ListOfBonds.begin(); BondRunner != (*Runner)->ListOfBonds.end(); BondRunner++) { 146 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 155 147 // if hydrogen, check angle to be greater(!) than 30 degrees 156 148 if (OtherAtom->type->Z == 1) { 157 const double angle = CalculateAngle(&OtherAtom->x, & Runner->x, &Walker->x);149 const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x); 158 150 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 159 151 Otherangle += angle; … … 176 168 if (InterfaceFlag && OtherHydrogenFlag) { 177 169 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule 178 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {179 atom * const OtherAtom = (*BondRunner)->GetOtherAtom( Walker);170 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) { 171 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 180 172 if (OtherAtom->type->Z == 1) { 181 173 // check angle 182 if (CheckHydrogenBridgeBondAngle( Walker, OtherAtom,Runner)) {183 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);174 if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) { 175 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); 184 176 count++; 185 177 break; … … 205 197 int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second) 206 198 { 207 atom *Walker = NULL;208 199 int count = 0; 209 200 210 201 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) { 211 Walker = (*MolWalker)->start;212 while (Walker->next != (*MolWalker)->end){213 Walker = Walker->next;214 if (( Walker->type == first) || (Walker->type == second)) { // first element matches215 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {216 atom * const OtherAtom = (*BondRunner)->GetOtherAtom( Walker);217 if (((OtherAtom->type == first) || (OtherAtom->type == second)) && ( Walker->nr < OtherAtom->nr)) {202 molecule::iterator Walker = (*MolWalker)->begin(); 203 for(;Walker!=(*MolWalker)->end();++Walker){ 204 atom * theAtom = *Walker; 205 if ((theAtom->type == first) || (theAtom->type == second)) { // first element matches 206 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 207 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 208 if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) { 218 209 count++; 219 210 DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl); … … 240 231 bool MatchFlag[2]; 241 232 bool result = false; 242 atom *Walker = NULL;243 233 const element * ElementArray[2]; 244 234 ElementArray[0] = first; … … 246 236 247 237 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) { 248 Walker = (*MolWalker)->start;249 while (Walker->next != (*MolWalker)->end){250 Walker = Walker->next;251 if ( Walker->type == second) { // first element matches238 molecule::iterator Walker = (*MolWalker)->begin(); 239 for(;Walker!=(*MolWalker)->end();++Walker){ 240 atom *theAtom = *Walker; 241 if (theAtom->type == second) { // first element matches 252 242 for (int i=0;i<2;i++) 253 243 MatchFlag[i] = false; 254 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {255 atom * const OtherAtom = (*BondRunner)->GetOtherAtom( Walker);244 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 245 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 256 246 for (int i=0;i<2;i++) 257 247 if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
Note:
See TracChangeset
for help on using the changeset viewer.
