/* * Interfragmenter.hpp * * Created on: Jul 5, 2013 * Author: heber */ #ifndef INTERFRAGMENTER_HPP_ #define INTERFRAGMENTER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "AtomIdSet.hpp" #include "Fragmentation/Homology/AtomFragmentsMap.hpp" #include "Fragmentation/HydrogenSaturation_enum.hpp" class atom; class KeySet; class Graph; /** This functor adds the union of certain fragments to a given set of fragments * (a Graph) by combining them depending on whether they are (not) bonded and * how far their centers are apart and which bond order they have. * * This is to allow calculation of interfragment energies. As fragments are * always of the same molecule, energies in between molecules so far are only * attained electrostratically, whereas dynamic correlation is totally missed. * Interfragments that are calculate with e.g. a sensible Post-HF method contain * dynamic correlation which can then be used for later potential fitting. */ class Interfragmenter { public: /** Adds interrelated fragments to TotalGraph up to \a MaxOrder and \a Rcut. * * \param TotalGraph filled with additional inter-fragments on return * \param MaxOrder maximum order for fragments to interrelate * \param Rcut maximum distance to check for interrelatable fragments * \param treatment whether hydrogens are treated specially or not */ void operator()( Graph &TotalGraph, const size_t MaxOrder, const double Rcut, const enum HydrogenTreatment treatment); /** This finds the largest cut off distance (\a Rcut) such that when running * operator() no additional inter-fragments would be produced. * * \param MaxOrder maximum order for fragments to interrelate * \param _upperbound upper bound on \a Rcut above which we do not look * \param treatment whether hydrogens are treated specially or not * \return largest cutoff distance to cause no additional inter-fragments */ double findLargestCutoff( const size_t _MaxOrder, const double _upperbound, const enum HydrogenTreatment _treatment) const; private: typedef AtomFragmentsMap::keysets_t keysets_t; typedef AtomFragmentsMap::AtomFragmentsMap_t atomkeyset_t; typedef std::vector candidates_t; /** Helper function to get all atoms around a specific keyset not contained in * the same molecule. * * \param _atoms all atoms of a fragment * \param _Rcut desired distance cutoff * \param _treatment whether hydrogens are treated special or not */ candidates_t getNeighborsOutsideMolecule( const AtomIdSet &_atoms, const double _Rcut, const enum HydrogenTreatment _treatment) const; /** For a given set of candidates atoms in \a _candidates and a \a _keyset * we combine each fragment from either atom and place it into internal * Graph. * * \param _MaxOrder maximum order * \param _candidates all atoms neighboring the current out outside of its molecule * \param _fragmentmap all keysets related to this atom * \param _keyset current keyset (used as base for creating inter-fragments) * \param _InterFragments container for all created inter-fragments * \param _counter counts added fragments */ void combineFragments( const size_t _MaxOrder, const candidates_t &_candidates, const atomkeyset_t &_fragmentmap, const KeySet &_keyset, Graph &_InterFragments, int &_counter); }; #endif /* INTERFRAGMENTER_HPP_ */