RDKit: StretchBend.h Source File

| 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
27 class RDKIT_FORCEFIELD_EXPORT StretchBendContrib : public ForceFieldContrib {
28 public:
29 StretchBendContrib() {}
30 //! Constructor
31 StretchBendContrib(ForceField *owner);
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
65 RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStbnForceConstants(
66 const MMFFStbn *mmffStbnParams);
67//! calculates and returns the stretch-bending MMFF energy
68 RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStretchBendEnergy(
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
Contrib.h
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition Contrib.h:22
ForceFields::MMFF::MMFFAngle
class to store MMFF parameters for angle bending
Definition MMFF/Params.h:104
ForceFields::MMFF::MMFFBond
class to store MMFF parameters for bond stretching
Definition MMFF/Params.h:80
ForceFields::MMFF::MMFFProp
class to store MMFF Properties
Definition MMFF/Params.h:53
ForceFields::MMFF::MMFFStbn
class to store MMFF parameters for stretch-bending
Definition MMFF/Params.h:111
ForceFields::MMFF::StretchBendContrib::addTerm
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)
ForceFields::MMFF::StretchBendContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
ForceFields::MMFF::StretchBendContrib::StretchBendContrib
StretchBendContrib()
Definition StretchBend.h:29
ForceFields::MMFF::StretchBendContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::MMFF::StretchBendContrib::StretchBendContrib
StretchBendContrib(ForceField *owner)
Constructor.
ForceFields::MMFF::StretchBendContrib::copy
StretchBendContrib * copy() const override
return a copy
Definition StretchBend.h:49
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:201
ForceFields::MMFF::Utils::calcStretchBendEnergy
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
ForceFields::MMFF::Utils::calcStbnForceConstants
RDKIT_FORCEFIELD_EXPORT std::pair< double, double > calcStbnForceConstants(const MMFFStbn *mmffStbnParams)
returns the std::pair of stretch-bend force constants for an angle
ForceFields::MMFF
Definition MMFF/AngleBend.h:17
ForceFields
Definition TorsionAngleContribs.h:21