RDKit
Open-source cheminformatics and machine learning.
UFF/BondStretch.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef __RD_BONDSTRETCH_H__
12 #define __RD_BONDSTRETCH_H__
13 #include <ForceField/Contrib.h>
14 
15 namespace ForceFields {
16 namespace UFF {
17 class AtomicParams;
18 
19 //! The bond-stretch term for the Universal Force Field
21  public:
23  //! Constructor
24  /*!
25  \param owner pointer to the owning ForceField
26  \param idx1 index of end1 in the ForceField's positions
27  \param idx2 index of end2 in the ForceField's positions
28  \param bondOrder order of the bond (as a double)
29  \param end1Params pointer to the parameters for end1
30  \param end2Params pointer to the parameters for end2
31 
32  */
33  BondStretchContrib(ForceField *owner, unsigned int idx1, unsigned int idx2,
34  double bondOrder, const AtomicParams *end1Params,
35  const AtomicParams *end2Params);
36 
37  double getEnergy(double *pos) const;
38 
39  void getGrad(double *pos, double *grad) const;
40 
41  virtual BondStretchContrib *copy() const {
42  return new BondStretchContrib(*this);
43  };
44 
45  private:
46  int d_end1Idx{-1}; //!< indices of end points
47  int d_end2Idx{-1}; //!< indices of end points
48  double d_restLen; //!< rest length of the bond
49  double d_forceConstant; //!< force constant of the bond
50 };
51 
52 namespace Utils {
53 //! calculates and returns the UFF rest length for a bond
54 /*!
55 
56  \param bondOrder the order of the bond (as a double)
57  \param end1Params pointer to the parameters for end1
58  \param end2Params pointer to the parameters for end2
59 
60  \return the rest length
61 
62 */
64  double bondOrder, const AtomicParams *end1Params,
65  const AtomicParams *end2Params);
66 
67 //! calculates and returns the UFF force constant for a bond
68 /*!
69 
70  \param restLength the rest length of the bond
71  \param end1Params pointer to the parameters for end1
72  \param end2Params pointer to the parameters for end2
73 
74  \return the force constant
75 
76 */
78  double restLength, const AtomicParams *end1Params,
79  const AtomicParams *end2Params);
80 } // namespace Utils
81 } // namespace UFF
82 } // namespace ForceFields
83 #endif
abstract base class for contributions to ForceFields
Definition: Contrib.h:18
A class to store forcefields and handle minimization.
Definition: ForceField.h:80
class to store atomic parameters for the Universal Force Field
Definition: UFF/Params.h:73
The bond-stretch term for the Universal Force Field.
BondStretchContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, double bondOrder, const AtomicParams *end1Params, const AtomicParams *end2Params)
Constructor.
virtual BondStretchContrib * copy() const
return a copy
void getGrad(double *pos, double *grad) const
calculates our contribution to the gradients of a position
double getEnergy(double *pos) const
returns our contribution to the energy of a position
#define RDKIT_FORCEFIELD_EXPORT
Definition: export.h:294
RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(double restLength, const AtomicParams *end1Params, const AtomicParams *end2Params)
calculates and returns the UFF force constant for a bond
RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(double bondOrder, const AtomicParams *end1Params, const AtomicParams *end2Params)
calculates and returns the UFF rest length for a bond