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 
47  //! the electrostatic term for MMFF
48  class EleContrib : public ForceFieldContrib {
49  public:
50  EleContrib() : d_at1Idx(-1), d_at2Idx(-1) {};
51 
52  //! Constructor
53  /*!
54  \param owner pointer to the owning ForceField
55  \param idx1 index of end1 in the ForceField's positions
56  \param idx2 index of end2 in the ForceField's positions
57 
58  */
59  EleContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
60  double chargeTerm, boost::uint8_t dielModel, bool is1_4);
61  double getEnergy(double *pos) const;
62  void getGrad(double *pos, double *grad) const;
63 
64  virtual EleContrib *copy() const { return new EleContrib(*this); };
65  private:
66  int d_at1Idx, d_at2Idx;
67  double d_chargeTerm; //!< q1 * q2 / D
68  boost::uint8_t d_dielModel; //!< dielectric model (1: constant; 2: distance-dependent)
69  bool d_is1_4; //!< flag set for atoms in a 1,4 relationship
70 
71  };
72 
73  namespace Utils {
74  //! calculates and returns the unscaled minimum distance (R*ij) for a MMFF VdW contact
76  const MMFFVdW *mmffVdWParamsAtom1, const MMFFVdW *mmffVdWParamsAtom2);
77  //! calculates and returns the unscaled well depth (epsilon) for a MMFF VdW contact
78  double calcUnscaledVdWWellDepth(double R_star_ij,
79  const MMFFVdW *mmffVdWParamsIAtom, const MMFFVdW *mmffVdWParamsJAtom);
80  //! scales the VdW parameters
81  void scaleVdWParams(double &R_star_ij, double &wellDepth,
82  MMFFVdWCollection *mmffVdW, const MMFFVdW *mmffVdWParamsIAtom,
83  const MMFFVdW *mmffVdWParamsJAtom);
84  //! calculates and returns the Van der Waals MMFF energy
85  double calcVdWEnergy(const double dist,
86  const double R_star_ij, const double wellDepth);
87  //! calculates and returns the electrostatic MMFF energy
88  double calcEleEnergy(unsigned int idx1, unsigned int idx2, double dist,
89  double chargeTerm, boost::uint8_t dielModel, bool is1_4);
90  }
91  }
92 }
93 #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 contact
class to store MMFF parameters for non-bonded Van der Waals
Definition: MMFF/Params.h:139
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 contact ...
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:56