Debian Codegraph @

include/BALL/DOCKING/COMMON/conformation.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 #ifndef BALL_DOCKING_COMMON_CONFORMATION_H
6 #define BALL_DOCKING_COMMON_CONFORMATION_H
7
8 #include <BALL/KERNEL/atomContainer.h>
9 #include <BALL/CONCEPT/property.h>
10
11 #include <QtCore/QCryptographicHash>
12
13 namespace BALL
14 {
15
16 /** Conformation class.
17
18 This class represents conformations of a molecule by simply
19 storing the atom positions (Vector3) of all atoms that deviate significantly
20 from the resp. atom positions of the base conformation ( = parent molecule).
21 Stored conformations can be applied to
22 the parent molecule to reconstruct the conformer of the molecule.
23 */
24 class BALL_EXPORT Conformation
25 {
26 public:
27
28 /* Default Constructor.
29 */
30 Conformation();
31
32 /* Constructor.
33 @param pointer to AtomContainer
34 */
35 Conformation(AtomContainer* parent, AtomContainer* conformation_molecule);
36
37 /* Copy Constructor.
38 */
39 Conformation (const Conformation& conf);
40
41 /* Destructor.
42 */
43 virtual ~Conformation();
44
45 /** Generate a Sha1-hash for the given molecule */
46 static void generateHash(const AtomContainer* mol, String& hash);
47
48 /** Check whether this conformation is equal to the given Conformation. \n
49 If at least one atom-position of this Conformation deviates more than 1e-02 from the resp. position in the given Conformation, or the conformations have an unequal number of atoms, false is returned. Else, true is returned. */
50 bool operator == (const Conformation& conf);
51
52 /** Check whether this conformation is unequal to the given Conformation. \n
53 If at least one atom-position of this Conformation deviates more than 1e-02 from the resp. position in the given Conformation, or the conformations have an unequal number of atoms, true is returned. Else, false is returned. */
54 bool operator != (const Conformation& conf);
55
56 /** Apply the conformation of the supplied AtomContainer.
57 @param reference to AtomContainer
58 */
59 void applyConformation(AtomContainer& ac) const;
60
61 /** Get the list of all atom positions.
62 @return vector of atom positions
63 */
64 const HashMap<Size, Vector3>* getAtomPositions();
65
66 /** Set the list of atom positions.
67 @param HashMap of atom-indices and atom positions
68 */
69 void setAtomPositions(const AtomContainer* parent, const HashMap<Size, Vector3>& pos);
70
71 const AtomContainer* getParent();
72
73 void setParent(AtomContainer* parent);
74
75 /** Get the ID of the Conformation
76 @return ID of Conformation
77 */
78 String getId();
79
80 /** Check whether the hashkey of this Conformation matches the specified key. This function can thus be used to search for file corruptions. */
81 bool checkID(String& hash);
82
83 void setID(String& hash);
84
85 /** Add a property to this Conformation. The stored properties are assigned to an AtomContainer when applyConformation() is used.
86 @param name the name of the property to be added
87 @param value the value of the property to be added */
88 void addProperty(const String& name, const String& value);
89
90 const std::vector<std::pair<String, String> >* getProperties();
91
92 Size getNoOfAtoms() const;
93
94 private:
95
96 /** Take the conformation of the supplied AtomContainer.
97 @param pointer to AtomContainer
98 */
99 void takeConformation(const AtomContainer* parent, AtomContainer* ac);
100
101 /** Take the conformation of the supplied AtomContainer.
102 @param const reference to AtomContainer
103 */
104 void takeConformation(const AtomContainer& parent, const AtomContainer& ac);
105
106 /** Convert a given value to String with a precision of 2. */
107 static String doubleToString(const double& value);
108
109 /** Generate a Sha1 hashkey for the given molecule and atom positions. This function is intended as a convenience function, so that the atom positions do not need to be applied to 'mol' before calculating the hashkey. \n
110 If the number of atoms of given molecule does not match the number of given atom positions, an exception will be thrown. */
111 void generateHash(const AtomContainer* mol, const HashMap<Size, Vector3>& positions, String& hash);
112
113 String id_;
114 const AtomContainer* source_;
115 Size number_of_atoms_;
116
117 /** Map containing pairs of atom-index and atom-positions */
118 HashMap<Size, Vector3> atom_positions_;
119
120 std::vector<std::pair<String, String> > properties_;
121 };
122 }
123
124 #endif // BALL_DOCKING_COMMON_CONFORMATION_H