[b70721] | 1 | /*
|
---|
| 2 | * bondgraph.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Oct 29, 2009
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef BONDGRAPH_HPP_
|
---|
| 9 | #define BONDGRAPH_HPP_
|
---|
| 10 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
| 13 | /*********************************************** includes ***********************************/
|
---|
| 14 |
|
---|
| 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[986ed3] | 20 | #include <iosfwd>
|
---|
[b70721] | 21 |
|
---|
[b48ba6] | 22 |
|
---|
[b70721] | 23 | /****************************************** forward declarations *****************************/
|
---|
| 24 |
|
---|
| 25 | class molecule;
|
---|
[97ebf8] | 26 | class BondedParticle;
|
---|
[b70721] | 27 | class MatrixContainer;
|
---|
| 28 |
|
---|
| 29 | /********************************************** definitions *********************************/
|
---|
| 30 |
|
---|
| 31 | /********************************************** declarations *******************************/
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | class BondGraph {
|
---|
| 35 | public:
|
---|
[e7350d4] | 36 | /** Constructor of class BondGraph.
|
---|
| 37 | * This classes contains typical bond lengths and thus may be used to construct a bond graph for a given molecule.
|
---|
| 38 | */
|
---|
[b70721] | 39 | BondGraph(bool IsA);
|
---|
[e7350d4] | 40 |
|
---|
| 41 | /** Destructor of class BondGraph.
|
---|
| 42 | */
|
---|
[b70721] | 43 | ~BondGraph();
|
---|
[e7350d4] | 44 |
|
---|
| 45 | /** Parses the bond lengths in a given file and puts them int a matrix form.
|
---|
| 46 | * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(),
|
---|
| 47 | * but only if parsing is successful. Otherwise variable is left as NULL.
|
---|
| 48 | * \param &input input stream to parse table from
|
---|
| 49 | * \return true - success in parsing file, false - failed to parse the file
|
---|
| 50 | */
|
---|
[4e855e] | 51 | bool LoadBondLengthTable(std::istream &input);
|
---|
[e7350d4] | 52 |
|
---|
[715b67] | 53 | /** Creates the bond list for all atoms in a given molecule.
|
---|
[e7350d4] | 54 | * \param *mol molecule with atoms
|
---|
| 55 | * \return true - success, false - failed to construct bond structure
|
---|
| 56 | */
|
---|
[715b67] | 57 | bool CreateAdjacencyForMolecule(molecule * const mol);
|
---|
[e7350d4] | 58 |
|
---|
| 59 | /** Returns the entry for a given index pair.
|
---|
| 60 | * \param firstelement index/atom number of first element (row index)
|
---|
| 61 | * \param secondelement index/atom number of second element (column index)
|
---|
| 62 | * \note matrix is of course symmetric.
|
---|
| 63 | */
|
---|
[b70721] | 64 | double GetBondLength(int firstelement, int secondelement);
|
---|
| 65 |
|
---|
[e7350d4] | 66 | /** Determines the maximum of all element::CovalentRadius for elements present in \a *mol.
|
---|
| 67 | * \param *out output stream for debugging
|
---|
| 68 | * \param *mol molecule with all atoms and their respective elements.
|
---|
| 69 | */
|
---|
| 70 | double SetMaxDistanceToMaxOfCovalentRadii(const molecule * const mol);
|
---|
[72d90e] | 71 |
|
---|
| 72 | /** Returns bond criterion for given pair based on a bond length matrix.
|
---|
| 73 | * This calls either the covalent or the bond matrix criterion.
|
---|
| 74 | * \param *Walker first BondedParticle
|
---|
| 75 | * \param *OtherWalker second BondedParticle
|
---|
| 76 | * \param &MinDistance lower bond bound on return
|
---|
| 77 | * \param &MaxDistance upper bond bound on return
|
---|
| 78 | * \param IsAngstroem whether units are in angstroem or bohr radii
|
---|
| 79 | */
|
---|
| 80 | void getMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
[b70721] | 81 |
|
---|
[e7350d4] | 82 | /** Returns the maximum distance (e.g. necessary for LinkedCell).
|
---|
| 83 | * \return BondGraph::max_distance
|
---|
| 84 | */
|
---|
[af2c424] | 85 | double getMaxDistance() const;
|
---|
| 86 |
|
---|
[b70721] | 87 | private:
|
---|
[88b400] | 88 | static const double BondThreshold;
|
---|
| 89 |
|
---|
[e7350d4] | 90 | /** Returns bond criterion for given pair based on a bond length matrix.
|
---|
| 91 | * The matrix should be contained in \a this BondGraph and contain an element-
|
---|
| 92 | * to-element length.
|
---|
| 93 | * \param *Walker first BondedParticle
|
---|
| 94 | * \param *OtherWalker second BondedParticle
|
---|
| 95 | * \param &MinDistance lower bond bound on return
|
---|
| 96 | * \param &MaxDistance upper bond bound on return
|
---|
| 97 | * \param IsAngstroem whether units are in angstroem or bohr radii
|
---|
| 98 | */
|
---|
[72d90e] | 99 | void BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
| 100 |
|
---|
[e7350d4] | 101 | /** Returns bond criterion for given pair based on covalent radius.
|
---|
| 102 | * \param *Walker first BondedParticle
|
---|
| 103 | * \param *OtherWalker second BondedParticle
|
---|
| 104 | * \param &MinDistance lower bond bound on return
|
---|
| 105 | * \param &MaxDistance upper bond bound on return
|
---|
| 106 | * \param IsAngstroem whether units are in angstroem or bohr radii
|
---|
| 107 | */
|
---|
[72d90e] | 108 | void CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
| 109 |
|
---|
[e7350d4] | 110 | //!> Matrix with bond lenth per two elements
|
---|
[b70721] | 111 | MatrixContainer *BondLengthMatrix;
|
---|
[e7350d4] | 112 | //!> maximum distance over all bonds possible
|
---|
[b70721] | 113 | double max_distance;
|
---|
[e7350d4] | 114 | //!> distance units are angstroem (true), bohr radii (false)
|
---|
[b70721] | 115 | bool IsAngstroem;
|
---|
| 116 | };
|
---|
| 117 |
|
---|
| 118 | #endif /* BONDGRAPH_HPP_ */
|
---|