| [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 |   /** Adds interrelated fragments to TotalGraph up to \a MaxOrder and \a Rcut.
 | 
|---|
 | 42 |    *
 | 
|---|
| [d410e25] | 43 |    * \param TotalGraph filled with additional inter-fragments on return
 | 
|---|
| [0331ee] | 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()(
 | 
|---|
| [d410e25] | 49 |       Graph &TotalGraph,
 | 
|---|
| [0d9053] | 50 |       const size_t MaxOrder,
 | 
|---|
 | 51 |       const double Rcut,
 | 
|---|
| [0331ee] | 52 |       const enum HydrogenTreatment treatment);
 | 
|---|
 | 53 | 
 | 
|---|
| [cee9e8] | 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 | 
 | 
|---|
| [0331ee] | 67 | private:
 | 
|---|
| [0d9053] | 68 | 
 | 
|---|
| [d45ed9] | 69 |   typedef AtomFragmentsMap::keysets_t keysets_t;
 | 
|---|
 | 70 |   typedef AtomFragmentsMap::AtomFragmentsMap_t atomkeyset_t;
 | 
|---|
| [0d9053] | 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(
 | 
|---|
| [b1c5f46] | 98 |       const size_t _MaxOrder,
 | 
|---|
| [0d9053] | 99 |       const candidates_t &_candidates,
 | 
|---|
| [bd6e5c] | 100 |       const atomkeyset_t &_fragmentmap,
 | 
|---|
| [0d9053] | 101 |       const KeySet &_keyset,
 | 
|---|
 | 102 |       Graph &_InterFragments,
 | 
|---|
 | 103 |       int &_counter);
 | 
|---|
| [0331ee] | 104 | };
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | #endif /* INTERFRAGMENTER_HPP_ */
 | 
|---|