1 | /*
|
---|
2 | * Interfragmenter.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jul 5, 2013
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef INTERFRAGMENTER_HPP_
|
---|
9 | #define INTERFRAGMENTER_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <list>
|
---|
17 | #include <map>
|
---|
18 | #include <vector>
|
---|
19 |
|
---|
20 | #include "AtomIdSet.hpp"
|
---|
21 | #include "Fragmentation/HydrogenSaturation_enum.hpp"
|
---|
22 |
|
---|
23 | class atom;
|
---|
24 | class KeySet;
|
---|
25 | class Graph;
|
---|
26 |
|
---|
27 | /** This functor adds the union of certain fragments to a given set of fragments
|
---|
28 | * (a Graph) by combining them depending on whether they are (not) bonded and
|
---|
29 | * how far their centers are apart and which bond order they have.
|
---|
30 | *
|
---|
31 | * This is to allow calculation of interfragment energies. As fragments are
|
---|
32 | * always of the same molecule, energies in between molecules so far are only
|
---|
33 | * attained electrostratically, whereas dynamic correlation is totally missed.
|
---|
34 | * Interfragments that are calculate with e.g. a sensible Post-HF method contain
|
---|
35 | * dynamic correlation which can then be used for later potential fitting.
|
---|
36 | */
|
---|
37 | class Interfragmenter
|
---|
38 | {
|
---|
39 | public:
|
---|
40 | /** Constructor for class Interfragmenter.
|
---|
41 | *
|
---|
42 | * \param _TotalGraph Graph with all fragments to interrelate
|
---|
43 | */
|
---|
44 | Interfragmenter(Graph &_TotalGraph) :
|
---|
45 | TotalGraph(_TotalGraph)
|
---|
46 | {}
|
---|
47 |
|
---|
48 | /** Adds interrelated fragments to TotalGraph up to \a MaxOrder and \a Rcut.
|
---|
49 | *
|
---|
50 | * \param MaxOrder maximum order for fragments to interrelate
|
---|
51 | * \param Rcut maximum distance to check for interrelatable fragments
|
---|
52 | * \param treatment whether hydrogens are treated specially or not
|
---|
53 | */
|
---|
54 | void operator()(
|
---|
55 | const size_t MaxOrder,
|
---|
56 | const double Rcut,
|
---|
57 | const enum HydrogenTreatment treatment);
|
---|
58 |
|
---|
59 | /** This finds the largest cut off distance (\a Rcut) such that when running
|
---|
60 | * operator() no additional inter-fragments would be produced.
|
---|
61 | *
|
---|
62 | * \param MaxOrder maximum order for fragments to interrelate
|
---|
63 | * \param _upperbound upper bound on \a Rcut above which we do not look
|
---|
64 | * \param treatment whether hydrogens are treated specially or not
|
---|
65 | * \return largest cutoff distance to cause no additional inter-fragments
|
---|
66 | */
|
---|
67 | double findLargestCutoff(
|
---|
68 | const size_t _MaxOrder,
|
---|
69 | const double _upperbound,
|
---|
70 | const enum HydrogenTreatment _treatment) const;
|
---|
71 |
|
---|
72 | private:
|
---|
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;
|
---|
79 |
|
---|
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;
|
---|
89 |
|
---|
90 | typedef std::vector<const atom *> candidates_t;
|
---|
91 |
|
---|
92 | /** Helper function to get all atoms around a specific keyset not contained in
|
---|
93 | * the same molecule.
|
---|
94 | *
|
---|
95 | * \param _atoms all atoms of a fragment
|
---|
96 | * \param _Rcut desired distance cutoff
|
---|
97 | * \param _treatment whether hydrogens are treated special or not
|
---|
98 | */
|
---|
99 | candidates_t getNeighborsOutsideMolecule(
|
---|
100 | const AtomIdSet &_atoms,
|
---|
101 | const double _Rcut,
|
---|
102 | const enum HydrogenTreatment _treatment) const;
|
---|
103 |
|
---|
104 | /** Helper function to return a fragment/KeySet map specific to all candidates.
|
---|
105 | *
|
---|
106 | * \param _candidates all neighboring atoms around keyset
|
---|
107 | * \param _atomkeyset map with all atoms and the KeySets they are contained in
|
---|
108 | * \return specific fragment map
|
---|
109 | */
|
---|
110 | atomkeyset_t getCandidatesSpecificKeySetMap(
|
---|
111 | const candidates_t &_candidates,
|
---|
112 | const atomkeyset_t &_atomkeyset) const;
|
---|
113 |
|
---|
114 | /** For a given set of candidates atoms in \a _candidates and a \a _keyset
|
---|
115 | * we combine each fragment from either atom and place it into internal
|
---|
116 | * Graph.
|
---|
117 | *
|
---|
118 | * \param _MaxOrder maximum order
|
---|
119 | * \param _candidates all atoms neighboring the current out outside of its molecule
|
---|
120 | * \param _fragmentmap all keysets related to this atom
|
---|
121 | * \param _keyset current keyset (used as base for creating inter-fragments)
|
---|
122 | * \param _InterFragments container for all created inter-fragments
|
---|
123 | * \param _counter counts added fragments
|
---|
124 | */
|
---|
125 | void combineFragments(
|
---|
126 | const size_t _MaxOrder,
|
---|
127 | const candidates_t &_candidates,
|
---|
128 | atomkeyset_t &_fragmentmap,
|
---|
129 | const KeySet &_keyset,
|
---|
130 | Graph &_InterFragments,
|
---|
131 | int &_counter);
|
---|
132 |
|
---|
133 | private:
|
---|
134 | Graph &TotalGraph;
|
---|
135 | };
|
---|
136 |
|
---|
137 | #endif /* INTERFRAGMENTER_HPP_ */
|
---|