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