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 = ForceFieldsHelper::OptimizeMolecule(*ff, maxIters);
46  delete ff;
47  return res;
48 }
49 
50 //! Convenience function for optimizing all of a molecule's conformations using
51 // UFF
52 /*
53  \param mol the molecule to use
54  \param res vector of (needsMore,energy)
55  \param numThreads the number of simultaneous threads to use (only has an
56  effect if the RDKit is compiled with thread support).
57  If set to zero, the max supported by the system will be
58  used.
59  \param maxIters the maximum number of force-field iterations
60  \param vdwThresh the threshold to be used in adding van der Waals terms
61  to the force field. Any non-bonded contact whose current
62  distance is greater than \c vdwThresh * the minimum value
63  for that contact will not be included.
64  \param ignoreInterfragInteractions if true, nonbonded terms will not be added
65  between
66  fragments
67 
68 */
70  std::vector<std::pair<int, double>> &res,
71  int numThreads = 1, int maxIters = 1000,
72  double vdwThresh = 10.0,
73  bool ignoreInterfragInteractions = true) {
75  mol, vdwThresh, -1, ignoreInterfragInteractions);
76  ForceFieldsHelper::OptimizeMoleculeConfs(mol, *ff, res, numThreads, maxIters);
77  delete ff;
78 }
79 } // end of namespace UFF
80 } // end of namespace RDKit
81 #endif
RDKit::UFF::UFFOptimizeMoleculeConfs
void UFFOptimizeMoleculeConfs(ROMol &mol, std::vector< std::pair< int, double >> &res, int numThreads=1, int maxIters=1000, double vdwThresh=10.0, bool ignoreInterfragInteractions=true)
Convenience function for optimizing all of a molecule's conformations using.
Definition: UFF.h:69
RDKit::UFF::UFFOptimizeMolecule
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
ForceFields::ForceField
A class to store forcefields and handle minimization.
Definition: ForceField.h:79
RDKit::UFF::constructForceField
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.
RDKit::ROMol
Definition: ROMol.h:171
FFConvenience.h
RDKit::ForceFieldsHelper::OptimizeMolecule
std::pair< int, double > OptimizeMolecule(ForceFields::ForceField &ff, int maxIters=1000)
Convenience function for optimizing a molecule using a pre-generated force-field.
Definition: FFConvenience.h:86
RDThreads.h
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::ForceFieldsHelper::OptimizeMoleculeConfs
void OptimizeMoleculeConfs(ROMol &mol, ForceFields::ForceField &ff, std::vector< std::pair< int, double >> &res, int numThreads=1, int maxIters=1000)
Convenience function for optimizing all of a molecule's conformations using.
Definition: FFConvenience.h:106
ForceField.h
Builder.h
export.h