Debian Codegraph @

include/BALL/MOLMEC/MMFF94/MMFF94Parameters.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: MMFF94Parameters.h,v 1.1.8.1 2007/03/25 21:25:17 oliver Exp $
5 //
6
7 // Molecular Mechanics: MMFF94 force field class
8
9 #ifndef BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H
10 #define BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H
11
12 #ifndef BALL_COMMON_H
13 # include <BALL/common.h>
14 #endif
15
16 #ifndef BALL_DATATYPE_HASHMAP_H
17 # include <BALL/DATATYPE/hashMap.h>
18 #endif
19
20 namespace BALL
21 {
22
23 class Atom;
24 class Parameters;
25
26 Position getMMFF94Index(Position atom_type1, Position atom_type2);
27
28 /// hold the maximum number of MMFF94 atom types + 1 (wildcard)
29 extern Size MMFF94_number_atom_types;
30
31 class MMFF94AtomTypeEquivalences;
32
33 #define MMFF94_INVALID_VALUE 99.0
34
35 /////////////////////////////////////////////////////////////////////////////
36 /** MMFF94 component parameters base class
37 \ingroup MMFF94
38 */
39 class BALL_EXPORT MMFF94ParametersBase
40 {
41 public:
42
43 BALL_CREATE(MMFF94ParametersBase)
44
45 /// Default constructor.
46 MMFF94ParametersBase();
47
48 /// Destructor.
49 virtual ~MMFF94ParametersBase() {};
50
51 /// Assignment operator
52 const MMFF94ParametersBase& operator = (const MMFF94ParametersBase&)
53 {return *this;};
54
55 /// Clear method
56 virtual void clear()
57 ;
58
59 ///
60 bool isInitialized() { return is_initialized_;}
61
62 /// @throws BALL::Exception::FileNotFound
63 bool readParameters(Parameters& p, const String& section);
64
65 ///
66 void setEquivalences(const MMFF94AtomTypeEquivalences& equi) { equiv_ = &equi;}
67
68 protected:
69
70 virtual bool setup_(const std::vector<std::vector<String> >&) { return true;};
71
72 bool is_initialized_;
73
74 // nr of needed fields in parameter files
75 Size number_expected_fields_;
76 const MMFF94AtomTypeEquivalences* equiv_;
77 };
78
79
80 /** MMFF94 equivalences for atom types (see MMFFDEF.PAR)
81 \ingroup MMFF94
82 */
83 class BALL_EXPORT MMFF94AtomTypeEquivalences:
84 public MMFF94ParametersBase
85 {
86 public:
87
88 ///
89 MMFF94AtomTypeEquivalences();
90
91 ///
92 MMFF94AtomTypeEquivalences(const MMFF94AtomTypeEquivalences& to_copy);
93
94 ///
95 ~MMFF94AtomTypeEquivalences();
96
97 ///
98 void clear()
99 ;
100
101 /** Get an equivalence atom type for the given atom type.
102 @param number between 1 and 4, 4 is the most general equivalence
103 @return Index -1 if no equivalence found
104 */
105 Index getEquivalence(Position original, Position number) const;
106
107 protected:
108
109 virtual bool setup_(const std::vector<std::vector<String> >&);
110 std::vector<std::vector<Position> > equivalences_;
111 std::vector<String> names_;
112 std::vector<bool> exists_;
113 };
114
115
116 /// Class to store the values of an atom type from MMFFPROP.PAR
117 struct BALL_EXPORT MMFF94AtomType
118 {
119 ///
120 MMFF94AtomType();
121
122 /// atomic number;
123 Position aspec;
124
125 /// necessary number of bonded neighbours
126 Position crd;
127
128 /// number of bonds made to this atom type
129 Position val;
130
131 /// has pi lone pair electrons
132 bool pilp;
133
134 /** double(2) or triple(3) bonds are expected
135 1 cases with intermediate hypridization
136 */
137 Position mltb;
138
139 /// is aromatic
140 bool arom;
141
142 /// has linear bond
143 bool lin;
144
145 /// can have a delocalized single bond
146 bool sbmb;
147
148 /// Is this a valid MMFF94 atom type?
149 bool valid;
150 };
151
152
153 ///////////////////////////////////////////////////////////////////////////
154 /** MMFF94 parameters for atom types (see MMFFPROP.PAR)
155 \ingroup MMFF94
156 */
157 class BALL_EXPORT MMFF94AtomTypes:
158 public MMFF94ParametersBase
159 {
160 public:
161
162 ///
163 MMFF94AtomTypes();
164
165 ///
166 MMFF94AtomTypes(const MMFF94AtomTypes& to_copy);
167
168 ///
169 ~MMFF94AtomTypes() {};
170
171 ///
172 const std::vector<MMFF94AtomType>& getAtomTypes() const { return data_;}
173
174 protected:
175
176 virtual bool setup_(const std::vector<std::vector<String> >&);
177 std::vector<MMFF94AtomType> data_;
178 };
179
180 ///////////////////////////////////////////////////////////////////////////
181
182 /** MMFF94 parameters for bond stretching (see MMFFBOND.PAR)
183 \ingroup MMFF94
184 */
185 class BALL_EXPORT MMFF94StretchParameters:
186 public MMFF94ParametersBase
187 {
188 public:
189
190 ///
191 struct BondData
192 {
193 BondData();
194
195 double kb_normal;
196 double r0_normal;
197 bool standard_bond_exists;
198
199 /// parameters for optinal single-bond--multiple bond cases (see MMFFPROP.PAR)
200 double kb_sbmb;
201 double r0_sbmb;
202 bool sbmb_exists;
203 bool empirical;
204 };
205
206 ///
207 struct EmpiricalBondData
208 {
209 double kb;
210 double r0;
211 };
212
213 ///
214 typedef HashMap<Position, BondData> StretchMap;
215 typedef HashMap<Position, EmpiricalBondData> EmpiricalStretchMap;
216
217 BALL_CREATE(MMFF94StretchParameters)
218
219 /// Default constructor.
220 MMFF94StretchParameters();
221
222 /// Destructor.
223 virtual ~MMFF94StretchParameters();
224
225 /// Assignment operator
226 const MMFF94StretchParameters& operator = (const MMFF94StretchParameters& param)
227 ;
228
229 /// Clear method
230 virtual void clear()
231 ;
232
233 ///
234 bool assignParameters(Position type1, Position type2, BondData& data) const;
235
236 ///
237 bool readEmpiricalParameters(Parameters& p, const String& section);
238
239 ///
240 const StretchMap& getBondParameters() const { return parameters_;}
241
242 ///
243 const EmpiricalStretchMap& getEmpiricalParameters() const { return empirical_parameters_;}
244
245 static double radii[];
246 static double electronegatives[];
247
248 protected:
249
250 virtual bool setup_(const std::vector<std::vector<String> >&);
251
252 /// standard parameters
253 StretchMap parameters_;
254 mutable StretchMap buffered_parameters_;
255 EmpiricalStretchMap empirical_parameters_;
256 };
257
258 ///////////////////////////////////////////////////////////////////////////
259
260 /** MMFF94 parameters for bond bending (see MMFFANG.PAR)
261 \ingroup MMFF94
262 */
263 class BALL_EXPORT MMFF94BendParameters
264 : public MMFF94ParametersBase
265 {
266 public:
267
268 /// Map with the force constant and reference angle
269 typedef HashMap<Position, std::pair<double, double> > BendMap;
270
271 BALL_CREATE(MMFF94BendParameters)
272
273 /// Default constructor.
274 MMFF94BendParameters();
275
276 /// Destructor.
277 virtual ~MMFF94BendParameters();
278
279 /// Assignment operator
280 const MMFF94BendParameters& operator = (const MMFF94BendParameters& param)
281 ;
282
283 /// Clear method
284 virtual void clear()
285 ;
286
287 ///
288 bool assignParameters(Position bend_type,
289 Position atom_type1, Position atom_type2, Position atom_type3,
290 double& ka, double& angle) const;
291
292 protected:
293
294 virtual bool setup_(const std::vector<std::vector<String> >&);
295
296 Position getIndex_(Position bend_type, Position atom_type1, Position atom_type2, Position atom_type3) const;
297
298 /// parameters
299 BendMap parameters_;
300 mutable BendMap buffered_parameters_;
301 };
302
303
304 ////////////////////////////////////////////////////////////////////
305 ////////////////////////////////////////////////////////////////////
306
307 /** MMFF94 parameters for stretch-bend interactions (see MMFFSTBN.PAR)
308 \ingroup MMFF94
309 */
310 class BALL_EXPORT MMFF94StretchBendParameters
311 : public MMFF94ParametersBase
312 {
313 public:
314
315 /// Map with the force constant and reference angle
316 typedef HashMap<Position, std::pair<double, double> > StretchBendMap;
317
318 BALL_CREATE(MMFF94StretchBendParameters)
319
320 /// Default constructor.
321 MMFF94StretchBendParameters();
322
323 /// Destructor.
324 virtual ~MMFF94StretchBendParameters();
325
326 /// Assignment operator
327 const MMFF94StretchBendParameters& operator = (const MMFF94StretchBendParameters& param)
328 ;
329
330 /// Clear method
331 virtual void clear()
332 ;
333
334 ///
335 bool assignParameters(Position stretch_bend_type, const Atom& atom1, const Atom& atom2, const Atom& atom3,
336 double& kba_ijk, double& kba_kji) const;
337
338 /** read parameters for stretch-bends and for assignment by periodic table row
339 * @throws BALL::Exception::FileNotFound
340 */
341 bool readEmpiricalParameters(Parameters& p, const String& section);
342
343 //@}
344
345 protected:
346
347 virtual bool setup_(const std::vector<std::vector<String> >&);
348
349 Position getIndex_(Position stretch_bend_type,
350 Position atom_type1, Position atom_type2, Position atom_type3) const;
351
352 Position getIndexByRow_(Position r1, Position r2, Position r3) const;
353
354 /// parameters
355 StretchBendMap parameters_;
356 mutable StretchBendMap buffered_parameters_;
357 StretchBendMap parameters_by_row_;
358 };
359
360 ////////////////////////////////////////////////////////////////////
361 ////////////////////////////////////////////////////////////////////
362
363 /** MMFF94 parameters for torsions (see MMFFTOR.PAR)
364 \ingroup MMFF94
365 */
366 class BALL_EXPORT MMFF94TorsionParameters
367 : public MMFF94ParametersBase
368 {
369 public:
370
371 /// Map with the force constant and reference angle
372 typedef HashMap<String, std::vector<double> > TorsionsMap;
373
374 BALL_CREATE(MMFF94TorsionParameters)
375
376 /// Default constructor.
377 MMFF94TorsionParameters();
378
379 /// Destructor.
380 virtual ~MMFF94TorsionParameters();
381
382 /// Assignment operator
383 const MMFF94TorsionParameters& operator = (const MMFF94TorsionParameters& param)
384 ;
385
386 /// Clear method
387 virtual void clear()
388 ;
389
390 ///
391 bool assignParameters(Position type_index,
392 Index at1, Index at2, Index at3, Index at4,
393 double& v1, double& v2, double& v3) const;
394
395 protected:
396
397 virtual bool setup_(const std::vector<std::vector<String> >&);
398
399 String getIndex_(Position type, Position atom_type1, Position atom_type2, Position atom_type3, Position atom_type4) const;
400
401 /// parameters
402 TorsionsMap parameters_;
403 mutable TorsionsMap buffered_parameters_;
404 static Position ic_[5];
405 static Position lc_[5];
406 };
407
408 ////////////////////////////////////////////////////////////////////
409 ////////////////////////////////////////////////////////////////////
410
411 /** MMFF94 parameters for out of plane bending (see MMFFOOR.PAR)
412 \ingroup MMFF94
413 */
414 class BALL_EXPORT MMFF94PlaneParameters
415 : public MMFF94ParametersBase
416 {
417 public:
418
419 /// Map with the force constant
420 typedef HashMap<String, double> PlaneMap;
421
422 BALL_CREATE(MMFF94PlaneParameters)
423
424 /// Default constructor.
425 MMFF94PlaneParameters();
426
427 /// Destructor.
428 virtual ~MMFF94PlaneParameters();
429
430 /// Assignment operator
431 const MMFF94PlaneParameters& operator = (const MMFF94PlaneParameters& param)
432 ;
433
434 /// Clear method
435 virtual void clear()
436 ;
437
438 ///
439 bool assignParameters(Index at1, Index at2, Index at3, Index at4, double& v) const;
440
441 protected:
442
443 virtual bool setup_(const std::vector<std::vector<String> >&);
444
445 String getIndex_(Position atom_type1, Position atom_type2, Position atom_type3, Position atom_type4) const;
446
447 /// parameters
448 PlaneMap parameters_;
449 mutable PlaneMap buffered_parameters_;
450 };
451
452 ////////////////////////////////////////////////////////////////////
453 ////////////////////////////////////////////////////////////////////
454
455 /** MMFF94 parameters for VDW (see MMFFVDW.PAR)
456 \ingroup MMFF94
457 */
458 class BALL_EXPORT MMFF94VDWParameters
459 : public MMFF94ParametersBase
460 {
461 public:
462
463 struct VDWEntry
464 {
465 double alpha_i;
466 double ni;
467 double ai;
468 double gi;
469 short donor_acceptor;
470 bool valid;
471 };
472
473 BALL_CREATE(MMFF94VDWParameters)
474
475 /// Default constructor.
476 MMFF94VDWParameters();
477
478 /// Destructor.
479 virtual ~MMFF94VDWParameters();
480
481 /// Assignment operator
482 const MMFF94VDWParameters& operator = (const MMFF94VDWParameters& param)
483 ;
484
485 /// Clear method
486 virtual void clear()
487 ;
488
489 ///
490 double getR(Position atom_type) const;
491
492 /// Retrieve vdW parameters for a single atom type
493 const VDWEntry& getParameters(Index at) const;
494
495 ///
496 bool assignParameters(Position at1, Position at2, double& rij, double& rij_7_, double& eij) const;
497
498 protected:
499
500 virtual bool setup_(const std::vector<std::vector<String> >&);
501
502 /// parameters
503 std::vector<VDWEntry> parameters_;
504
505 // R star ii for all individual atom types
506 mutable std::vector<double> rs_;
507
508 // R star ij for pairs of atom types
509 mutable std::vector<double> rij_;
510 // R star ij ^ 7 for pairs of atom types
511 mutable std::vector<double> rij_7_;
512 // R star ij and for pairs of atom types
513 mutable std::vector<double> eij_;
514 // bools if indivual value was already calculated
515 mutable std::vector<bool> calculated_;
516 };
517
518
519 ////////////////////////////////////////////////////////////////////
520 ////////////////////////////////////////////////////////////////////
521
522 /** MMFF94 parameters for partial charges for electrostatics (see MMFFCHG.PAR MMFFPBCI.PAR)
523 \ingroup MMFF94
524 */
525 class BALL_EXPORT MMFF94ESParameters
526 : public MMFF94ParametersBase
527 {
528 public:
529
530 BALL_CREATE(MMFF94ESParameters)
531
532 /// Default constructor.
533 MMFF94ESParameters();
534
535 /// Destructor.
536 virtual ~MMFF94ESParameters();
537
538 /// Assignment operator
539 const MMFF94ESParameters& operator = (const MMFF94ESParameters& param)
540 ;
541
542 /// Clear method
543 virtual void clear()
544 ;
545
546 /** Get the partial charge increment for the two atom types and the bond type.
547 The increment is for the atom with atom type at1.
548 99 is return if no increment could be calculated.
549 */
550 double getPartialCharge(Position at1, Position at2, Position bt) const;
551
552 /// @throws BALL::Exception::FileNotFound
553 bool readEmpiricalParameters(Parameters& p, const String& section);
554
555 ///
556 double getPhi(Index atom_type) const;
557
558 ///
559 double getPBCI(Index atom_type) const;
560
561 protected:
562
563 virtual bool setup_(const std::vector<std::vector<String> >&);
564 Position getIndex_(Position at1, Position at2, Position bt) const;
565
566 /// parameters
567 std::vector<double> parameters_, phis_, pbcis_;
568 };
569
570
571 } // namespace BALL
572
573 #endif // BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H