- Timestamp:
- Mar 19, 2010, 3:42:58 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, 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:
- dfe8ef
- Parents:
- 1cbf47
- git-author:
- Frederik Heber <heber@…> (03/19/10 14:03:54)
- git-committer:
- Frederik Heber <heber@…> (03/19/10 15:42:58)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/bondgraph.cpp
r1cbf47 rf18185 209 209 // on other atom(Runner) we check for bond to interface element 210 210 for (BondList::const_iterator BondRunner = Runner->ListOfBonds.begin(); BondRunner != Runner->ListOfBonds.end(); BondRunner++) { 211 atom * const OtherAtom = (*BondRunner)->GetOtherAtom( Walker);211 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Runner); 212 212 if (!OtherHydrogenFlag && (OtherAtom->type->Z == 1)) { 213 213 OtherHydrogen = OtherAtom; 214 OtherHydrogen = true;214 OtherHydrogenFlag = true; 215 215 } 216 216 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement); … … 227 227 if ((Walker->nr < Runner->nr) || (!OtherHydrogenFlag)) { 228 228 // check angle 229 OHBond.CopyVector(& Walker->x);230 OHBond.SubtractVector(& Hydrogen->x);229 OHBond.CopyVector(&Hydrogen->x); 230 OHBond.SubtractVector(&Walker->x); 231 231 OOBond.CopyVector(&Runner->x); 232 232 OOBond.SubtractVector(&Walker->x); … … 246 246 return count; 247 247 } 248 249 /** Counts the number of bonds between two given elements. 250 * \param *molecules list of molecules with all atoms 251 * \param *first pointer to first element 252 * \param *second pointer to second element 253 * \return number of found bonds (\a *first-\a *second) 254 */ 255 int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second) 256 { 257 atom *Walker = NULL; 258 int count = 0; 259 260 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) { 261 Walker = (*MolWalker)->start; 262 while (Walker->next != (*MolWalker)->end) { 263 Walker = Walker->next; 264 if ((Walker->type == first) || (Walker->type == second)) { // first element matches 265 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) { 266 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker); 267 if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (Walker->nr < OtherAtom->nr)) { 268 count++; 269 DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl); 270 } 271 } 272 } 273 } 274 } 275 return count; 276 }; 277 278 /** Counts the number of bonds between three given elements. 279 * Note that we do not look for arbitrary sequence of given bonds, but \a *second will be the central atom and we check 280 * whether it has bonds to both \a *first and \a *third. 281 * \param *molecules list of molecules with all atoms 282 * \param *first pointer to first element 283 * \param *second pointer to second element 284 * \param *third pointer to third element 285 * \return number of found bonds (\a *first-\a *second-\a *third, \a *third-\a *second-\a *first, respectively) 286 */ 287 int CountBondsOfThree(MoleculeListClass * const molecules, const element * const first, const element * const second, const element * const third) 288 { 289 int count = 0; 290 bool MatchFlag[2]; 291 bool result = false; 292 atom *Walker = NULL; 293 const element * ElementArray[2]; 294 ElementArray[0] = first; 295 ElementArray[1] = third; 296 297 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) { 298 Walker = (*MolWalker)->start; 299 while (Walker->next != (*MolWalker)->end) { 300 Walker = Walker->next; 301 if (Walker->type == second) { // first element matches 302 for (int i=0;i<2;i++) 303 MatchFlag[i] = false; 304 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) { 305 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Walker); 306 for (int i=0;i<2;i++) 307 MatchFlag[i] = MatchFlag[i] || (OtherAtom->type == ElementArray[i]); 308 } 309 result = true; 310 for (int i=0;i<2;i++) 311 result = result && MatchFlag[i]; 312 if (result) { 313 count++; 314 DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << "-" << third->name << " bond found at " << *Walker << "." << endl); 315 } 316 } 317 } 318 } 319 return count; 320 }; -
src/bondgraph.hpp
r1cbf47 rf18185 56 56 57 57 int CountHydrogenBridgeBonds(MoleculeListClass * const molecules, element * InterfaceElement); 58 int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second); 59 int CountBondsOfThree(MoleculeListClass * const molecules, const element * const first, const element * const second, const element * const third); 58 60 59 61 #endif /* BONDGRAPH_HPP_ */ -
src/builder.cpp
r1cbf47 rf18185 1089 1089 Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl; 1090 1090 Log() << Verbose(0) << "a - simple add of one molecule to another" << endl; 1091 Log() << Verbose(0) << "b - count the number of bonds of two elements" << endl; 1092 Log() << Verbose(0) << "B - count the number of bonds of three elements " << endl; 1091 1093 Log() << Verbose(0) << "e - embedding merge of two molecules" << endl; 1092 1094 Log() << Verbose(0) << "h - count the number of hydrogen bonds" << endl; 1095 Log() << Verbose(0) << "b - count the number of hydrogen bonds" << endl; 1093 1096 Log() << Verbose(0) << "m - multi-merge of all molecules" << endl; 1094 1097 Log() << Verbose(0) << "s - scatter merge of two molecules" << endl; … … 1124 1127 } 1125 1128 break; 1129 1130 case 'b': 1131 { 1132 const int nr = 2; 1133 char *names[nr] = {"first", "second"}; 1134 int Z[nr]; 1135 element *elements[nr]; 1136 for (int i=0;i<nr;i++) { 1137 Z[i] = 0; 1138 do { 1139 cout << "Enter " << names[i] << " element: "; 1140 cin >> Z[i]; 1141 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1142 elements[i] = periode->FindElement(Z[i]); 1143 } 1144 const int count = CountBondsOfTwo(molecules, elements[0], elements[1]); 1145 cout << endl << "There are " << count << " "; 1146 for (int i=0;i<nr;i++) { 1147 if (i==0) 1148 cout << elements[i]->symbol; 1149 else 1150 cout << "-" << elements[i]->symbol; 1151 } 1152 cout << " bonds." << endl; 1153 } 1154 break; 1155 1156 case 'B': 1157 { 1158 const int nr = 3; 1159 char *names[nr] = {"first", "second", "third"}; 1160 int Z[nr]; 1161 element *elements[nr]; 1162 for (int i=0;i<nr;i++) { 1163 Z[i] = 0; 1164 do { 1165 cout << "Enter " << names[i] << " element: "; 1166 cin >> Z[i]; 1167 } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS)); 1168 elements[i] = periode->FindElement(Z[i]); 1169 } 1170 const int count = CountBondsOfThree(molecules, elements[0], elements[1], elements[2]); 1171 cout << endl << "There are " << count << " "; 1172 for (int i=0;i<nr;i++) { 1173 if (i==0) 1174 cout << elements[i]->symbol; 1175 else 1176 cout << "-" << elements[i]->symbol; 1177 } 1178 cout << " bonds." << endl; 1179 } 1180 break; 1126 1181 1127 1182 case 'e':
Note:
See TracChangeset
for help on using the changeset viewer.