Changeset d45ed9


Ignore:
Timestamp:
May 18, 2016, 10:02:06 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, 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_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, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, 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:
bd6e5c
Parents:
b0bc13
git-author:
Frederik Heber <heber@…> (03/07/16 13:03:23)
git-committer:
Frederik Heber <heber@…> (05/18/16 22:02:06)
Message:

Abstracted atom -> fragment association out of Interfragmenter.

Location:
src/Fragmentation
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Interfragmenter.cpp

    rb0bc13 rd45ed9  
    4949#include "LinkedCell/types.hpp"
    5050#include "World.hpp"
    51 
    52 
    53 Interfragmenter::atomkeyset_t Interfragmenter::getAtomKeySetMap(
    54     size_t _MaxOrder
    55     ) const
    56 {
    57   /// create a map of atom to keyset (below equal MaxOrder)
    58   atomkeyset_t atomkeyset;
    59   LOG(1, "INFO: Placing all atoms and their keysets into a map.");
    60   for (Graph::const_iterator keysetiter = TotalGraph.begin();
    61       keysetiter != TotalGraph.end(); ++keysetiter) {
    62     const KeySet &keyset = keysetiter->first;
    63     LOG(2, "DEBUG: Current keyset is " << keyset);
    64     const AtomIdSet atoms(keyset);
    65     const size_t atoms_size = atoms.getAtomIds().size();
    66     if ((atoms_size > _MaxOrder) || (atoms_size == 0))
    67       continue;
    68     for (AtomIdSet::const_iterator atomiter = atoms.begin();
    69         atomiter != atoms.end(); ++atomiter) {
    70       // either create new list ...
    71       std::pair<atomkeyset_t::iterator, bool> inserter =
    72           atomkeyset.insert( std::make_pair(*atomiter, keysets_t(1, &keyset) ));
    73       // ... or push to end
    74       if (inserter.second) {
    75         LOG(3, "DEBUG: Created new entry in map.");
    76       } else {
    77         LOG(3, "DEBUG: Added keyset to present entry.");
    78         inserter.first->second.push_back(&keyset);
    79       }
    80     }
    81   }
    82   LOG(2, "DEBUG: There are " << atomkeyset.size() << " entries in lookup.");
    83 
    84   return atomkeyset;
    85 }
    8651
    8752static Vector getAtomIdSetCenter(
     
    204169    const enum HydrogenTreatment treatment)
    205170{
    206   atomkeyset_t atomkeyset = getAtomKeySetMap(MaxOrder);
     171  AtomFragmentsMap AtomFragments(TotalGraph, MaxOrder);
     172  const atomkeyset_t &atomkeyset = AtomFragments.getMap();
    207173
    208174  Graph InterFragments;
     
    245211  // place all atoms into LC grid with some upper bound
    246212  const LinkedCell::LinkedCell_View view = World::getInstance().getLinkedCell(_upperbound);
    247 
    248   atomkeyset_t atomkeyset = getAtomKeySetMap(_MaxOrder);
    249213
    250214  // go through each atom and find closest atom not in the same keyset
  • src/Fragmentation/Interfragmenter.hpp

    rb0bc13 rd45ed9  
    1919
    2020#include "AtomIdSet.hpp"
     21#include "Fragmentation/AtomFragmentsMap.hpp"
    2122#include "Fragmentation/HydrogenSaturation_enum.hpp"
    2223
     
    7172
    7273private:
    73   /** Helper to translate a keyset into a set of atoms.
    74    *
    75    * \param keyset
    76    * \return vector of atom refs
    77    */
    78   std::vector<atom *> getAtomsFromKeySet(const KeySet &keyset) const;
    7974
    80   typedef std::list<const KeySet *> keysets_t;
    81   typedef std::map<const atom *, keysets_t > atomkeyset_t;
    82 
    83   /** Helper function to create a map of atoms and their fragments/keysets.
    84    *
    85    * \param _MaxOrder maximum order
    86    * \return map with atoms as a keys and fragments as values
    87    */
    88   atomkeyset_t getAtomKeySetMap(size_t _MaxOrder) const;
     75  typedef AtomFragmentsMap::keysets_t keysets_t;
     76  typedef AtomFragmentsMap::AtomFragmentsMap_t atomkeyset_t;
    8977
    9078  typedef std::vector<const atom *> candidates_t;
  • src/Fragmentation/Makefile.am

    rb0bc13 rd45ed9  
    1717        Fragmentation/Homology/HomologyGraph.cpp \
    1818        Fragmentation/AdaptivityMap.cpp \
     19        Fragmentation/AtomFragmentsMap.cpp \
    1920        Fragmentation/BondsPerShortestPath.cpp \
    2021        Fragmentation/EnergyMatrix.cpp \
     
    4647        Fragmentation/Homology/HomologyGraph.hpp \
    4748        Fragmentation/AdaptivityMap.hpp \
     49        Fragmentation/AtomFragmentsMap.hpp \
    4850        Fragmentation/AtomMask.hpp \
    4951        Fragmentation/BondsPerShortestPath.hpp \
Note: See TracChangeset for help on using the changeset viewer.