| 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/Homology/AtomFragmentsMap.hpp" | 
|---|
| 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 | /** Adds interrelated fragments to TotalGraph up to \a MaxOrder and \a Rcut. | 
|---|
| 42 | * | 
|---|
| 43 | * \param TotalGraph filled with additional inter-fragments on return | 
|---|
| 44 | * \param MaxOrder maximum order for fragments to interrelate | 
|---|
| 45 | * \param Rcut maximum distance to check for interrelatable fragments | 
|---|
| 46 | * \param treatment whether hydrogens are treated specially or not | 
|---|
| 47 | */ | 
|---|
| 48 | void operator()( | 
|---|
| 49 | Graph &TotalGraph, | 
|---|
| 50 | const size_t MaxOrder, | 
|---|
| 51 | const double Rcut, | 
|---|
| 52 | const enum HydrogenTreatment treatment); | 
|---|
| 53 |  | 
|---|
| 54 | /** This finds the largest cut off distance (\a Rcut) such that when running | 
|---|
| 55 | * operator() no additional inter-fragments would be produced. | 
|---|
| 56 | * | 
|---|
| 57 | * \param MaxOrder maximum order for fragments to interrelate | 
|---|
| 58 | * \param _upperbound upper bound on \a Rcut above which we do not look | 
|---|
| 59 | * \param treatment whether hydrogens are treated specially or not | 
|---|
| 60 | * \return largest cutoff distance to cause no additional inter-fragments | 
|---|
| 61 | */ | 
|---|
| 62 | double findLargestCutoff( | 
|---|
| 63 | const size_t _MaxOrder, | 
|---|
| 64 | const double _upperbound, | 
|---|
| 65 | const enum HydrogenTreatment _treatment) const; | 
|---|
| 66 |  | 
|---|
| 67 | private: | 
|---|
| 68 |  | 
|---|
| 69 | typedef AtomFragmentsMap::keysets_t keysets_t; | 
|---|
| 70 | typedef AtomFragmentsMap::AtomFragmentsMap_t atomkeyset_t; | 
|---|
| 71 |  | 
|---|
| 72 | typedef std::vector<const atom *> candidates_t; | 
|---|
| 73 |  | 
|---|
| 74 | /** Helper function to get all atoms around a specific keyset not contained in | 
|---|
| 75 | * the same molecule. | 
|---|
| 76 | * | 
|---|
| 77 | * \param _atoms all atoms of a fragment | 
|---|
| 78 | * \param _Rcut desired distance cutoff | 
|---|
| 79 | * \param _treatment whether hydrogens are treated special or not | 
|---|
| 80 | */ | 
|---|
| 81 | candidates_t getNeighborsOutsideMolecule( | 
|---|
| 82 | const AtomIdSet &_atoms, | 
|---|
| 83 | const double _Rcut, | 
|---|
| 84 | const enum HydrogenTreatment _treatment) const; | 
|---|
| 85 |  | 
|---|
| 86 | /** For a given set of candidates atoms in \a _candidates and a \a _keyset | 
|---|
| 87 | * we combine each fragment from either atom and place it into internal | 
|---|
| 88 | * Graph. | 
|---|
| 89 | * | 
|---|
| 90 | * \param _MaxOrder maximum order | 
|---|
| 91 | * \param _candidates all atoms neighboring the current out outside of its molecule | 
|---|
| 92 | * \param _fragmentmap all keysets related to this atom | 
|---|
| 93 | * \param _keyset current keyset (used as base for creating inter-fragments) | 
|---|
| 94 | * \param _InterFragments container for all created inter-fragments | 
|---|
| 95 | * \param _counter counts added fragments | 
|---|
| 96 | */ | 
|---|
| 97 | void combineFragments( | 
|---|
| 98 | const size_t _MaxOrder, | 
|---|
| 99 | const candidates_t &_candidates, | 
|---|
| 100 | const atomkeyset_t &_fragmentmap, | 
|---|
| 101 | const KeySet &_keyset, | 
|---|
| 102 | Graph &_InterFragments, | 
|---|
| 103 | int &_counter); | 
|---|
| 104 | }; | 
|---|
| 105 |  | 
|---|
| 106 | #endif /* INTERFRAGMENTER_HPP_ */ | 
|---|