RDKit
Open-source cheminformatics and machine learning.
MMFF/Nonbonded.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013 Paolo Tosco
3 //
4 // Copyright (C) 2004-2006 Rational Discovery LLC
5 //
6 // @@ All Rights Reserved @@
7 // This file is part of the RDKit.
8 // The contents are covered by the terms of the BSD license
9 // which is included in the file license.txt, found at the root
10 // of the RDKit source tree.
11 //
12 #ifndef __RD_MMFFNONBONDED_H__
13 #define __RD_MMFFNONBONDED_H__
14 #include <ForceField/Contrib.h>
15 #include <GraphMol/RDKitBase.h>
17 
18 namespace ForceFields {
19 namespace MMFF {
20 class MMFFVdWCollection;
21 class MMFFVdW;
22 //! the van der Waals term for MMFF
23 class VdWContrib : public ForceFieldContrib {
24  public:
25  VdWContrib() : d_at1Idx(-1), d_at2Idx(-1){};
26 
27  //! Constructor
28  /*!
29  \param owner pointer to the owning ForceField
30  \param idx1 index of end1 in the ForceField's positions
31  \param idx2 index of end2 in the ForceField's positions
32 
33  */
34  VdWContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
35  const MMFFVdWRijstarEps *mmffVdWConstants);
36  double getEnergy(double *pos) const;
37  void getGrad(double *pos, double *grad) const;
38  virtual VdWContrib *copy() const { return new VdWContrib(*this); };
39 
40  private:
41  int d_at1Idx, d_at2Idx;
42  double d_R_ij_star; //!< the preferred length of the contact
43  double d_wellDepth; //!< the vdW well depth (strength of the interaction)
44 };
45 
46 //! the electrostatic term for MMFF
47 class EleContrib : public ForceFieldContrib {
48  public:
49  EleContrib() : d_at1Idx(-1), d_at2Idx(-1){};
50 
51  //! Constructor
52  /*!
53  \param owner pointer to the owning ForceField
54  \param idx1 index of end1 in the ForceField's positions
55  \param idx2 index of end2 in the ForceField's positions
56 
57  */
58  EleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
59  double chargeTerm, boost::uint8_t dielModel, bool is1_4);
60  double getEnergy(double *pos) const;
61  void getGrad(double *pos, double *grad) const;
62 
63  virtual EleContrib *copy() const { return new EleContrib(*this); };
64 
65  private:
66  int d_at1Idx, d_at2Idx;
67  double d_chargeTerm; //!< q1 * q2 / D
68  boost::uint8_t
69  d_dielModel; //!< dielectric model (1: constant; 2: distance-dependent)
70  bool d_is1_4; //!< flag set for atoms in a 1,4 relationship
71 };
72 
73 namespace Utils {
74 //! calculates and returns the unscaled minimum distance (R*ij) for a MMFF VdW
75 //contact
77  const MMFFVdW *mmffVdWParamsAtom1,
78  const MMFFVdW *mmffVdWParamsAtom2);
79 //! calculates and returns the unscaled well depth (epsilon) for a MMFF VdW
80 //contact
81 double calcUnscaledVdWWellDepth(double R_star_ij,
82  const MMFFVdW *mmffVdWParamsIAtom,
83  const MMFFVdW *mmffVdWParamsJAtom);
84 //! scales the VdW parameters
85 void scaleVdWParams(double &R_star_ij, double &wellDepth,
86  MMFFVdWCollection *mmffVdW,
87  const MMFFVdW *mmffVdWParamsIAtom,
88  const MMFFVdW *mmffVdWParamsJAtom);
89 //! calculates and returns the Van der Waals MMFF energy
90 double calcVdWEnergy(const double dist, const double R_star_ij,
91  const double wellDepth);
92 //! calculates and returns the electrostatic MMFF energy
93 double calcEleEnergy(unsigned int idx1, unsigned int idx2, double dist,
94  double chargeTerm, boost::uint8_t dielModel, bool is1_4);
95 }
96 }
97 }
98 #endif
double getEnergy(double *pos) const
returns our contribution to the energy of a position
the electrostatic term for MMFF
double calcVdWEnergy(const double dist, const double R_star_ij, const double wellDepth)
calculates and returns the Van der Waals MMFF energy
double calcUnscaledVdWWellDepth(double R_star_ij, const MMFFVdW *mmffVdWParamsIAtom, const MMFFVdW *mmffVdWParamsJAtom)
calculates and returns the unscaled well depth (epsilon) for a MMFF VdW
class to store MMFF parameters for non-bonded Van der Waals
Definition: MMFF/Params.h:138
abstract base class for contributions to ForceFields
Definition: Contrib.h:17
virtual VdWContrib * copy() const
return a copy
pulls in the core RDKit functionality
virtual EleContrib * copy() const
return a copy
double calcUnscaledVdWMinimum(MMFFVdWCollection *mmffVdW, const MMFFVdW *mmffVdWParamsAtom1, const MMFFVdW *mmffVdWParamsAtom2)
calculates and returns the unscaled minimum distance (R*ij) for a MMFF VdW
double calcEleEnergy(unsigned int idx1, unsigned int idx2, double dist, double chargeTerm, boost::uint8_t dielModel, bool is1_4)
calculates and returns the electrostatic MMFF energy
void getGrad(double *pos, double *grad) const
calculates our contribution to the gradients of a position
the van der Waals term for MMFF
void scaleVdWParams(double &R_star_ij, double &wellDepth, MMFFVdWCollection *mmffVdW, const MMFFVdW *mmffVdWParamsIAtom, const MMFFVdW *mmffVdWParamsJAtom)
scales the VdW parameters
A class to store forcefields and handle minimization.
Definition: ForceField.h:57