RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
DistViolationContrib.h
Go to the documentation of this file.
1//
2// Copyright (C) 2004-2006 Rational Discovery LLC
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_DISTVIOLATIONCONTRIB_H__
12#define __RD_DISTVIOLATIONCONTRIB_H__
13
14#include <ForceField/Contrib.h>
15
16namespace DistGeom {
17//! A term to capture the violation of the upper and lower bounds by
18//! distance between two points
21 public:
23
24 //! Constructor
25 /*!
26 \param owner pointer to the owning ForceField
27 \param idx1 index of end1 in the ForceField's positions
28 \param idx2 index of end2 in the ForceField's positions
29 \param ub Upper bound on the distance
30 \param lb Lower bound on the distance
31 \param weight optional weight for this contribution
32 */
34 unsigned int idx2, double ub, double lb,
35 double weight = 1.0);
36
37 double getEnergy(double *pos) const override;
38
39 void getGrad(double *pos, double *grad) const override;
40 DistViolationContrib *copy() const override {
41 return new DistViolationContrib(*this);
42 }
43
44 private:
45 unsigned int d_end1Idx{0}, d_end2Idx{0}; //!< indices of end points
46 double d_ub{
47 1000.0}; //!< upper bound on the distance between d_end1Idx, d_end2Idx
48 double d_lb{
49 0.0}; //!< lower bound on the distance between d_end1Idx, d_end2Idx
50 double d_weight{1.0}; //!< used to adjust relative contribution weights
51};
52} // namespace DistGeom
53
54#endif
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
DistViolationContrib * copy() const override
return a copy
DistViolationContrib(ForceFields::ForceField *owner, unsigned int idx1, unsigned int idx2, double ub, double lb, double weight=1.0)
Constructor.
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
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_DISTGEOMETRY_EXPORT
Definition export.h:129