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
19 : public ForceFieldContrib {
20 public:
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
An angle range constraint modelled after a AngleBendContrib.
AngleConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, double minAngleDeg, double maxAngleDeg, double forceConst)
Constructor.
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
~AngleConstraintContrib() override=default
AngleConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, bool relative, double minAngleDeg, double maxAngleDeg, double forceConst)
AngleConstraintContrib * copy() const override
return a copy
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185