RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MMFF/Nonbonded.h
Go to the documentation of this file.
1// Copyright (C) 2013-2025 Paolo Tosco and other RDKit contributors
2//
3// @@ All Rights Reserved @@
4// This file is part of the RDKit.
5// The contents are covered by the terms of the BSD license
6// which is included in the file license.txt, found at the root
7// of the RDKit source tree.
8//
9#include <RDGeneral/export.h>
10#ifndef __RD_MMFFNONBONDED_H__
11#define __RD_MMFFNONBONDED_H__
12#include <ForceField/Contrib.h>
13#include <GraphMol/RDKitBase.h>
15
16namespace ForceFields {
17namespace MMFF {
18class MMFFVdWCollection;
19class MMFFVdW;
20//! the van der Waals term for MMFF
22 public:
25 //! Track a new VdW pair
26 void addTerm(unsigned int idx1, unsigned int idx2, const MMFFVdWRijstarEps *mmffVdWConstants);
27 double getEnergy(double *pos) const override;
28 void getGrad(double *pos, double *grad) const override;
29 VdWContrib *copy() const override { return new VdWContrib(*this); }
30
31 private:
32 std::vector<int16_t> d_at1Idxs;
33 std::vector<int16_t> d_at2Idxs;
34 std::vector<double> d_R_ij_stars; //!< the preferred length of the contact
35 std::vector<double> d_wellDepths; //!< the vdW well depth (strength of the interaction)
36};
37
38//! the electrostatic term for MMFF
40 public:
42
43 //! Constructor
44 /*!
45 \param owner pointer to the owning ForceField
46 \param idx1 index of end1 in the ForceField's positions
47 \param idx2 index of end2 in the ForceField's positions
48
49 */
51 void addTerm(unsigned int idx1, unsigned int idx2,
52 double chargeTerm, std::uint8_t dielModel, bool is1_4);
53 double getEnergy(double *pos) const override;
54 void getGrad(double *pos, double *grad) const override;
55
56 EleContrib *copy() const override { return new EleContrib(*this); }
57
58 private:
59 std::vector<int16_t> d_at1Idxs;
60 std::vector<int16_t> d_at2Idxs;
61 std::vector<double> d_chargeTerms;
62 std::vector<std::uint8_t> d_is_1_4s;
63 std::vector<std::uint8_t>
64 d_dielModels; //!< dielectric model (1: constant; 2: distance-dependent)
65};
66
67namespace Utils {
68//! calculates and returns the unscaled minimum distance (R*ij) for a MMFF VdW
69/// contact
70RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWMinimum(
71 const MMFFVdWCollection *mmffVdW, const MMFFVdW *mmffVdWParamsAtom1,
72 const MMFFVdW *mmffVdWParamsAtom2);
73//! calculates and returns the unscaled well depth (epsilon) for a MMFF VdW
74/// contact
75RDKIT_FORCEFIELD_EXPORT double calcUnscaledVdWWellDepth(
76 double R_star_ij, const MMFFVdW *mmffVdWParamsIAtom,
77 const MMFFVdW *mmffVdWParamsJAtom);
78//! scales the VdW parameters
79RDKIT_FORCEFIELD_EXPORT void scaleVdWParams(double &R_star_ij,
80 double &wellDepth,
81 const MMFFVdWCollection *mmffVdW,
82 const MMFFVdW *mmffVdWParamsIAtom,
83 const MMFFVdW *mmffVdWParamsJAtom);
84//! calculates and returns the Van der Waals MMFF energy
85RDKIT_FORCEFIELD_EXPORT double calcVdWEnergy(const double dist,
86 const double R_star_ij,
87 const double wellDepth);
88//! calculates and returns the electrostatic MMFF energy
89// FIX: idx1 and idx2 are not used
90RDKIT_FORCEFIELD_EXPORT double calcEleEnergy(unsigned int idx1,
91 unsigned int idx2, double dist,
92 double chargeTerm,
93 std::uint8_t dielModel,
94 bool is1_4);
95} // namespace Utils
96} // namespace MMFF
97} // namespace ForceFields
98#endif
pulls in the core RDKit functionality
abstract base class for contributions to ForceFields
Definition Contrib.h:18
A class to store forcefields and handle minimization.
Definition ForceField.h:79
the electrostatic term for MMFF
EleContrib * copy() const override
return a copy
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
void getGrad(double *pos, double *grad) const override
calculates our contribution to the gradients of a position
EleContrib(ForceField *owner)
Constructor.
void addTerm(unsigned int idx1, unsigned int idx2, double chargeTerm, std::uint8_t dielModel, bool is1_4)
the van der Waals term for MMFF
void addTerm(unsigned int idx1, unsigned int idx2, const MMFFVdWRijstarEps *mmffVdWConstants)
Track a new VdW pair.
double getEnergy(double *pos) const override
returns our contribution to the energy of a position
VdWContrib * copy() const override
return a copy
VdWContrib(ForceField *owner)
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