RDKit: DistanceConstraint.h Source File

| 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
18 class RDKIT_FORCEFIELD_EXPORT DistanceConstraintContrib
19 : public ForceFieldContrib {
20 public:
21 DistanceConstraintContrib() {}
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
39 ~DistanceConstraintContrib() override {}
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
Contrib.h
ForceFields::DistanceConstraintContrib::DistanceConstraintContrib
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, bool relative, double minLen, double maxLen, double forceConst)
ForceFields::DistanceConstraintContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::DistanceConstraintContrib::DistanceConstraintContrib
DistanceConstraintContrib()
Definition DistanceConstraint.h:21
ForceFields::DistanceConstraintContrib::DistanceConstraintContrib
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, double minLen, double maxLen, double forceConst)
Constructor.
ForceFields::DistanceConstraintContrib::~DistanceConstraintContrib
~DistanceConstraintContrib() override
Definition DistanceConstraint.h:39
ForceFields::DistanceConstraintContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
ForceFields::DistanceConstraintContrib::copy
DistanceConstraintContrib * copy() const override
return a copy
Definition DistanceConstraint.h:43
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