Changeset 153985
- Timestamp:
- Feb 22, 2012, 11:29:04 AM (13 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, 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:
- a8ae6d
- Parents:
- 826e8c
- git-author:
- Frederik Heber <heber@…> (01/04/12 09:34:58)
- git-committer:
- Frederik Heber <heber@…> (02/22/12 11:29:04)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/analysis_bonds.cpp
r826e8c r153985 123 123 * \return true - angle criteria fulfilled, false - criteria not fulfilled, angle greater than 30 degrees. 124 124 */ 125 bool CheckHydrogenBridgeBondAngle( atom *Oxygen, atom *Hydrogen, atom *OtherOxygen)125 bool CheckHydrogenBridgeBondAngle(const atom & Oxygen, const atom & Hydrogen, const atom & OtherOxygen) 126 126 { 127 127 Info FunctionInfo(__func__); 128 128 129 129 // check angle 130 if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) { 130 const double angle = CalculateAngle( 131 Hydrogen.getPosition(), 132 Oxygen.getPosition(), 133 OtherOxygen.getPosition()); 134 LOG(3, "INFO: Hydrogen bridge bond angle is " << angle << ", < " << M_PI*(30./180.) << "?"); 135 if (angle < M_PI*(30./180.)) { 131 136 return true; 132 137 } else { … … 144 149 int CountHydrogenBridgeBonds(MoleculeListClass *molecules, const element * InterfaceElement = NULL, const element * Interface2Element = NULL) 145 150 { 151 Info FunctionInfo(__func__); 152 146 153 int count = 0; 147 154 int OtherHydrogens = 0; … … 150 157 bool Interface2Flag = false; 151 158 bool OtherHydrogenFlag = true; 152 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); ++MolWalker) { 153 molecule::iterator Walker = (*MolWalker)->begin(); 154 for(;Walker!=(*MolWalker)->end();++Walker){ 155 for (MoleculeList::const_iterator MolRunner = molecules->ListOfMolecules.begin();MolRunner != molecules->ListOfMolecules.end(); ++MolRunner) { 156 molecule::iterator Runner = (*MolRunner)->begin(); 157 for(;Runner!=(*MolRunner)->end();++Runner){ 158 if (((*Walker)->getType()->getAtomicNumber() == 8) && ((*Runner)->getType()->getAtomicNumber() == 8)) { 159 // check distance 160 const double distance = (*Runner)->DistanceSquared(*(*Walker)); 161 if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means different atoms 162 // on other atom(Runner) we check for bond to interface element and 163 // check that O-O line is not in between the shanks of the two connected hydrogens (Otherangle > 104.5) 164 OtherHydrogenFlag = true; 165 Otherangle = 0.; 166 OtherHydrogens = 0; 167 InterfaceFlag = (InterfaceElement == NULL); 168 Interface2Flag = (Interface2Element == NULL); 169 const BondList& ListOfBonds = (*Runner)->getListOfBonds(); 170 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 171 BondRunner != ListOfBonds.end(); 172 BondRunner++) { 173 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 174 // if hydrogen, check angle to be greater(!) than 30 degrees 175 if (OtherAtom->getType()->getAtomicNumber() == 1) { 176 const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition()); 177 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 178 Otherangle += angle; 179 OtherHydrogens++; 180 } 181 InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement); 182 Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element); 183 } 184 LOG(1, "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens."); 185 switch (OtherHydrogens) { 186 case 0: 187 case 1: 188 break; 189 case 2: 190 OtherHydrogenFlag = OtherHydrogenFlag && (Otherangle > M_PI*(104.5/180.) + MYEPSILON); 191 break; 192 default: // 3 or more hydrogens ... 193 OtherHydrogenFlag = false; 194 break; 195 } 196 if (InterfaceFlag && Interface2Flag && OtherHydrogenFlag) { 197 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule 198 const BondList& ListOfBonds = (*Walker)->getListOfBonds(); 159 LinkedCell::LinkedCell_View LC = World::getInstance().getLinkedCell(HBRIDGEDISTANCE); 160 161 // go through every molecule 162 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); 163 MolWalker != molecules->ListOfMolecules.end(); 164 ++MolWalker) { 165 LOG(2, "INFO: Current molecule is " << (*MolWalker)->getName() << "."); 166 167 // go through every atom 168 typedef std::set<const molecule *> Moleculeset; 169 for(molecule::const_iterator Walker = (*MolWalker)->begin(); 170 Walker!=(*MolWalker)->end(); 171 ++Walker) { 172 // go through every oxygen 173 if ((*Walker)->getType()->getAtomicNumber() == 8) { 174 LOG(2, "INFO: Current oxygen atom is " << *(*Walker) << "."); 175 176 // get all its neighbors 177 LinkedCell::LinkedList NeighborList = LC.getAllNeighbors(HBRIDGEDISTANCE, (*Walker)->getPosition()); 178 // go through each candidate and gather the molecules of all other oxygens 179 Moleculeset MoleculeNeighbors; 180 for(LinkedCell::LinkedList::const_iterator Runner = NeighborList.begin(); 181 Runner != NeighborList.end(); ++Runner) { 182 const atom * const OtherAtom = dynamic_cast<const atom *>(*Runner); 183 if ((OtherAtom->getType()->getAtomicNumber() == 8) && 184 (OtherAtom->getMolecule() != (*MolWalker))) { 185 LOG(3, "INFO: Possible neighboring molecule is " << OtherAtom->getMolecule()->getName() << "."); 186 MoleculeNeighbors.insert(OtherAtom->getMolecule()); 187 } 188 } 189 190 // now go through the molecules 191 for (Moleculeset::const_iterator moliter = MoleculeNeighbors.begin(); 192 moliter != MoleculeNeighbors.end(); 193 ++moliter) { 194 LOG(2, "INFO: Current other molecule is " << (*moliter)->getName() << "."); 195 196 // go through every other atom 197 for(molecule::const_iterator Runner = (*moliter)->begin(); 198 Runner != (*moliter)->end(); 199 ++Runner) { 200 // go through each oxygen 201 if ((*Runner)->getType()->getAtomicNumber() == 8) { 202 203 // check distance 204 const double distance = (*Runner)->DistanceSquared(*(*Walker)); 205 if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { 206 LOG(2, "INFO: Distance between oxygen atom " 207 << (*Walker)->getName() << " and " 208 << (*Runner)->getName() << " is " 209 << sqrt(distance) << "."); 210 // distance >0 means different atoms 211 // on other atom(Runner) we check for bond to interface element and 212 // check that O-O line is not in between the shanks of the two connected hydrogens (Otherangle > 104.5) 213 OtherHydrogenFlag = true; 214 Otherangle = 0.; 215 OtherHydrogens = 0; 216 InterfaceFlag = (InterfaceElement == NULL); 217 Interface2Flag = (Interface2Element == NULL); 218 const BondList& ListOfBonds = (*Runner)->getListOfBonds(); 199 219 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 200 220 BondRunner != ListOfBonds.end(); 201 221 BondRunner++) { 202 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 222 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 223 // if hydrogen, check angle to be greater(!) than 30 degrees 203 224 if (OtherAtom->getType()->getAtomicNumber() == 1) { 204 // check angle 205 if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) { 206 LOG(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) << "."); 207 count++; 208 break; 225 const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition()); 226 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); 227 Otherangle += angle; 228 OtherHydrogens++; 229 } 230 InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement); 231 Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element); 232 } 233 LOG(1, "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens."); 234 switch (OtherHydrogens) { 235 case 0: 236 case 1: 237 break; 238 case 2: 239 OtherHydrogenFlag = OtherHydrogenFlag && (Otherangle > M_PI*(104.5/180.) + MYEPSILON); 240 break; 241 default: // 3 or more hydrogens ... 242 OtherHydrogenFlag = false; 243 break; 244 } 245 if (InterfaceFlag && Interface2Flag && OtherHydrogenFlag) { 246 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule 247 const BondList& ListOfBonds = (*Walker)->getListOfBonds(); 248 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 249 BondRunner != ListOfBonds.end(); 250 BondRunner++) { 251 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 252 if (OtherAtom->getType()->getAtomicNumber() == 1) { 253 // check angle 254 if (CheckHydrogenBridgeBondAngle(*(*Walker), *OtherAtom, *(*Runner))) { 255 count++; 256 break; 257 } 209 258 } 210 259 } … … 212 261 } 213 262 } 214 } 215 } 216 } 217 } 263 } // end go through molecules 264 } // end gather molecules 265 } // end go through every oxygen 266 } // end go through every atom 218 267 } 219 268 return count;
Note:
See TracChangeset
for help on using the changeset viewer.