RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
DistanceConstraint.h
Go to the documentation of this file.
1//
2// Copyright (C) 2013-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_DISTANCECONSTRAINT_H
12#define RD_DISTANCECONSTRAINT_H
13#include "Contrib.h"
14
15namespace ForceFields {
16
17//! A distance range constraint modelled after a BondStretchContrib
19 : public ForceFieldContrib {
20 public:
22 //! Constructor
23 /*!
24 \param owner pointer to the owning ForceField
25 \param idx1 index of end1 in the ForceField's positions
26 \param idx2 index of end2 in the ForceField's positions
27 \param minLen minimum distance
28 \param maxLen maximum distance
29 \param forceConst force Constant
30
31 */
32 DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
33 unsigned int idx2, double minLen, double maxLen,
34 double forceConst);
35 DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
36 unsigned int idx2, bool relative, double minLen,
37 double maxLen, double forceConst);
38
40 double getEnergy(double *pos) const override;
41
42 void getGrad(double *pos, double *grad) const override;
43 DistanceConstraintContrib *copy() const override {
44 return new DistanceConstraintContrib(*this);
45 }
46
47 private:
48 int d_end1Idx{-1}; //!< indices of end points
49 int d_end2Idx{-1}; //!< indices of end points
50 double d_minLen, d_maxLen; //!< rest length of the bond
51 double d_forceConstant; //!< force constant of the bond
52};
53} // namespace ForceFields
54#endif
A distance range constraint modelled after a BondStretchContrib.
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, bool relative, double minLen, double maxLen, double forceConst)
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, double minLen, double maxLen, double forceConst)
Constructor.
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
DistanceConstraintContrib * copy() const override
return a copy
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