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