source: src/Fragmentation/Homology/AtomFragmentsMap.hpp@ 33a694

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since 33a694 was 4fa333, checked in by Frederik Heber <heber@…>, 9 years ago

FIX: AtomFragmentsMap::clear() did not clear fullkeysets.

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[d45ed9]1/*
2 * AtomFragmentsMap.hpp
3 *
4 * Created on: Mar 7, 2016
5 * Author: heber
6 */
7
8
9#ifndef ATOMFRAGMENTSMAP_HPP_
10#define ATOMFRAGMENTSMAP_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
[d713ce]17#include "CodePatterns/Singleton.hpp"
18
[d45ed9]19#include <list>
20#include <map>
[70aeed]21#include <vector>
[d45ed9]22
[16d67a]23#include <boost/serialization/export.hpp>
[78202b]24#include <boost/serialization/list.hpp>
[16d67a]25#include <boost/serialization/map.hpp>
[70aeed]26#include <boost/serialization/set.hpp>
27#include <boost/serialization/vector.hpp>
[16d67a]28#include <boost/serialization/version.hpp>
29
[bd6e5c]30#include "types.hpp"
31
[d45ed9]32class KeySet;
33class Graph;
34
35/** This class creates in instantiation a map connecting each atom with
36 * the (known) fragments it takes part in.
37 *
[d713ce]38 * In the HomologyGraph and its -Container we do not have this information
39 * any longer. However, we need this in order to make statements about atomic
40 * properties from calculated fragment properties.
41 *
[d45ed9]42 */
[d713ce]43class AtomFragmentsMap : public Singleton<AtomFragmentsMap>
[d45ed9]44{
45public:
[d713ce]46 //** Function to insert new fragments into storage container.
47 void insert(
[2fd88d1]48 const Graph &_graph);
[d45ed9]49
[d713ce]50 /** Function to clear the container.
51 *
52 */
[4fa333]53 void clear();
[d713ce]54
[70aeed]55 typedef std::vector<atomId_t> indices_t;
[bd6e5c]56 typedef std::list<KeySet> keysets_t;
[d45ed9]57 //!> typedef for the internal map
[bd6e5c]58 typedef std::map<atomId_t, keysets_t> AtomFragmentsMap_t;
[70aeed]59 typedef std::map<KeySet, indices_t > FragmentFullKeysetMap_t;
[d45ed9]60
[2fd88d1]61 /** Getter for full stored map.
62 *
63 * \return const ref to internal map
64 */
[d45ed9]65 const AtomFragmentsMap_t& getMap() const
66 { return atommap; }
67
[70aeed]68 /** Allows to add the full keyset, with excluded hydrogens, to add
69 * to a given \a _keyset
70 *
71 * \param _keyset keyset to a fragment without hydrogens
72 * \param _fullkeyset full keyset with excluded hydrogens to associate with \a _keyset
73 * \return true - insertion ok, else - index set already present
74 */
75 bool addFullKeyset(const KeySet &_keyset, const indices_t &_fullkeyset);
76
77 /** Getter for the full key set, i.e. including excluded hydrogens, for a
78 * given \a _keyset without them.
79 *
80 * \param _keyset keyset to a fragment without hydrogens
81 * \return full index set containing all keys from \a _keyset and all excluded
82 * hydrogens
83 */
84 const indices_t &getFullKeyset(const KeySet &_keyset) const;
85
[2fd88d1]86 /** Getter to map cut down to given selection of atoms.
87 *
88 * \param _candidates subset of atoms
89 * \param _MaxOrder constrain returned fragment list to contain at most this size
90 * \return map with fragments for each of the candidates
91 */
92 AtomFragmentsMap_t getMap(
93 const std::vector<atomId_t> &_candidates,
94 size_t _MaxOrder) const;
[70aeed]95
96 /** Checks whether we have a full keyset for every keyset contained.
97 *
98 * \return true - is complete, false - else
99 */
100 bool checkCompleteness() const;
101
[d713ce]102private:
103 //!> grant singleton pattern access to private cstor/dstor
104 friend class Singleton<AtomFragmentsMap>;
105
106 /** Private default cstor.
107 *
108 */
109 AtomFragmentsMap() {}
110
111 /** Private default dstor.
112 *
113 */
114 ~AtomFragmentsMap() {}
115
[d45ed9]116private:
[70aeed]117 //!> internal map associating atoms and fragments
[d45ed9]118 AtomFragmentsMap_t atommap;
[16d67a]119
[70aeed]120 //!> internal map to get from keyset (without hydrogens) to full keyset, i.e. forcekeyset
121 FragmentFullKeysetMap_t fullkeysets;
122
[16d67a]123private:
124 friend class boost::serialization::access;
125 // serialization
126 template <typename Archive>
127 void serialize(Archive& ar, const unsigned int version)
128 {
129 ar & atommap;
[70aeed]130 ar & fullkeysets;
[16d67a]131 }
[d45ed9]132};
133
134
135#endif /* ATOMFRAGMENTSMAP_HPP_ */
Note: See TracBrowser for help on using the repository browser.