RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
StretchBend.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_MMFFSTRETCHBEND_H__
11#define __RD_MMFFSTRETCHBEND_H__
12
13#include <utility>
14#include <vector>
15
16#include <ForceField/Contrib.h>
17
18namespace ForceFields {
19namespace MMFF {
20class MMFFBond;
21class MMFFAngle;
22class MMFFStbn;
23class MMFFProp;
24
25//! The angle-bend term for MMFF
27 public:
29 //! Constructor
31 /*!
32 Adds a stretch-bend term to the force field contrib.
33
34 The angle is between atom1 - atom2 - atom3
35
36 \param idx1 index of atom1 in the ForceField's positions
37 \param idx2 index of atom2 in the ForceField's positions
38 \param idx3 index of atom3 in the ForceField's positions
39 \param angleType MMFF type of the angle (as an unsigned int)
40 */
41 void addTerm(const unsigned int idx1, const unsigned int idx2,
42 const unsigned int idx3, const MMFFStbn *mmffStbnParams,
43 const MMFFAngle *mmffAngleParams,
44 const MMFFBond *mmffBondParams1,
45 const MMFFBond *mmffBondParams2);
46 double getEnergy(double *pos) const override;
47 void getGrad(double *pos, double *grad) const override;
48 StretchBendContrib *copy() const override {
49 return new StretchBendContrib(*this);
50 }
51
52 private:
53 std::vector<int16_t> d_at1Idxs;
54 std::vector<int16_t> d_at2Idxs;
55 std::vector<int16_t> d_at3Idxs;
56 std::vector<double> d_restLen1s;
57 std::vector<double> d_restLen2s;
58 std::vector<double> d_theta0s;
59 std::vector<double> d_forceConstants1;
60 std::vector<double> d_forceConstants2;
61};
62namespace Utils {
63//! returns the std::pair of stretch-bend force constants for an angle
64RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStbnForceConstants(
65 const MMFFStbn *mmffStbnParams);
66//! calculates and returns the stretch-bending MMFF energy
67RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStretchBendEnergy(
68 const double deltaDist1, const double deltaDist2, const double deltaTheta,
69 const std::pair<double, double> forceConstants);
70} // namespace Utils
71} // namespace MMFF
72} // namespace ForceFields
73#endif
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
class to store MMFF parameters for angle bending
class to store MMFF parameters for bond stretching
Definition MMFF/Params.h:81
class to store MMFF parameters for stretch-bending
The angle-bend term for MMFF.
Definition StretchBend.h:26
void addTerm(const unsigned int idx1, const unsigned int idx2, const unsigned int idx3, const MMFFStbn *mmffStbnParams, const MMFFAngle *mmffAngleParams, const MMFFBond *mmffBondParams1, const MMFFBond *mmffBondParams2)
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
StretchBendContrib(ForceField *owner)
Constructor.
StretchBendContrib * copy() const override
return a copy
Definition StretchBend.h:48
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185