RDKit: BondStretch.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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
22 class RDKIT_FORCEFIELD_EXPORT BondStretchContrib : public ForceFieldContrib {
23 public:
24 BondStretchContrib() {}
25 //! Constructor
26 BondStretchContrib(ForceField *owner);
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
55 RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(
56 const MMFFBond *mmffBondParams);
57//! returns the MMFF force constant for a bond
58 RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(
59 const MMFFBond *mmffBondParams);
60//! calculates and returns the bond stretching MMFF energy
61 RDKIT_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
Contrib.h
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition Contrib.h:22
ForceFields::MMFF::BondStretchContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::MMFF::BondStretchContrib::copy
BondStretchContrib * copy() const override
return a copy
Definition MMFF/BondStretch.h:43
ForceFields::MMFF::BondStretchContrib::addTerm
void addTerm(const unsigned int idx1, const unsigned int idx2, const MMFFBond *mmffBondParams)
ForceFields::MMFF::BondStretchContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
ForceFields::MMFF::BondStretchContrib::BondStretchContrib
BondStretchContrib(ForceField *owner)
Constructor.
ForceFields::MMFF::BondStretchContrib::BondStretchContrib
BondStretchContrib()
Definition MMFF/BondStretch.h:24
ForceFields::MMFF::MMFFBond
class to store MMFF parameters for bond stretching
Definition MMFF/Params.h:80
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:201
ForceFields::MMFF::Utils::calcBondForceConstant
RDKIT_FORCEFIELD_EXPORT double calcBondForceConstant(const MMFFBond *mmffBondParams)
returns the MMFF force constant for a bond
ForceFields::MMFF::Utils::calcBondStretchEnergy
RDKIT_FORCEFIELD_EXPORT double calcBondStretchEnergy(const double r0, const double kb, const double distance)
calculates and returns the bond stretching MMFF energy
ForceFields::MMFF::Utils::calcBondRestLength
RDKIT_FORCEFIELD_EXPORT double calcBondRestLength(const MMFFBond *mmffBondParams)
returns the MMFF rest length for a bond
ForceFields::MMFF
Definition MMFF/AngleBend.h:17
ForceFields
Definition TorsionAngleContribs.h:21