RDKit: TorsionConstraint.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
TorsionConstraint.h
Go to the documentation of this file.
1//
2// Copyright (C) 2013 Paolo Tosco
3//
4// Copyright (C) 2004-2006 Rational Discovery LLC
5//
6// @@ All Rights Reserved @@
7// This file is part of the RDKit.
8// The contents are covered by the terms of the BSD license
9// which is included in the file license.txt, found at the root
10// of the RDKit source tree.
11//
12#include <RDGeneral/export.h>
13#ifndef RD_TORSIONCONSTRAINT_H
14#define RD_TORSIONCONSTRAINT_H
15#include "Contrib.h"
16
17namespace ForceFields {
18
19//! A dihedral angle range constraint modelled after a TorsionContrib
20 class RDKIT_FORCEFIELD_EXPORT TorsionConstraintContrib
21 : public ForceFieldContrib {
22 public:
23 TorsionConstraintContrib() {}
24 //! Constructor
25 /*!
26 \param owner pointer to the owning ForceField
27 \param idx1 index of atom1 in the ForceField's positions
28 \param idx2 index of atom2 in the ForceField's positions
29 \param idx3 index of atom3 in the ForceField's positions
30 \param idx4 index of atom4 in the ForceField's positions
31 \param minDihedralDeg minimum dihedral angle
32 \param maxDihedralDeg maximum dihedral angle
33 \param forceConst force Constant
34
35 */
36 TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
37 unsigned int idx2, unsigned int idx3,
38 unsigned int idx4, double minDihedralDeg,
39 double maxDihedralDeg, double forceConst);
40 TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
41 unsigned int idx2, unsigned int idx3,
42 unsigned int idx4, bool relative,
43 double minDihedralDeg, double maxDihedralDeg,
44 double forceConst);
45
46 ~TorsionConstraintContrib() override = default;
47 double getEnergy(double *pos) const override;
48
49 void getGrad(double *pos, double *grad) const override;
50 TorsionConstraintContrib *copy() const override {
51 return new TorsionConstraintContrib(*this);
52 }
53
54 private:
55 void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2,
56 unsigned int idx3, unsigned int idx4,
57 double minDihedralDeg, double maxDihedralDeg,
58 double forceConst);
59 double computeDihedralTerm(double dihedral) const;
60 int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1},
61 d_at4Idx{-1}; //!< indices of atoms forming the dihedral angle
62 double d_minDihedralDeg,
63 d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle
64 double d_forceConstant; //!< force constant of the angle constraint
65};
66} // namespace ForceFields
67#endif
Contrib.h
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition Contrib.h:22
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition ForceField.h:79
ForceFields::TorsionConstraintContrib::~TorsionConstraintContrib
~TorsionConstraintContrib() override=default
ForceFields::TorsionConstraintContrib::TorsionConstraintContrib
TorsionConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, double minDihedralDeg, double maxDihedralDeg, double forceConst)
Constructor.
ForceFields::TorsionConstraintContrib::TorsionConstraintContrib
TorsionConstraintContrib()
Definition TorsionConstraint.h:23
ForceFields::TorsionConstraintContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::TorsionConstraintContrib::TorsionConstraintContrib
TorsionConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, bool relative, double minDihedralDeg, double maxDihedralDeg, double forceConst)
ForceFields::TorsionConstraintContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
ForceFields::TorsionConstraintContrib::copy
TorsionConstraintContrib * copy() const override
return a copy
Definition TorsionConstraint.h:50
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:201
ForceFields
Definition TorsionAngleContribs.h:21