RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
UFF/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_UFFTORSIONCONSTRAINT_H__
14#define __RD_UFFTORSIONCONSTRAINT_H__
15#include <iostream>
16#include <ForceField/Contrib.h>
17
18namespace ForceFields {
19namespace UFF {
20
21//! A dihedral angle range constraint modelled after a TorsionContrib
23 : public ForceFieldContrib {
24 public:
26 //! Constructor
27 /*!
28 \param owner pointer to the owning ForceField
29 \param idx1 index of atom1 in the ForceField's positions
30 \param idx2 index of atom2 in the ForceField's positions
31 \param idx3 index of atom3 in the ForceField's positions
32 \param idx4 index of atom4 in the ForceField's positions
33 \param minDihedralDeg minimum dihedral angle
34 \param maxDihedralDeg maximum dihedral angle
35 \param forceConst force Constant
36
37 */
38 TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
39 unsigned int idx2, unsigned int idx3,
40 unsigned int idx4, double minDihedralDeg,
41 double maxDihedralDeg, double forceConst);
42 TorsionConstraintContrib(ForceField *owner, unsigned int idx1,
43 unsigned int idx2, unsigned int idx3,
44 unsigned int idx4, bool relative,
45 double minDihedralDeg, double maxDihedralDeg,
46 double forceConst);
47
48 ~TorsionConstraintContrib() override = default;
49 double getEnergy(double *pos) const override;
50
51 void getGrad(double *pos, double *grad) const override;
52 TorsionConstraintContrib *copy() const override {
53 return new TorsionConstraintContrib(*this);
54 }
55
56 private:
57 void setParameters(ForceField *owner, unsigned int idx1, unsigned int idx2,
58 unsigned int idx3, unsigned int idx4,
59 double minDihedralDeg, double maxDihedralDeg,
60 double forceConst);
61 double computeDihedralTerm(double dihedral) const;
62 int d_at1Idx{-1}, d_at2Idx{-1}, d_at3Idx{-1},
63 d_at4Idx{-1}; //!< indices of atoms forming the dihedral angle
64 double d_minDihedralDeg,
65 d_maxDihedralDeg; //!< rest amplitudes of the dihedral angle
66 double d_forceConstant; //!< force constant of the angle constraint
67};
68} // namespace UFF
69} // namespace ForceFields
70#endif
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
A dihedral angle range constraint modelled after a TorsionContrib.
TorsionConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, double minDihedralDeg, double maxDihedralDeg, double forceConst)
Constructor.
TorsionConstraintContrib * copy() const override
return a copy
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
TorsionConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, unsigned int idx3, unsigned int idx4, bool relative, double minDihedralDeg, double maxDihedralDeg, double forceConst)
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185