- Timestamp:
- Oct 26, 2012, 1:24:01 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:
- f96874
- Parents:
- dbe3b9
- git-author:
- Frederik Heber <heber@…> (09/07/12 08:47:35)
- git-committer:
- Frederik Heber <heber@…> (10/26/12 13:24:01)
- Location:
- src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/GraphAction/DepthFirstSearchAction.cpp
rdbe3b9 r6d551c 40 40 #include "Graph/CyclicStructureAnalysis.hpp" 41 41 #include "Graph/DepthFirstSearchAnalysis.hpp" 42 #include "Graph/ListOfLocalAtoms.hpp" 42 43 #include "molecule.hpp" 43 44 #include "MoleculeLeafClass.hpp" … … 56 57 Action::state_ptr GraphDepthFirstSearchAction::performCall() { 57 58 LOG(1, "Depth-First-Search Analysis."); 58 atom **ListOfAtoms = NULL;59 ListOfLocalAtoms_t ListOfAtoms; 59 60 std::deque<bond *> *LocalBackEdgeStack = NULL; 60 61 DepthFirstSearchAnalysis DFS; … … 66 67 while (Subgraphs->next != NULL) { 67 68 Subgraphs = Subgraphs->next; 68 ListOfAtoms = NULL;69 ListOfAtoms.clear(); 69 70 Subgraphs->Leaf->FillListOfLocalAtoms(ListOfAtoms, Subgraphs->Leaf->getAtomCount()); 70 71 LocalBackEdgeStack = new std::deque<bond *>; // no need to have it Subgraphs->Leaf->BondCount size … … 75 76 Subgraphs->Leaf = NULL; 76 77 delete(Subgraphs->previous); 77 delete[](ListOfAtoms); // allocated by FillListOfLocalAtoms78 78 FragmentCounter++; 79 79 } -
src/Fragmentation/Fragmentation.cpp
rdbe3b9 r6d551c 53 53 #include "Graph/BondGraph.hpp" 54 54 #include "Graph/CheckAgainstAdjacencyFile.hpp" 55 #include "Graph/ListOfLocalAtoms.hpp" 55 56 #include "molecule.hpp" 56 57 #include "MoleculeLeafClass.hpp" … … 106 107 Graph TotalGraph; // graph with all keysets however local numbers 107 108 int TotalNumberOfKeySets = 0; 108 atom ***ListOfLocalAtoms = NULL;109 109 bool *AtomMask = NULL; 110 110 … … 161 161 // ===== 6a. assign each keyset to its respective subgraph ===== 162 162 const int MolCount = World::getInstance().numMolecules(); 163 ListOfLocalAtoms = new atom **[MolCount];164 for (int i=0;i<MolCount;i++)165 ListOfLocalAtoms[i] = NULL;166 163 FragmentCounter = 0; 167 Subgraphs->next->AssignKeySetsToFragment(mol, &ParsedFragmentList, ListOfLocalAtoms, FragmentList, FragmentCounter, true); 168 delete[](ListOfLocalAtoms); 164 { 165 ListOfLocalAtoms_t *ListOfLocalAtoms = new ListOfLocalAtoms_t[MolCount]; 166 Subgraphs->next->AssignKeySetsToFragment(mol, &ParsedFragmentList, ListOfLocalAtoms, FragmentList, FragmentCounter, true); 167 delete[] ListOfLocalAtoms; 168 } 169 169 170 170 // ===== 6b. prepare and go into the adaptive (Order<0), single-step (Order==0) or incremental (Order>0) cycle -
src/Graph/DepthFirstSearchAnalysis.cpp
rdbe3b9 r6d551c 48 48 #include "Descriptors/AtomDescriptor.hpp" 49 49 #include "Descriptors/MoleculeDescriptor.hpp" 50 #include "Graph/ListOfLocalAtoms.hpp" 50 51 #include "molecule.hpp" 51 52 #include "MoleculeLeafClass.hpp" … … 121 122 122 123 123 bool DepthFirstSearchAnalysis::PickLocalBackEdges( atom **ListOfLocalAtoms, std::deque<bond *> *&LocalStack) const124 bool DepthFirstSearchAnalysis::PickLocalBackEdges(const ListOfLocalAtoms_t &ListOfLocalAtoms, std::deque<bond *> *&LocalStack) const 124 125 { 125 126 bool status = true; … … 133 134 134 135 do { // go through all bonds and push local ones 135 Walker = ListOfLocalAtoms[Binder->leftatom->getNr()]; // get one atom in the reference molecule 136 const ListOfLocalAtoms_t::const_iterator leftiter = ListOfLocalAtoms.find(Binder->leftatom->getNr()); 137 ASSERT( leftiter != ListOfLocalAtoms.end(), 138 "DepthFirstSearchAnalysis::PickLocalBackEdges() - could not find atom id " 139 +toString(Binder->leftatom->getNr())+" in ListOfLocalAtoms."); 140 Walker = leftiter->second; // get one atom in the reference molecule 136 141 if (Walker != NULL) { // if this Walker exists in the subgraph ... 137 142 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 140 145 ++Runner) { 141 146 OtherAtom = (*Runner)->GetOtherAtom(Walker); 142 if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->getNr()]) { // found the bond 147 const ListOfLocalAtoms_t::const_iterator rightiter = ListOfLocalAtoms.find((*Runner)->rightatom->getNr()); 148 if (OtherAtom == rightiter->second) { // found the bond 143 149 LocalStack->push_front((*Runner)); 144 150 LOG(3, "INFO: Found local edge " << *(*Runner) << "."); -
src/Graph/DepthFirstSearchAnalysis.hpp
rdbe3b9 r6d551c 20 20 class atom; 21 21 class bond; 22 class ListOfLocalAtoms_t; 22 23 class MoleculeLeafClass; 23 24 class molecule; … … 66 67 * Reference is the internal BackEdgeStack. 67 68 * 68 * \param **ListOfLocalAtoms array of father atom::nr to local atom::nr (reverse of atom::father)69 * \param ListOfLocalAtoms array of father atom::nr to local atom::nr (reverse of atom::father) 69 70 * \param *LocalStack stack to be filled 70 71 * \return true - everything ok, false - ReferenceStack was empty 71 72 */ 72 bool PickLocalBackEdges( atom **ListOfLocalAtoms, std::deque<bond *> *&LocalStack) const;73 bool PickLocalBackEdges(const ListOfLocalAtoms_t &ListOfLocalAtoms, std::deque<bond *> *&LocalStack) const; 73 74 74 75 /** Getter for BackEdgeStack. -
src/Graph/Makefile.am
rdbe3b9 r6d551c 18 18 Graph/ConnectedSubgraph.hpp \ 19 19 Graph/CyclicStructureAnalysis.hpp \ 20 Graph/DepthFirstSearchAnalysis.hpp 20 Graph/DepthFirstSearchAnalysis.hpp \ 21 Graph/ListOfLocalAtoms.hpp 21 22 22 23 -
src/MoleculeLeafClass.cpp
rdbe3b9 r6d551c 43 43 #include "Fragmentation/Graph.hpp" 44 44 #include "Fragmentation/KeySet.hpp" 45 #include "Graph/ListOfLocalAtoms.hpp" 45 46 #include "molecule.hpp" 46 47 … … 153 154 * \param *reference reference molecule with the bond structure to be copied 154 155 * \param *KeySetList list with all keysets 155 * \param * **ListOfLocalAtoms Lookup table for each subgraph and index of each atom in global molecule, may be NULL on start, then it is filled156 * \param *ListOfLocalAtoms Lookup table for each subgraph and index of each atom in global molecule, may be NULL on start, then it is filled 156 157 * \param **&FragmentList list to be allocated and returned 157 158 * \param &FragmentCounter counts the fragments as we move along the list … … 159 160 * \retuen true - success, false - failure 160 161 */ 161 bool MoleculeLeafClass::AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList)162 bool MoleculeLeafClass::AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, ListOfLocalAtoms_t *&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList) 162 163 { 163 164 bool status = true; … … 210 211 if ((FreeList) && (ListOfLocalAtoms != NULL)) { 211 212 // free the index lookup list 212 delete[](ListOfLocalAtoms[FragmentCounter]);213 (ListOfLocalAtoms[FragmentCounter]).clear(); 213 214 } 214 215 LOG(1, "End of AssignKeySetsToFragment."); -
src/MoleculeLeafClass.hpp
rdbe3b9 r6d551c 18 18 class atom; 19 19 class Graph; 20 class ListOfLocalAtoms_t; 20 21 class molecule; 21 22 … … 39 40 bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous); 40 41 bool FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter, const enum HydrogenSaturation saturation); 41 bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false);42 bool AssignKeySetsToFragment(molecule *reference, Graph *KeySetList, ListOfLocalAtoms_t *&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false); 42 43 void TranslateIndicesToGlobalIDs(Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph); 43 44 int Count() const; -
src/molecule.hpp
rdbe3b9 r6d551c 47 47 class Graph; 48 48 class LinkedCell_deprecated; 49 class ListOfLocalAtoms_t; 49 50 class molecule; 50 51 class MoleculeLeafClass; … … 292 293 bool StoreBondsToFile(std::string filename, std::string path = ""); 293 294 bool StoreAdjacencyToFile(std::string filename, std::string path = ""); 294 bool CreateFatherLookupTable( atom **&LookupTable, int count = 0);295 bool CreateFatherLookupTable(ListOfLocalAtoms_t &LookupTable, int count = 0); 295 296 296 297 // Recognize doubly appearing molecules in a list of them 297 298 int * GetFatherSonAtomicMap(molecule *OtherMolecule); 298 bool FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList = false);299 bool FillListOfLocalAtoms( atom **&ListOfLocalAtoms, const int GlobalAtomCount);299 bool FillBondStructureFromReference(const molecule * const reference, ListOfLocalAtoms_t &ListOfLocalAtoms, bool FreeList = false); 300 bool FillListOfLocalAtoms(ListOfLocalAtoms_t &ListOfLocalAtoms, const int GlobalAtomCount); 300 301 301 302 // Output routines. -
src/molecule_graph.cpp
rdbe3b9 r6d551c 48 48 #include "Element/element.hpp" 49 49 #include "Graph/BondGraph.hpp" 50 #include "Graph/ListOfLocalAtoms.hpp" 50 51 #include "Helpers/defs.hpp" 51 52 #include "Helpers/helpers.hpp" … … 61 62 * Calls this routine in each MoleculeLeafClass::next subgraph if it's not NULL. 62 63 * \param *reference reference molecule with the bond structure to be copied 63 * \param **&ListOfLocalAtoms Lookup table for this subgraph and index of each atom in \a *reference, may be NULL on start, then it is filled64 * \param FreeList true - ***ListOfLocalAtoms is free'd before return, false - it is not64 * \param ListOfLocalAtoms Lookup table for this subgraph and index of each atom in \a *reference, may be NULL on start, then it is filled 65 * \param FreeList true - ListOfLocalAtoms is free'd before return, false - it is not 65 66 * \return true - success, false - failure 66 67 */ 67 bool molecule::FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList)68 bool molecule::FillBondStructureFromReference(const molecule * const reference, ListOfLocalAtoms_t &ListOfLocalAtoms, bool FreeList) 68 69 { 69 70 bool status = true; … … 91 92 ++Runner) { 92 93 atom * const OtherAtom = (*Runner)->GetOtherAtom((*iter)->GetTrueFather()); 93 atom * const OtherWalker = ListOfLocalAtoms[OtherAtom->getNr()]; // local copy of current bond partner of walker 94 const ListOfLocalAtoms_t::const_iterator localiter = ListOfLocalAtoms.find(OtherAtom->getNr()); 95 ASSERT( localiter != ListOfLocalAtoms.end(), 96 "molecule::FillBondStructureFromReference() - could not find id" 97 +toString(OtherAtom->getNr())+" in ListOfLocalAtoms."); 98 atom * const OtherWalker = localiter->second; // local copy of current bond partner of walker 94 99 if (OtherWalker != NULL) { 95 100 if (OtherWalker->getNr() > (*iter)->getNr()) … … 103 108 } 104 109 105 if ((FreeList) && ( ListOfLocalAtoms != NULL)) {110 if ((FreeList) && (!ListOfLocalAtoms.empty())) { 106 111 // free the index lookup list 107 delete[](ListOfLocalAtoms);112 ListOfLocalAtoms.clear(); 108 113 } 109 114 LOG(1, "End of FillBondStructureFromReference."); … … 227 232 228 233 /** Fills a lookup list of father's Atom::nr -> atom for each subgraph. 229 * \param **&ListOfLocalAtoms Lookup table for each subgraph and index of each atom in global molecule, may be NULL on start, then it is filled234 * \param ListOfLocalAtoms Lookup table for each subgraph and index of each atom in global molecule, may be NULL on start, then it is filled 230 235 * \param GlobalAtomCount number of atoms in the complete molecule 231 236 * \return true - success, false - failure (ListOfLocalAtoms != NULL) 232 237 */ 233 bool molecule::FillListOfLocalAtoms( atom **&ListOfLocalAtoms, const int GlobalAtomCount)238 bool molecule::FillListOfLocalAtoms(ListOfLocalAtoms_t &ListOfLocalAtoms, const int GlobalAtomCount) 234 239 { 235 240 bool status = true; 236 241 237 if (ListOfLocalAtoms == NULL) { // allocate and fill list of this fragment/subgraph242 if (ListOfLocalAtoms.empty()) { // allocate and fill list of this fragment/subgraph 238 243 status = status && CreateFatherLookupTable(ListOfLocalAtoms, GlobalAtomCount); 239 244 } else … … 251 256 * \return true - success, false - failure 252 257 */ 253 bool molecule::CreateFatherLookupTable( atom **&LookupTable, int count)258 bool molecule::CreateFatherLookupTable(ListOfLocalAtoms_t &LookupTable, int count) 254 259 { 255 260 bool status = true; 256 261 int AtomNo; 257 262 258 if ( LookupTable != NULL) {259 ELOG(1, "Pointer for Lookup table is not NULL! Aborting ...");263 if (!LookupTable.empty()) { 264 ELOG(1, "Pointer for Lookup table is not empty! Aborting ..."); 260 265 return false; 261 266 } … … 273 278 274 279 // allocate and fill 275 LookupTable = new atom *[count+1]; 276 if (LookupTable == NULL) { 277 ELOG(0, "LookupTable memory allocation failed!"); 278 performCriticalExit(); 279 status = false; 280 } else { 281 for (int i=0;i<=count;i++) 282 LookupTable[i] = NULL; 283 for (molecule::iterator iter = begin(); iter != end(); ++iter) { 284 AtomNo = (*iter)->GetTrueFather()->getNr(); 285 if ((AtomNo >= 0) && (AtomNo <= count)) { 286 LOG(3, "DEBUG: Setting LookupTable[" << AtomNo << "] to " << *(*iter)); 287 LookupTable[AtomNo] = (*iter); 288 } else { 289 ELOG(1, "Walker " << *(*iter) << " exceeded range of nuclear ids [0, " << count << "]."); 290 status = false; 291 break; 292 } 280 for (int i=0;i<=count;i++) 281 LookupTable[i] = NULL; 282 for (molecule::iterator iter = begin(); iter != end(); ++iter) { 283 AtomNo = (*iter)->GetTrueFather()->getNr(); 284 if ((AtomNo >= 0) && (AtomNo <= count)) { 285 LOG(3, "DEBUG: Setting LookupTable[" << AtomNo << "] to " << *(*iter)); 286 LookupTable[AtomNo] = (*iter); 287 } else { 288 ELOG(1, "Walker " << *(*iter) << " exceeded range of nuclear ids [0, " << count << "]."); 289 status = false; 290 break; 293 291 } 294 292 }
Note:
See TracChangeset
for help on using the changeset viewer.