RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MMFF.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_MMFFCONVENIENCE_H
12#define RD_MMFFCONVENIENCE_H
15#include <RDGeneral/RDThreads.h>
16#include "AtomTyper.h"
17#include "Builder.h"
18
19namespace RDKit {
20class ROMol;
21namespace MMFF {
22//! Convenience function for optimizing a molecule using MMFF
23/*
24 \param mol the molecule to use
25 \param maxIters the maximum number of force-field iterations
26 \param mmffVariant the MMFF variant to use, should be "MMFF94" or "MMFF94S"
27 \param nonBondedThresh the threshold to be used in adding non-bonded terms
28 to the force field. Any non-bonded contact whose
29 current
30 distance is greater than \c nonBondedThresh * the minimum
31 value
32 for that contact will not be included.
33 \param confId the optional conformer id, if this isn't provided, the
34 molecule's
35 default confId will be used.
36 \param ignoreInterfragInteractions if true, nonbonded terms will not be added
37 between
38 fragments
39
40 \return a pair with:
41 first: -1 if parameters were missing, 0 if the optimization converged, 1 if
42 more iterations are required.
43 second: the energy
44*/
45inline std::pair<int, double> MMFFOptimizeMolecule(
46 ROMol &mol, int maxIters = 1000, std::string mmffVariant = "MMFF94",
47 double nonBondedThresh = 10.0, int confId = -1,
48 bool ignoreInterfragInteractions = true) {
49 std::pair<int, double> res = std::make_pair(-1, -1);
51 if (mmffMolProperties.isValid()) {
52 std::unique_ptr<ForceFields::ForceField> ff(MMFF::constructForceField(
55 }
56 return res;
57}
58
59//! Convenience function for optimizing all of a molecule's conformations using
60/// MMFF
61/*
62 \param mol the molecule to use
63 \param res vector of (needsMore,energy) pairs
64 \param numThreads the number of simultaneous threads to use (only has an
65 effect if the RDKit is compiled with thread support).
66 If set to zero, the max supported by the system will be
67 used.
68 \param maxIters the maximum number of force-field iterations
69 \param mmffVariant the MMFF variant to use, should be "MMFF94" or "MMFF94S"
70 \param nonBondedThresh the threshold to be used in adding non-bonded terms
71 to the force field. Any non-bonded contact whose
72 current
73 distance is greater than \c nonBondedThresh * the minimum
74 value
75 for that contact will not be included.
76 \param ignoreInterfragInteractions if true, nonbonded terms will not be added
77 between
78 fragments
79
80*/
82 std::vector<std::pair<int, double>> &res,
83 int numThreads = 1, int maxIters = 1000,
84 std::string mmffVariant = "MMFF94",
85 double nonBondedThresh = 10.0,
86 bool ignoreInterfragInteractions = true) {
88 if (mmffMolProperties.isValid()) {
89 std::unique_ptr<ForceFields::ForceField> ff(
93 maxIters);
94 } else {
95 res.resize(mol.getNumConformers());
96 for (unsigned int i = 0; i < mol.getNumConformers(); ++i) {
97 res[i] = std::make_pair(static_cast<int>(-1), static_cast<double>(-1));
98 }
99 }
100}
101} // namespace MMFF
102} // end of namespace RDKit
103#endif
unsigned int getNumConformers() const
Definition ROMol.h:568
void OptimizeMoleculeConfs(ROMol &mol, ForceFields::ForceField &ff, std::vector< std::pair< int, double > > &res, int numThreads=1, int maxIters=1000)
std::pair< int, double > OptimizeMolecule(ForceFields::ForceField &ff, int maxIters=1000)
std::pair< int, double > MMFFOptimizeMolecule(ROMol &mol, int maxIters=1000, std::string mmffVariant="MMFF94", double nonBondedThresh=10.0, int confId=-1, bool ignoreInterfragInteractions=true)
Convenience function for optimizing a molecule using MMFF.
Definition MMFF.h:45
RDKIT_FORCEFIELDHELPERS_EXPORT ForceFields::ForceField * constructForceField(ROMol &mol, double nonBondedThresh=100.0, int confId=-1, bool ignoreInterfragInteractions=true)
Builds and returns a MMFF force field for a molecule.
void MMFFOptimizeMoleculeConfs(ROMol &mol, std::vector< std::pair< int, double > > &res, int numThreads=1, int maxIters=1000, std::string mmffVariant="MMFF94", double nonBondedThresh=10.0, bool ignoreInterfragInteractions=true)
Definition MMFF.h:81
Std stuff.
bool rdvalue_is(const RDValue_cast_t)