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 |
|
---|
20 | #include <iosfwd>
|
---|
21 |
|
---|
22 |
|
---|
23 | /****************************************** forward declarations *****************************/
|
---|
24 |
|
---|
25 | class molecule;
|
---|
26 | class BondedParticle;
|
---|
27 | class MatrixContainer;
|
---|
28 |
|
---|
29 | /********************************************** definitions *********************************/
|
---|
30 |
|
---|
31 | /********************************************** declarations *******************************/
|
---|
32 |
|
---|
33 |
|
---|
34 | class BondGraph {
|
---|
35 | public:
|
---|
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 | */
|
---|
39 | BondGraph(bool IsA);
|
---|
40 |
|
---|
41 | /** Destructor of class BondGraph.
|
---|
42 | */
|
---|
43 | ~BondGraph();
|
---|
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 | */
|
---|
51 | bool LoadBondLengthTable(std::istream &input);
|
---|
52 |
|
---|
53 | /** Creates the bond list for all atoms in a given molecule.
|
---|
54 | * \param *mol molecule with atoms
|
---|
55 | * \return true - success, false - failed to construct bond structure
|
---|
56 | */
|
---|
57 | bool CreateAdjacencyForMolecule(molecule * const mol);
|
---|
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 | */
|
---|
64 | double GetBondLength(int firstelement, int secondelement);
|
---|
65 |
|
---|
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);
|
---|
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(const BondedParticle * const Walker, const BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
81 |
|
---|
82 | /** Returns the maximum distance (e.g. necessary for LinkedCell).
|
---|
83 | * \return BondGraph::max_distance
|
---|
84 | */
|
---|
85 | double getMaxDistance() const;
|
---|
86 |
|
---|
87 | private:
|
---|
88 | static const double BondThreshold;
|
---|
89 |
|
---|
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 | */
|
---|
99 | void BondLengthMatrixMinMaxDistance(const BondedParticle * const Walker, const BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
100 |
|
---|
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 | */
|
---|
108 | void CovalentMinMaxDistance(const BondedParticle * const Walker, const BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
|
---|
109 |
|
---|
110 | //!> Matrix with bond lenth per two elements
|
---|
111 | MatrixContainer *BondLengthMatrix;
|
---|
112 | //!> maximum distance over all bonds possible
|
---|
113 | double max_distance;
|
---|
114 | //!> distance units are angstroem (true), bohr radii (false)
|
---|
115 | bool IsAngstroem;
|
---|
116 | };
|
---|
117 |
|
---|
118 | #endif /* BONDGRAPH_HPP_ */
|
---|