Changeset 2b7d1b
- Timestamp:
- Aug 11, 2010, 4:31:34 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:
- 701ad6, fa7989
- Parents:
- 31fb1d
- git-author:
- Frederik Heber <heber@…> (07/29/10 12:07:40)
- git-committer:
- Frederik Heber <heber@…> (08/11/10 16:31:34)
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
r31fb1d r2b7d1b 24 24 #include "molecule.hpp" 25 25 #include "stackclass.hpp" 26 #include "verbose.hpp" 26 27 #include "World.hpp" 27 28 … … 44 45 {} 45 46 47 /** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this. 48 */ 46 49 void FragmentationSubgraphDissection() { 47 50 ActionRegistry::getInstance().getActionByName(FragmentationSubgraphDissectionAction::NAME)->call(Action::NonInteractive); … … 59 62 Action::state_ptr FragmentationSubgraphDissectionAction::performCall() { 60 63 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl); 61 // @TODO rather do the dissection afterwards 64 62 65 MoleculeListClass *molecules = World::getInstance().getMolecules(); 63 66 config * const configuration = World::getInstance().getConfig(); … … 101 104 return Action::failure; 102 105 } 106 <<<<<<< HEAD 103 107 104 108 // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in … … 143 147 // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms. 144 148 // 4d. destroy the original molecule 149 ======= 150 int FragmentCounter = Subgraphs->Count(); 151 152 // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms 153 // 3. destroy the original molecule 154 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction. 145 155 for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin()) 146 156 World::getInstance().destroyAtom(*AtomRunner); 147 157 World::getInstance().destroyMolecule(mol); 148 158 159 <<<<<<< HEAD 149 160 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list 150 161 // TODO: check whether this is really not needed anymore 151 162 // 4e. free Leafs 152 163 MolecularWalker = Subgraphs; 164 ======= 165 // 4. free Leafs 166 MoleculeLeafClass *MolecularWalker = Subgraphs; 167 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction. 153 168 while (MolecularWalker->next != NULL) { 154 169 MolecularWalker = MolecularWalker->next; … … 156 171 } 157 172 delete(MolecularWalker); 173 <<<<<<< HEAD 158 174 delete[](moleculelist); 175 ======= 176 >>>>>>> Merged MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs() into FragmenationSubgraphDissectionAction. 159 177 DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl); 160 178 -
src/Parser/PcpParser.cpp
r31fb1d r2b7d1b 16 16 #include <iomanip> 17 17 18 //#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp" 18 19 #include "atom.hpp" 19 20 #include "config.hpp" … … 356 357 // 4. dissect the molecule into connected subgraphs 357 358 // don't do this here ... 358 // MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);359 //FragmentationSubgraphDissection(); 359 360 //delete(mol); 360 361 -
src/config.cpp
r31fb1d r2b7d1b 15 15 #include <cstring> 16 16 17 //#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp" 17 18 #include "atom.hpp" 18 19 #include "bond.hpp" … … 856 857 // 4. dissect the molecule into connected subgraphs 857 858 // don't do this here ... 858 // MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);859 //FragmentationSubgraphDissection(); 859 860 //delete(mol); 860 861 -
src/molecule.hpp
r31fb1d r2b7d1b 367 367 void Enumerate(ostream *out); 368 368 void Output(ofstream *out); 369 void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);370 369 int CountAllAtoms() const; 371 370 -
src/moleculelist.cpp
r31fb1d r2b7d1b 585 585 }; 586 586 587 /** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this.588 * \param *out output stream for debugging589 * \param *periode periodentafel590 * \param *configuration config with BondGraph591 */592 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration)593 {594 // 0a. remove all present molecules595 vector<molecule *> allmolecules = World::getInstance().getAllMolecules();596 for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {597 erase(*MolRunner);598 World::getInstance().destroyMolecule(*MolRunner);599 }600 // 0b. remove all bonds and construct a molecule with all atoms601 molecule *mol = World::getInstance().createMolecule();602 vector <atom *> allatoms = World::getInstance().getAllAtoms();603 for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {604 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())605 delete(*BondRunner);606 mol->AddAtom(*AtomRunner);607 }608 609 // 1. dissect the molecule into connected subgraphs610 if (configuration->BG != NULL) {611 if (!configuration->BG->ConstructBondGraph(mol)) {612 World::getInstance().destroyMolecule(mol);613 DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);614 return;615 }616 } else {617 DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);618 return;619 }620 621 // 2. scan for connected subgraphs622 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis623 class StackClass<bond *> *BackEdgeStack = NULL;624 Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);625 delete(BackEdgeStack);626 if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {627 World::getInstance().destroyMolecule(mol);628 DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);629 return;630 }631 632 // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in633 // the original one as parsed in)634 // TODO: Optimize this, when molecules just contain pointer list of global atoms!635 636 // 4a. create array of molecules to fill637 const int MolCount = Subgraphs->next->Count();638 char number[MAXSTRINGSIZE];639 molecule **molecules = new molecule *[MolCount];640 MoleculeLeafClass *MolecularWalker = Subgraphs;641 for (int i=0;i<MolCount;i++) {642 MolecularWalker = MolecularWalker->next;643 molecules[i] = World::getInstance().createMolecule();644 molecules[i]->ActiveFlag = true;645 strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);646 if (MolCount > 1) {647 sprintf(number, "-%d", i+1);648 strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);649 }650 DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << ", id is " << molecules[i]->getId() << endl);651 for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {652 DoLog(1) && (Log() << Verbose(1) << **iter << endl);653 }654 insert(molecules[i]);655 }656 657 // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)658 int FragmentCounter = 0;659 map<int, atom *> AtomToFragmentMap;660 MolecularWalker = Subgraphs;661 while (MolecularWalker->next != NULL) {662 MolecularWalker = MolecularWalker->next;663 for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {664 atom * Walker = *iter;665 DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);666 MolecularWalker->Leaf->erase(iter);667 molecules[FragmentCounter]->AddAtom(Walker); // counting starts at 1668 }669 FragmentCounter++;670 }671 World::getInstance().destroyMolecule(mol);672 673 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list674 // TODO: check whether this is really not needed anymore675 // 4e. free Leafs676 MolecularWalker = Subgraphs;677 while (MolecularWalker->next != NULL) {678 MolecularWalker = MolecularWalker->next;679 delete(MolecularWalker->previous);680 }681 delete(MolecularWalker);682 delete[](molecules);683 DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);684 };685 686 587 /** Count all atoms in each molecule. 687 588 * \return number of atoms in the MoleculeListClass.
Note:
See TracChangeset
for help on using the changeset viewer.