1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
// Copyright (C) 2013-2025 Paolo Tosco and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDGeneral/export.h>
#ifndef __RD_MMFFSTRETCHBEND_H__
#define __RD_MMFFSTRETCHBEND_H__
#include <utility>
#include <vector>
#include <ForceField/Contrib.h>
namespace ForceFields {
namespace MMFF {
class MMFFBond;
class MMFFAngle;
class MMFFStbn;
class MMFFProp;
//! The angle-bend term for MMFF
class RDKIT_FORCEFIELD_EXPORT StretchBendContrib : public ForceFieldContrib {
public:
StretchBendContrib() {}
//! Constructor
StretchBendContrib(ForceField *owner);
/*!
Adds a stretch-bend term to the force field contrib.
The angle is between atom1 - atom2 - atom3
\param idx1 index of atom1 in the ForceField's positions
\param idx2 index of atom2 in the ForceField's positions
\param idx3 index of atom3 in the ForceField's positions
\param angleType MMFF type of the angle (as an unsigned int)
*/
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;
void getGrad(double *pos, double *grad) const override;
StretchBendContrib *copy() const override {
return new StretchBendContrib(*this);
}
private:
std::vector<int16_t> d_at1Idxs;
std::vector<int16_t> d_at2Idxs;
std::vector<int16_t> d_at3Idxs;
std::vector<double> d_restLen1s;
std::vector<double> d_restLen2s;
std::vector<double> d_theta0s;
std::vector<double> d_forceConstants1;
std::vector<double> d_forceConstants2;
};
namespace Utils {
//! returns the std::pair of stretch-bend force constants for an angle
RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStbnForceConstants(
const MMFFStbn *mmffStbnParams);
//! calculates and returns the stretch-bending MMFF energy
RDKIT_FORCEFIELD_EXPORT std::pair<double, double> calcStretchBendEnergy(
const double deltaDist1, const double deltaDist2, const double deltaTheta,
const std::pair<double, double> forceConstants);
} // namespace Utils
} // namespace MMFF
} // namespace ForceFields
#endif
|