RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MMFF/DistanceConstraint.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_MMFFDISTANCECONSTRAINT_H__
14#define __RD_MMFFDISTANCECONSTRAINT_H__
15#include <iostream>
16#include <ForceField/Contrib.h>
17
18namespace ForceFields {
19namespace MMFF {
20
21//! A distance range constraint modelled after a BondStretchContrib
23 : public ForceFieldContrib {
24 public:
26 //! Constructor
27 /*!
28 \param owner pointer to the owning ForceField
29 \param idx1 index of end1 in the ForceField's positions
30 \param idx2 index of end2 in the ForceField's positions
31 \param minLen minimum distance
32 \param maxLen maximum distance
33 \param forceConst force Constant
34
35 */
36 DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
37 unsigned int idx2, double minLen, double maxLen,
38 double forceConst);
39 DistanceConstraintContrib(ForceField *owner, unsigned int idx1,
40 unsigned int idx2, bool relative, double minLen,
41 double maxLen, double forceConst);
42
44 // std::cerr << " ==== Destroy constraint " << d_end1Idx << " " << d_end2Idx
45 // << std::endl;
46 }
47 double getEnergy(double *pos) const override;
48
49 void getGrad(double *pos, double *grad) const override;
50 DistanceConstraintContrib *copy() const override {
51 return new DistanceConstraintContrib(*this);
52 }
53
54 private:
55 int d_end1Idx{-1}, d_end2Idx{-1}; //!< indices of end points
56 double d_minLen, d_maxLen; //!< rest length of the bond
57 double d_forceConstant; //!< force constant of the bond
58};
59} // namespace MMFF
60} // namespace ForceFields
61#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 distance range constraint modelled after a BondStretchContrib.
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, double minLen, double maxLen, double forceConst)
Constructor.
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
DistanceConstraintContrib * copy() const override
return a copy
DistanceConstraintContrib(ForceField *owner, unsigned int idx1, unsigned int idx2, bool relative, double minLen, double maxLen, double forceConst)
#define RDKIT_FORCEFIELD_EXPORT
Definition export.h:185