Changeset 07a47e for src/Fragmentation
- Timestamp:
- Oct 26, 2011, 3:02:53 PM (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:
- 41d023
- Parents:
- 99b0dc
- Location:
- src/Fragmentation
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/BondsPerShortestPath.cpp
r99b0dc r07a47e 101 101 * \param _RootKeyNr index of root node 102 102 * \param RestrictedKeySet Restricted vertex set to use in context of molecule 103 */ 104 void BondsPerShortestPath::FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet) 103 * \param saturation this tells whether to treat hydrogen special or not. 104 */ 105 void BondsPerShortestPath::FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation) 105 106 { 106 107 // Actually, we should construct a spanning tree vom the root atom and select all edges therefrom and put them into … … 146 147 OtherWalker = (*Runner)->GetOtherAtom(Walker); 147 148 if ((RestrictedKeySet.find(OtherWalker->getNr()) != RestrictedKeySet.end()) 148 #ifdef ADDHYDROGEN 149 && (OtherWalker->getType()->getAtomicNumber() != 1) 150 #endif 151 ) { // skip hydrogens and restrict to fragment 149 // skip hydrogens if desired and restrict to fragment 150 && ((saturation == DontSaturate) || (OtherWalker->getType()->getAtomicNumber() != 1))) { 152 151 DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->getNr() << " in bond " << *(*Runner) << "." << endl); 153 152 // set the label if not set (and push on root stack as well) -
src/Fragmentation/BondsPerShortestPath.hpp
r99b0dc r07a47e 13 13 #include <config.h> 14 14 #endif 15 16 #include "Fragmentation/HydrogenSaturation_enum.hpp" 15 17 16 18 #include <list> … … 31 33 void SetSPList(atom *_Root); 32 34 void ResetSPList(); 33 void FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet );35 void FillSPListandLabelVertices(int _RootKeyNr, KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation); 34 36 void OutputSPList(); 35 37 int CountNumbersInBondsList(); -
src/Fragmentation/Fragmentation.cpp
r99b0dc r07a47e 45 45 /** Constructor of class Fragmentation. 46 46 * 47 */ 48 Fragmentation::Fragmentation(molecule *_mol) : 49 mol(_mol) 47 * \param _mol molecule for internal use (looking up atoms) 48 * \param _saturation whether to treat hydrogen special and saturate dangling bonds or not 49 */ 50 Fragmentation::Fragmentation(molecule *_mol, const enum HydrogenSaturation _saturation) : 51 mol(_mol), 52 saturation(_saturation) 50 53 {} 51 54 … … 90 93 91 94 DoLog(0) && (Log() << Verbose(0) << endl); 92 #ifdef ADDHYDROGEN 93 DoLog(0) && (Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl); 94 #else 95 DoLog(0) && (Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl); 96 #endif 95 switch (saturation) { 96 case DoSaturate: 97 DoLog(0) && (Log() << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl); 98 break; 99 case DontSaturate: 100 DoLog(0) && (Log() << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl); 101 break; 102 default: 103 ASSERT(0, "Fragmentation::FragmentMolecule() - there is a saturation setting which I have no idea about."); 104 break; 105 } 97 106 98 107 // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, file parsing, ... ++++++++++++++++++++++++++++++++++++++++++ … … 151 160 AtomMask[mol->getAtomCount()] = true; // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite() 152 161 // ===== 6b. fill RootStack for each subgraph (second adaptivity check) ===== 153 Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0) );162 Subgraphs->next->FillRootStackForSubgraphs(RootStack, AtomMask, (FragmentCounter = 0), saturation); 154 163 155 164 // ===== 7. fill the bond fragment list ===== … … 359 368 FragmentLowerOrdersList[RootNr][0] = new Graph; 360 369 FragmentSearch.PrepareForPowersetGeneration(1., FragmentLowerOrdersList[RootNr][0], Walker); 361 NumMoleculesOfOrder[RootNr] = PSG(CompleteMolecule );370 NumMoleculesOfOrder[RootNr] = PSG(CompleteMolecule, saturation); 362 371 363 372 // output resulting number … … 487 496 DoeLog(2) && (eLog()<< Verbose(2) << "Unable to parse file, incrementing all." << endl); 488 497 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 489 #ifdef ADDHYDROGEN 490 if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen 491 #endif 498 if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen 492 499 { 493 500 AtomMask[(*iter)->getNr()] = true; // include all (non-hydrogen) atoms … … 502 509 } else { // global increase of Bond Order 503 510 for(molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 504 #ifdef ADDHYDROGEN 505 if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen 506 #endif 511 if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen 507 512 { 508 513 AtomMask[(*iter)->getNr()] = true; // include all (non-hydrogen) atoms … … 670 675 atom *FatherOfRunner = NULL; 671 676 672 #ifdef ADDHYDROGEN673 molecule::const_iterator runner;674 #endif675 677 // we increment the iter just before skipping the hydrogen 676 678 for (molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end();) { … … 700 702 } else { 701 703 // Log() << Verbose(0) << ", who has no son in this fragment molecule." << endl; 702 #ifdef ADDHYDROGEN703 704 //Log() << Verbose(3) << "Adding Hydrogen to " << (*iter)->Name << " and a bond in between." << endl; 704 if (!Leaf->AddHydrogenReplacementAtom((*BondRunner), (*iter), FatherOfRunner, OtherFather, IsAngstroem))705 exit(1);706 #endif 705 if (saturation == DoSaturate) 706 if (!Leaf->AddHydrogenReplacementAtom((*BondRunner), (*iter), FatherOfRunner, OtherFather, IsAngstroem)) 707 exit(1); 707 708 //NumBonds[(*iter)->getNr()] += Binder->BondDegree; 708 709 } … … 715 716 } 716 717 ++iter; 717 #ifdef ADDHYDROGEN 718 while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen719 iter++;720 }721 #endif 718 if (saturation == DoSaturate) { 719 while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen 720 iter++; 721 } 722 } 722 723 } 723 724 }; -
src/Fragmentation/Fragmentation.hpp
r99b0dc r07a47e 18 18 #include "Graph/DepthFirstSearchAnalysis.hpp" 19 19 20 #include "Fragmentation/HydrogenSaturation_enum.hpp" 20 21 #include "Fragmentation/fragmentation_helpers.hpp" 21 22 … … 31 32 { 32 33 public: 33 Fragmentation(molecule *_mol );34 Fragmentation(molecule *_mol, const enum HydrogenSaturation _saturation); 34 35 ~Fragmentation(); 35 36 … … 58 59 //!> pointer to molecule that is fragmented 59 60 molecule *mol; 61 //!> whether to saturate dangling bonds with hydrogen and hence treat hydrogen special 62 const enum HydrogenSaturation saturation; 60 63 //!> list of parser types for which a configuration file per fragment is stored 61 64 std::vector<std::string> typelist; -
src/Fragmentation/PowerSetGenerator.cpp
r99b0dc r07a47e 172 172 * with SP of 2, then those with SP of 3, then those with SP of 4 and so on. 173 173 * \param RestrictedKeySet Restricted vertex set to use in context of molecule 174 * \param saturation whether to treat hydrogen special or not 174 175 * \return number of inserted fragments 175 176 * \note ShortestPathList in FragmentSearch structure is probably due to NumberOfAtomsSPLevel and SP not needed anymore 176 177 */ 177 int PowerSetGenerator::operator()(KeySet &RestrictedKeySet )178 int PowerSetGenerator::operator()(KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation) 178 179 { 179 180 int Counter = FragmentSearch->FragmentCounter; // mark current value of counter … … 185 186 186 187 // do a BFS search to fill the SP lists and label the found vertices 187 BondsPerSPList.FillSPListandLabelVertices(FragmentSearch->getRoot()->GetTrueFather()->getNr(), RestrictedKeySet );188 BondsPerSPList.FillSPListandLabelVertices(FragmentSearch->getRoot()->GetTrueFather()->getNr(), RestrictedKeySet, saturation); 188 189 189 190 // outputting all list for debugging -
src/Fragmentation/PowerSetGenerator.hpp
r99b0dc r07a47e 18 18 19 19 #include "Fragmentation/BondsPerShortestPath.hpp" 20 #include "Fragmentation/HydrogenSaturation_enum.hpp" 20 21 21 22 class bond; … … 29 30 30 31 void SPFragmentGenerator(int RootDistance, std::vector<bond *> &BondsSet, int SetDimension, int SubOrder); 31 int operator()(KeySet &RestrictedKeySet );32 int operator()(KeySet &RestrictedKeySet, const enum HydrogenSaturation saturation); 32 33 void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex); 33 34 int FillBondsList(std::vector<bond *> &BondsList, std::list<bond *>::const_iterator SetFirst, std::list<bond *>::const_iterator SetLast, int *&TouchedList, int TouchedIndex);
Note:
See TracChangeset
for help on using the changeset viewer.