RDKit
Open-source cheminformatics and machine learning.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MMFF/BondStretch.h
Go to the documentation of this file.
1// Copyright (C) 2013-2025 Paolo Tosco and other RDKit contributors
2//
3// @@ All Rights Reserved @@
4// This file is part of the RDKit.
5// The contents are covered by the terms of the BSD license
6// which is included in the file license.txt, found at the root
7// of the RDKit source tree.
8//
9#include <RDGeneral/export.h>
10#ifndef __RD_MMFFBONDSTRETCH_H__
11#define __RD_MMFFBONDSTRETCH_H__
12#include <ForceField/Contrib.h>
13
14#include <vector>
15
16namespace ForceFields {
17namespace MMFF {
18class MMFFBond;
19class MMFFBondStretchEmpiricalRule;
20
21//! The bond-stretch term for MMFF
23 public:
25 //! Constructor
27 /*! Adds a bond stretch to the contrib
28 \param idx1 index of end1 in the ForceField's positions
29 \param idx2 index of end2 in the ForceField's positions
30 \param bondType MMFF94 type of the bond (as an unsigned int)
31 \param end1Params pointer to the parameters for end1
32 \param end2Params pointer to the parameters for end2
33
34 */
35 void addTerm(const unsigned int idx1,
36 const unsigned int idx2,
37 const MMFFBond *mmffBondParams);
38
39 double getEnergy(double *pos) const override;
40
41 void getGrad(double *pos, double *grad) const override;
42
43 BondStretchContrib *copy() const override {
44 return new BondStretchContrib(*this);
45 }
46
47 private:
48 std::vector<int> d_at1Idxs, d_at2Idxs; //!< indices of end points
49 std::vector<double> d_r0; //!< rest length of the bond
50 std::vector<double> d_kb; //!< force constant of the bond
51};
52
53namespace Utils {
54//! returns the MMFF rest length for a bond
55RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(
56 const MMFFBond *mmffBondParams);
57//! returns the MMFF force constant for a bond
58RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(
59 const MMFFBond *mmffBondParams);
60//! calculates and returns the bond stretching MMFF energy
61RDKIT_FORCEFIELD_EXPORT double calcBondStretchEnergy(const double r0,
62 const double kb,
63 const double distance);
64} // namespace Utils
65} // namespace MMFF
66} // namespace ForceFields
67#endif
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
The bond-stretch term for MMFF.
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
BondStretchContrib * copy() const override
return a copy
void addTerm(const unsigned int idx1, const unsigned int idx2, const MMFFBond *mmffBondParams)
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
BondStretchContrib(ForceField *owner)
Constructor.
class to store MMFF parameters for bond stretching
Definition MMFF/Params.h:81
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185