RDKit
Open-source cheminformatics and machine learning.
UFF.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2015-2018 Greg Landrum
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_UFFCONVENIENCE_H
12 #define RD_UFFCONVENIENCE_H
13 #include <ForceField/ForceField.h>
15 #include <RDGeneral/RDThreads.h>
16 #include "Builder.h"
17 
18 namespace RDKit {
19 class ROMol;
20 namespace UFF {
21 //! Convenience function for optimizing a molecule using UFF
22 /*
23  \param mol the molecule to use
24  \param maxIters the maximum number of force-field iterations
25  \param vdwThresh the threshold to be used in adding van der Waals terms
26  to the force field. Any non-bonded contact whose current
27  distance is greater than \c vdwThresh * the minimum value
28  for that contact will not be included.
29  \param confId the optional conformer id, if this isn't provided, the
30  molecule's
31  default confId will be used.
32  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
33  between
34  fragments
35 
36  \return a pair with:
37  first: 0 if the optimization converged, 1 if more iterations are required.
38  second: the energy
39 */
40 std::pair<int, double> UFFOptimizeMolecule(
41  ROMol &mol, int maxIters = 1000, double vdwThresh = 10.0, int confId = -1,
42  bool ignoreInterfragInteractions = true) {
44  mol, vdwThresh, confId, ignoreInterfragInteractions);
45  std::pair<int, double> res =
47  delete ff;
48  return res;
49 }
50 
51 //! Convenience function for optimizing all of a molecule's conformations using
52 /// UFF
53 /*
54  \param mol the molecule to use
55  \param res vector of (needsMore,energy)
56  \param numThreads the number of simultaneous threads to use (only has an
57  effect if the RDKit is compiled with thread support).
58  If set to zero, the max supported by the system will be
59  used.
60  \param maxIters the maximum number of force-field iterations
61  \param vdwThresh the threshold to be used in adding van der Waals terms
62  to the force field. Any non-bonded contact whose current
63  distance is greater than \c vdwThresh * the minimum value
64  for that contact will not be included.
65  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
66  between
67  fragments
68 
69 */
71  std::vector<std::pair<int, double>> &res,
72  int numThreads = 1, int maxIters = 1000,
73  double vdwThresh = 10.0,
74  bool ignoreInterfragInteractions = true) {
76  UFF::constructForceField(mol, vdwThresh, -1, ignoreInterfragInteractions);
77  ForceFieldsHelper::OptimizeMoleculeConfs(mol, *ff, res, numThreads, maxIters);
78  delete ff;
79 }
80 } // end of namespace UFF
81 } // end of namespace RDKit
82 #endif
A class to store forcefields and handle minimization.
Definition: ForceField.h:79
std::pair< int, double > OptimizeMolecule(ForceFields::ForceField &ff, int maxIters=1000)
Definition: FFConvenience.h:93
void OptimizeMoleculeConfs(ROMol &mol, ForceFields::ForceField &ff, std::vector< std::pair< int, double >> &res, int numThreads=1, int maxIters=1000)
RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField * constructForceField(ROMol &mol, double vdwThresh=100.0, int confId=-1, bool ignoreInterfragInteractions=true)
Builds and returns a UFF force field for a molecule.
std::pair< int, double > UFFOptimizeMolecule(ROMol &mol, int maxIters=1000, double vdwThresh=10.0, int confId=-1, bool ignoreInterfragInteractions=true)
Convenience function for optimizing a molecule using UFF.
Definition: UFF.h:40
void UFFOptimizeMoleculeConfs(ROMol &mol, std::vector< std::pair< int, double >> &res, int numThreads=1, int maxIters=1000, double vdwThresh=10.0, bool ignoreInterfragInteractions=true)
Definition: UFF.h:70
Std stuff.
Definition: Abbreviations.h:19