Changeset fe0cb8 for src


Ignore:
Timestamp:
Oct 14, 2013, 11:42:03 PM (11 years ago)
Author:
Frederik Heber <heber@…>
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:
adb51ab
Parents:
8dbcaf
git-author:
Frederik Heber <heber@…> (09/25/13 08:49:20)
git-committer:
Frederik Heber <heber@…> (10/14/13 23:42:03)
Message:

Added option DoCyclesFull to FragmentationAction.

  • FIX: Fragmentation::Fragmentation() has no need for a ref to DFS anymore.
  • DFS in FragmentationAction is now used for Cycle detection only.
  • CyclicStructureAnalysis::RetrieveCycleMembers() also fills internal vector with all found cycles (as KeySet's), with a getter.
Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r8dbcaf rfe0cb8  
    5050#include "Graph/AdjacencyList.hpp"
    5151#include "Graph/BondGraph.hpp"
     52#include "Graph/CyclicStructureAnalysis.hpp"
    5253#include "Graph/DepthFirstSearchAnalysis.hpp"
    5354#include "Helpers/defs.hpp"
     
    128129  }
    129130
    130   // we require the current bond graph
    131   DepthFirstSearchAnalysis DFS;
    132 
    133131  // we parse in the keysets from last time if present
    134132  Graph StoredGraph;
     
    162160    {
    163161      Graph StoredLocalGraph(StoredGraph.getLocalGraph(mol));
    164       const int tempFlag = Fragmenter.FragmentMolecule(mols_atomids, params.order.get(), params.prefix.get(), DFS, StoredLocalGraph);
     162      const int tempFlag = Fragmenter.FragmentMolecule(mols_atomids, params.order.get(), params.prefix.get(), StoredLocalGraph);
    165163      if ((ExitFlag == 2) && (tempFlag != 2))
    166164        ExitFlag = tempFlag; // if there is one molecule that needs further fragmentation, it overrides others
     
    175173
    176174  }
     175  // add full cycles if desired
     176  if (params.DoCyclesFull.get()) {
     177    // get the BackEdgeStack from somewhere
     178    DepthFirstSearchAnalysis DFS;
     179    DFS();
     180    std::deque<bond::ptr> BackEdgeStack = DFS.getBackEdgeStack();
     181    // then we analyse the cycles and get them
     182    CyclicStructureAnalysis CycleAnalysis(params.HowtoTreatHydrogen.get() ? ExcludeHydrogen : IncludeHydrogen);
     183    CycleAnalysis(&BackEdgeStack);
     184    CyclicStructureAnalysis::cycles_t cycles = CycleAnalysis.getAllCycles();
     185    LOG(0, "STATUS: Adding " << cycles.size() << " cycles.");
     186    // Create graph and insert into TotalGraph
     187    {
     188      Graph CycleGraph;
     189      for (CyclicStructureAnalysis::cycles_t::const_iterator iter = cycles.begin();
     190          iter != cycles.end(); ++iter) {
     191        const CyclicStructureAnalysis::cycle_t &currentcycle = *iter;
     192        LOG(2, "INFO: Inserting cycle " << currentcycle << ".");
     193#ifndef NDEBUG
     194        std::pair< Graph::iterator, bool > inserter =
     195#endif
     196        CycleGraph.insert( std::make_pair(currentcycle, NumberValuePair(1,1.)) );
     197        ASSERT( inserter.second,
     198            "FragmentationFragmentationAction::performCall() - keyset "
     199            +toString(currentcycle)+" inserted twice into CycleGraph.");
     200      }
     201      TotalGraph.InsertGraph(CycleGraph, keysetcounter);
     202    }
     203  }
     204
    177205  LOG(0, "STATUS: There are " << TotalGraph.size() << " fragments.");
    178206
  • src/Actions/FragmentationAction/FragmentationAction.def

    r8dbcaf rfe0cb8  
    2121// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    2222// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    23 #define paramtypes (std::string)(double)(unsigned int)(bool)(bool)(std::vector<std::string>)(unsigned int)(unsigned int)
    24 #define paramtokens ("fragment-molecule")("distance")("order")("DoSaturate")("ExcludeHydrogen")("output-types")("grid-level")("inter-order")
    25 #define paramdescriptions ("prefix of each fragment file")("distance in space up to which fragments are combined")("order of a discretization, dissection, ...")("do saturate dangling bonds with hydrogen")("whether to exclude hydrogen in the bond graph dissection or not")("type(s) of parsers that output fragment config files")("resolution of density sampling multigrid")("up to which order distinct fragments are combined")
    26 #define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(true))(PARAM_DEFAULT(true))(NOPARAM_DEFAULT)(PARAM_DEFAULT(5))(PARAM_DEFAULT(0))
    27 #define paramreferences (prefix)(distance)(order)(DoSaturation)(HowtoTreatHydrogen)(types)(level)(InterOrder)
     23#define paramtypes (std::string)(double)(unsigned int)(bool)(bool)(std::vector<std::string>)(unsigned int)(unsigned int)(bool)
     24#define paramtokens ("fragment-molecule")("distance")("order")("DoSaturate")("ExcludeHydrogen")("output-types")("grid-level")("inter-order")("DoCyclesFull")
     25#define paramdescriptions ("prefix of each fragment file")("distance in space up to which fragments are combined")("order of a discretization, dissection, ...")("do saturate dangling bonds with hydrogen")("whether to exclude hydrogen in the bond graph dissection or not")("type(s) of parsers that output fragment config files")("resolution of density sampling multigrid")("up to which order distinct fragments are combined")("always calculate (aromatic) rings fully, even beyond desired order")
     26#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(true))(PARAM_DEFAULT(true))(NOPARAM_DEFAULT)(PARAM_DEFAULT(5))(PARAM_DEFAULT(0))(PARAM_DEFAULT(false))
     27#define paramreferences (prefix)(distance)(order)(DoSaturation)(HowtoTreatHydrogen)(types)(level)(InterOrder)(DoCyclesFull)
    2828#define paramvalids \
    2929(DummyValidator< std::string >()) \
     
    3535(RangeValidator< unsigned int >(1, 10)) \
    3636(DummyValidator< unsigned int >()) \
     37(DummyValidator< bool >())
    3738
    3839#undef statetypes
  • src/Fragmentation/Fragmentation.cpp

    r8dbcaf rfe0cb8  
    9898 * \param Order up to how many neighbouring bonds a fragment contains in BondOrderScheme::BottumUp scheme
    9999 * \param prefix prefix string for every fragment file name (may include path)
    100  * \param &DFS contains bond structure analysis data
    101100 * \return 1 - continue, 2 - stop (no fragmentation occured)
    102101 */
     
    105104    int Order,
    106105    const std::string &prefix,
    107     DepthFirstSearchAnalysis &DFS,
    108106    const Graph &ParsedFragmentList)
    109107{
  • src/Fragmentation/Fragmentation.hpp

    r8dbcaf rfe0cb8  
    1414#endif
    1515
    16 #include "Graph/DepthFirstSearchAnalysis.hpp"
    17 
    1816#include "Fragmentation/fragmentation_helpers.hpp"
    1917#include "Fragmentation/Graph.hpp"
    2018#include "Fragmentation/HydrogenSaturation_enum.hpp"
     19#include "Graph/ListOfLocalAtoms.hpp"
    2120#include "types.hpp"
    2221
     
    4746  ~Fragmentation();
    4847
    49   int FragmentMolecule(const std::vector<atomId_t> &atomids, int Order, const std::string &prefix, DepthFirstSearchAnalysis &DFS, const Graph &ParsedFragmentList);
     48  int FragmentMolecule(const std::vector<atomId_t> &atomids, int Order, const std::string &prefix, const Graph &ParsedFragmentList);
    5049
    5150  const Graph& getGraph() const {
  • src/Graph/CyclicStructureAnalysis.cpp

    r8dbcaf rfe0cb8  
    208208    Root->GetTrueFather()->IsCyclic = true;
    209209
    210     std::stringstream output;
    211     output << "Found ring contains: ";
    212     Walker = Root;
    213     while (Walker != BackEdge->rightatom) {
    214       output << Walker->getName() << " <-> ";
    215       Walker = PredecessorList[Walker->getNr()];
    216       Walker->GetTrueFather()->IsCyclic = true;
    217       RingSize++;
    218     }
    219     output << Walker->getName() << "  with a length of " << RingSize << ".";
    220     LOG(0, "INFO: " << output.str());
     210    {
     211      CyclicStructureAnalysis::cycle_t currentcycle;
     212      std::stringstream output;
     213      output << "Found ring contains: ";
     214      Walker = Root;
     215      currentcycle.insert(Walker->GetTrueFather()->getId());
     216      while (Walker != BackEdge->rightatom) { // leftatom is root
     217        output << Walker->getName() << " <-> ";
     218        Walker = PredecessorList[Walker->getNr()];
     219        Walker->GetTrueFather()->IsCyclic = true;
     220#ifndef NDEBUG
     221        std::pair< cycle_t::iterator, bool > inserter =
     222#endif
     223            currentcycle.insert(Walker->GetTrueFather()->getId());
     224        ASSERT( inserter.second,
     225            "CyclicStructureAnalysis::RetrieveCycleMembers() - we already inserted "
     226            +toString(Walker->GetTrueFather()->getId())+" into currentcycle.");
     227        RingSize++;
     228      }
     229      output << Walker->getName() << "  with a length of " << RingSize << ".";
     230      LOG(0, "INFO: " << output.str());
     231      allcycles.push_back(currentcycle);
     232    }
    221233
    222234    // walk through all and set MinimumRingSize
     
    365377  int MinRingSize = -1;
    366378
     379  // clear cycle container
     380  allcycles.clear();
     381
    367382  {
    368383    std::stringstream output;
  • src/Graph/CyclicStructureAnalysis.hpp

    r8dbcaf rfe0cb8  
    1616#include <deque>
    1717#include <map>
     18#include <vector>
    1819
    1920#include "Bond/bond.hpp"
    2021#include "Bond/GraphEdge.hpp"
     22#include "Fragmentation/KeySet.hpp"
    2123#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2224#include "Helpers/defs.hpp"
     
    2931{
    3032public:
     33  //!> typedef for specifying a cycle
     34  typedef KeySet cycle_t;
     35  //!> typedef for specifying many cycles
     36  typedef std::vector< cycle_t > cycles_t;
     37
    3138  explicit CyclicStructureAnalysis(const enum HydrogenTreatment _treatment);
    3239  ~CyclicStructureAnalysis();
     
    3744  const std::map<atomId_t, int >& getMinimumRingSize() const;
    3845
     46  /** Getter for all found cycles.
     47   *
     48   */
     49  cycles_t getAllCycles() const {
     50    return allcycles;
     51  }
     52
    3953private:
     54
    4055  // init or reset
    4156  void InitNode(atomId_t atom_id);
     
    5974  atom *Root;
    6075
     76  //!> container for all found cycles, note that these are global ids
     77  cycles_t allcycles;
     78
    6179  //!> whether to treat hydrogen special or not
    6280  const enum HydrogenTreatment treatment;
Note: See TracChangeset for help on using the changeset viewer.