RDKit: AngleConstraint.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
AngleConstraint.h
Go to the documentation of this file.
1//
2// Copyright (C) 2004-2024 Paolo Tosco and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#include <RDGeneral/export.h>
11#ifndef RD_ANGLECONSTRAINT_H
12#define RD_ANGLECONSTRAINT_H
13#include "Contrib.h"
14
15namespace ForceFields {
16
17//! An angle range constraint modelled after a AngleBendContrib
18 class RDKIT_FORCEFIELD_EXPORT AngleConstraintContrib
19 : public ForceFieldContrib {
20 public:
21 AngleConstraintContrib() {}
22 //! Constructor
23 /*!
24 \param owner pointer to the owning ForceField
25 \param idx1 index of atom1 in the ForceField's positions
26 \param idx2 index of atom2 in the ForceField's positions
27 \param idx3 index of atom3 in the ForceField's positions
28 \param minAngle minimum angle, must be between 0.0 and 180.0
29 \param maxAngle maximum angle, must be between 0.0 and 180.0
30 \param forceConst force Constant
31
32 */
33 AngleConstraintContrib(ForceField *owner, unsigned int idx1,
34 unsigned int idx2, unsigned int idx3,
35 double minAngleDeg, double maxAngleDeg,
36 double forceConst);
37 AngleConstraintContrib(ForceField *owner, unsigned int idx1,
38 unsigned int idx2, unsigned int idx3, bool relative,
39 double minAngleDeg, double maxAngleDeg,
40 double forceConst);
41
42 ~AngleConstraintContrib() override = default;
43 double getEnergy(double *pos) const override;
44
45 void getGrad(double *pos, double *grad) const override;
46
47 AngleConstraintContrib *copy() const override {
48 return new AngleConstraintContrib(*this);
49 }
50
51 private:
52 double computeAngleTerm(double angle) const;
53 int d_at1Idx{-1}, d_at2Idx{-1},
54 d_at3Idx{-1}; //!< indices of atoms forming the angle
55 double d_minAngleDeg, d_maxAngleDeg; //!< rest amplitudes of the angle
56 double d_forceConstant; //!< force constant of the angle constraint
57};
58} // namespace ForceFields
59#endif
Contrib.h
ForceFields::AngleConstraintContrib::AngleConstraintContrib
AngleConstraintContrib()
Definition AngleConstraint.h:21
ForceFields::AngleConstraintContrib::AngleConstraintContrib
AngleConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, double minAngleDeg, double maxAngleDeg, double forceConst)
Constructor.
ForceFields::AngleConstraintContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
ForceFields::AngleConstraintContrib::~AngleConstraintContrib
~AngleConstraintContrib() override=default
ForceFields::AngleConstraintContrib::AngleConstraintContrib
AngleConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, bool relative, double minAngleDeg, double maxAngleDeg, double forceConst)
ForceFields::AngleConstraintContrib::copy
AngleConstraintContrib * copy() const override
return a copy
Definition AngleConstraint.h:47
ForceFields::AngleConstraintContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition Contrib.h:22
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:201
ForceFields
Definition TorsionAngleContribs.h:21