Debian Codegraph @

include/BALL/MOLMEC/AMBER/GAFFTypeProcessor.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 #ifndef BALL_MOLMEC_AMBER_GAFFTYPEPROCESSOR_H
6 #define BALL_MOLMEC_AMBER_GAFFTYPEPROCESSOR_H
7
8 #ifndef BALL_CONCEPT_COMPOSITE_H
9 # include <BALL/CONCEPT/composite.h>
10 #endif
11
12 #ifndef BALL_CONCEPT_PROCESSOR_H
13 # include <BALL/CONCEPT/processor.h>
14 #endif
15
16 #ifndef BALL_MOLMEC_AMBER_GAFFCESPARSER_H
17 # include <BALL/MOLMEC/AMBER/GAFFCESParser.h>
18 #endif
19
20 #ifndef BALL_DATATYPE_OPTIONS_H
21 # include <BALL/DATATYPE/options.h>
22 #endif
23
24 #ifndef BALL_COMMON_EXCEPTION_H
25 # include <BALL/COMMON/exception.h>
26 #endif
27
28 #ifndef BALL_KERNEL_MOLECULE_H
29 # include <BALL/KERNEL/molecule.h>
30 #endif
31
32 #include <vector>
33 #include <map>
34
35 namespace BALL
36 {
37 class BALL_EXPORT GAFFTypeProcessor : public UnaryProcessor<Composite>
38 {
39 public:
40 /// Nested class definitions
41 struct TypeDefinition
42 {
43 String atom_type;
44 int atomic_number;
45 int connectivity;
46 String attached_hydrogens;
47 String electron_withdrawal_atoms;
48 String atomic_property;
49 String chemical_environment;
50 };
51
52 struct BALL_EXPORT Option
53 {
54 /// path to the file containing the atom type definitions
55 static const String ATOMTYPE_FILENAME;
56
57 /// switch cleanup of GAFF types (cc=>cd, ...) on or off
58 static const String GAFF_ATOMTYPE_POSTPROCESSING;
59 };
60
61 struct BALL_EXPORT Default
62 {
63 /// path to the file containing the atom type definitions
64 static const String ATOMTYPE_FILENAME;
65
66 /// switch cleanup of GAFF types (cc=>cd, ...) on or off
67 static const bool GAFF_ATOMTYPE_POSTPROCESSING;
68 };
69
70 enum BALL_EXPORT BOND_TYPES
71 {
72 sb,
73 SB,
74 db,
75 DB,
76 TB,
77 DL,
78 AB
79 };
80
81 GAFFTypeProcessor();
82 GAFFTypeProcessor(const Options& new_options);
83 virtual ~GAFFTypeProcessor();
84 virtual Processor::Result operator() (Composite &composite);
85
86 std::set<String> getTypeNames() const;
87
88 Options options;
89
90 protected:
91 // helper functions used in identifying the correct atom type
92 std::vector<TypeDefinition> getCarbonTypes_() { return atom_types_[6]; }
93 std::vector<TypeDefinition> getHydrogenTypes_() { return atom_types_[1]; }
94 std::vector<TypeDefinition> getNitrogenTypes_() { return atom_types_[7]; }
95 std::vector<TypeDefinition> getOxygenTypes_() { return atom_types_[8]; }
96 std::vector<TypeDefinition> getSulfurTypes_() { return atom_types_[16]; }
97
98 /** Read file with table of atomtypes and push atomtypes
99 * and their TypeDefinition in corresponding vector
100 * and store a GAFFCESParser for every CESstring.
101 * The path to the atom type file is taken from the value
102 * of the option ATOMTYPE_FILENAME.
103 * @throws BALL::Exception::FileNotFound
104 */
105 void parseAtomtypeTableFile_();
106
107 /// compute aromaticity, ring memberships, GAFF bond typization, ...
108 void precomputeBondProperties_(Molecule* molecule);
109
110 /** Store connectivity, number of attached H-atoms and
111 * number of attached N,O,F,Cl and Br-atoms for every atom in molecule
112 */
113 void precomputeAtomProperties_(Molecule* molecule);
114
115 /// Helper for precomputeBondProperties
116 void annotateBondTypes_();
117
118 /// Helper for precomputeAtomProperties
119 void annotateRingSizes_();
120 void annotateAliphaticAndAromaticRingAtoms_();
121 void annotatePlanarRingAtoms_();
122 bool planarAtom_(const Atom& atom);
123
124 /** Check the atom against each possible atom type and try to assign one.
125 */
126 bool assignAtomtype_(Atom& atom);
127
128 /** Postprocessing and cleanup for GAFF types
129 */
130 void postProcessAtomTypes_(Molecule* molecule);
131
132 //for every CESstring in atomtable store the "predicate tree"
133 //built by GAFFCESParser
134 StringHashMap<GAFFCESParser*> ces_parsers_;
135
136 // stores the vectors of atom types indexed by atomic number for fast retrieval
137 std::map<Position, std::vector<TypeDefinition> > atom_types_;
138
139 // smallest set of smallest rings used for atomic environment strings
140 std::vector<std::vector<Atom*> > sssr_;
141
142 ///
143 Molecule* current_molecule_;
144 };
145 }
146
147 #endif