/* * bondgraph.hpp * * Created on: Oct 29, 2009 * Author: heber */ #ifndef BONDGRAPH_HPP_ #define BONDGRAPH_HPP_ using namespace std; /*********************************************** includes ***********************************/ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include /****************************************** forward declarations *****************************/ class molecule; class BondedParticle; class MatrixContainer; /********************************************** definitions *********************************/ /********************************************** declarations *******************************/ class BondGraph { public: /** Constructor of class BondGraph. * This classes contains typical bond lengths and thus may be used to construct a bond graph for a given molecule. */ BondGraph(bool IsA); /** Destructor of class BondGraph. */ ~BondGraph(); /** Parses the bond lengths in a given file and puts them int a matrix form. * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(), * but only if parsing is successful. Otherwise variable is left as NULL. * \param &input input stream to parse table from * \return true - success in parsing file, false - failed to parse the file */ bool LoadBondLengthTable(std::istream &input); /** Parses the bond lengths in a given file and puts them int a matrix form. * \param *out output stream for debugging * \param *mol molecule with atoms * \return true - success, false - failed to construct bond structure */ bool ConstructBondGraph(molecule * const mol); /** Returns the entry for a given index pair. * \param firstelement index/atom number of first element (row index) * \param secondelement index/atom number of second element (column index) * \note matrix is of course symmetric. */ double GetBondLength(int firstelement, int secondelement); /** Determines the maximum of all element::CovalentRadius for elements present in \a *mol. * \param *out output stream for debugging * \param *mol molecule with all atoms and their respective elements. */ double SetMaxDistanceToMaxOfCovalentRadii(const molecule * const mol); /** Returns bond criterion for given pair based on a bond length matrix. * This calls either the covalent or the bond matrix criterion. * \param *Walker first BondedParticle * \param *OtherWalker second BondedParticle * \param &MinDistance lower bond bound on return * \param &MaxDistance upper bond bound on return * \param IsAngstroem whether units are in angstroem or bohr radii */ void getMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem); /** Returns the maximum distance (e.g. necessary for LinkedCell). * \return BondGraph::max_distance */ double getMaxDistance() const; private: static const double BondThreshold; /** Returns bond criterion for given pair based on a bond length matrix. * The matrix should be contained in \a this BondGraph and contain an element- * to-element length. * \param *Walker first BondedParticle * \param *OtherWalker second BondedParticle * \param &MinDistance lower bond bound on return * \param &MaxDistance upper bond bound on return * \param IsAngstroem whether units are in angstroem or bohr radii */ void BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem); /** Returns bond criterion for given pair based on covalent radius. * \param *Walker first BondedParticle * \param *OtherWalker second BondedParticle * \param &MinDistance lower bond bound on return * \param &MaxDistance upper bond bound on return * \param IsAngstroem whether units are in angstroem or bohr radii */ void CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem); //!> Matrix with bond lenth per two elements MatrixContainer *BondLengthMatrix; //!> maximum distance over all bonds possible double max_distance; //!> distance units are angstroem (true), bohr radii (false) bool IsAngstroem; }; #endif /* BONDGRAPH_HPP_ */