Changeset bd6e5c for src/Fragmentation


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:
d713ce
Parents:
d45ed9
git-author:
Frederik Heber <heber@…> (03/07/16 13:44:02)
git-committer:
Frederik Heber <heber@…> (05/18/16 22:02:06)
Message:

Prepared AtomFragmentsMap to work in ids, not instances.

  • no more ptrs such that we may convert it into a serializable singleton container.
Location:
src/Fragmentation
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/AtomFragmentsMap.cpp

    rd45ed9 rbd6e5c  
    5454    const KeySet &keyset = keysetiter->first;
    5555    LOG(2, "DEBUG: Current keyset is " << keyset);
    56     const AtomIdSet atoms(keyset);
    57     const size_t atoms_size = atoms.getAtomIds().size();
    58     if ((atoms_size > _MaxOrder) || (atoms_size == 0))
     56    if ((keyset.size() > _MaxOrder) || (keyset.empty()))
    5957      continue;
    60     for (AtomIdSet::const_iterator atomiter = atoms.begin();
    61         atomiter != atoms.end(); ++atomiter) {
     58    for (KeySet::const_iterator keyiter = keyset.begin();
     59        keyiter != keyset.end(); ++keyiter) {
    6260      // either create new list ...
    6361      std::pair<AtomFragmentsMap_t::iterator, bool> inserter =
    64           atommap.insert( std::make_pair(*atomiter, keysets_t(1, &keyset) ));
     62          atommap.insert( std::make_pair(*keyiter, keysets_t(1, keyset) ));
    6563      // ... or push to end
    6664      if (inserter.second) {
     
    6866      } else {
    6967        LOG(3, "DEBUG: Added keyset to present entry.");
    70         inserter.first->second.push_back(&keyset);
     68        inserter.first->second.push_back(keyset);
    7169      }
    7270    }
  • src/Fragmentation/AtomFragmentsMap.hpp

    rd45ed9 rbd6e5c  
    1818#include <map>
    1919
    20 class atom;
     20#include "types.hpp"
     21
    2122class KeySet;
    2223class Graph;
     
    3334      size_t _MaxOrder);
    3435
    35   typedef std::list<const KeySet *> keysets_t;
     36  typedef std::list<KeySet> keysets_t;
    3637  //!> typedef for the internal map
    37   typedef std::map<const atom *, keysets_t> AtomFragmentsMap_t;
     38  typedef std::map<atomId_t, keysets_t> AtomFragmentsMap_t;
    3839
    3940  const AtomFragmentsMap_t& getMap() const
  • src/Fragmentation/Interfragmenter.cpp

    rd45ed9 rbd6e5c  
    107107  for (candidates_t::const_iterator candidateiter = _candidates.begin();
    108108      candidateiter != _candidates.end(); ++candidateiter) {
    109     const atom * _atom = *candidateiter;
    110     atomkeyset_t::const_iterator iter = _atomkeyset.find(_atom);
     109    const atomId_t atomid = (*candidateiter)->getId();
     110    atomkeyset_t::const_iterator iter = _atomkeyset.find(atomid);
    111111    ASSERT( iter != _atomkeyset.end(),
    112112        "Interfragmenter::getAtomSpecificKeySetMap() - could not find atom "
    113         +toString(_atom->getId())+" in lookup.");
    114     fragmentmap.insert( std::make_pair( _atom, iter->second) );
     113        +toString(atomid)+" in lookup.");
     114    fragmentmap.insert( std::make_pair( atomid, iter->second) );
    115115  }
    116116  LOG(4, "DEBUG: Copied part of lookup map contains " << fragmentmap.size() << " keys.");
     
    122122    const size_t _MaxOrder,
    123123    const candidates_t &_candidates,
    124     atomkeyset_t &_fragmentmap,
     124    const atomkeyset_t &_fragmentmap,
    125125    const KeySet &_keyset,
    126126    Graph &_InterFragments,
     
    131131    const atom *_atom = *candidateiter;
    132132    LOG(3, "DEBUG: Current candidate is " << *_atom << ".");
    133     atomkeyset_t::iterator finditer = _fragmentmap.find(_atom);
     133    atomkeyset_t::const_iterator finditer = _fragmentmap.find(_atom->getId());
    134134    ASSERT( finditer != _fragmentmap.end(),
    135135        "Interfragmenter::combineFragments() - could not find atom "
    136136        +toString(_atom->getId())+" in fragment specific lookup.");
    137     keysets_t &othersets = finditer->second;
     137    // copy set to allow erase
     138    keysets_t othersets(finditer->second);
    138139    ASSERT( !othersets.empty(),
    139140        "Interfragmenter::combineFragments() - keysets to "+toString(_atom->getId())+
     
    141142    keysets_t::iterator otheriter = othersets.begin();
    142143    while (otheriter != othersets.end()) {
    143       const KeySet &otherset = **otheriter;
     144      const KeySet &otherset = *otheriter;
    144145      LOG(3, "DEBUG: Current keyset is " << otherset << ".");
    145146      // only add them one way round and not the other
  • src/Fragmentation/Interfragmenter.hpp

    rd45ed9 rbd6e5c  
    114114      const size_t _MaxOrder,
    115115      const candidates_t &_candidates,
    116       atomkeyset_t &_fragmentmap,
     116      const atomkeyset_t &_fragmentmap,
    117117      const KeySet &_keyset,
    118118      Graph &_InterFragments,
Note: See TracChangeset for help on using the changeset viewer.