RDKit: PositionConstraint.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
PositionConstraint.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_POSITIONCONSTRAINT_H
12#define RD_POSITIONCONSTRAINT_H
13#include "Contrib.h"
14#include <Geometry/point.h>
15
16namespace ForceFields {
17
18//! A position constraint of the type 0.5k * deltaX^2
19 class RDKIT_FORCEFIELD_EXPORT PositionConstraintContrib
20 : public ForceFieldContrib {
21 public:
22 PositionConstraintContrib() {}
23 //! Constructor
24 /*!
25 \param owner pointer to the owning ForceField
26 \param idx index of the atom in the ForceField's positions
27 \param minDispl minimum displacement
28 \param maxDispl maximum displacement
29 \param forceConst force constant
30
31 */
32 PositionConstraintContrib(ForceField *owner, unsigned int idx,
33 double maxDispl, double forceConst);
34
35 ~PositionConstraintContrib() override = default;
36 double getEnergy(double *pos) const override;
37
38 void getGrad(double *pos, double *grad) const override;
39 PositionConstraintContrib *copy() const override {
40 return new PositionConstraintContrib(*this);
41 }
42
43 private:
44 int d_atIdx{-1}; //!< index of the restrained atom
45 double d_maxDispl; //!< maximum allowed displacement
46 RDGeom::Point3D d_pos0; //!< reference position
47 double d_forceConstant; //!< force constant of the bond
48};
49} // namespace ForceFields
50#endif
Contrib.h
ForceFields::ForceFieldContrib::ForceField
friend class ForceField
Definition Contrib.h:20
ForceFields::ForceFieldContrib::ForceFieldContrib
ForceFieldContrib()
Definition Contrib.h:22
ForceFields::PositionConstraintContrib::PositionConstraintContrib
PositionConstraintContrib()
Definition PositionConstraint.h:22
ForceFields::PositionConstraintContrib::~PositionConstraintContrib
~PositionConstraintContrib() override=default
ForceFields::PositionConstraintContrib::PositionConstraintContrib
PositionConstraintContrib(ForceField *owner, unsigned int idx, double maxDispl, double forceConst)
Constructor.
ForceFields::PositionConstraintContrib::copy
PositionConstraintContrib * copy() const override
return a copy
Definition PositionConstraint.h:39
ForceFields::PositionConstraintContrib::getGrad
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
ForceFields::PositionConstraintContrib::getEnergy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
RDGeom::Point3D
Definition point.h:53
export.h
RDKIT_FORCEFIELD_EXPORT
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:201
ForceFields
Definition TorsionAngleContribs.h:21
point.h