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