RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
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
13
#include <
ForceField/ForceField.h
>
14
#include <
GraphMol/ForceFieldHelpers/FFConvenience.h
>
15
#include <
RDGeneral/RDThreads.h
>
16
#include "
AtomTyper.h
"
17
#include "
Builder.h
"
18
19
namespace
RDKit
{
20
class
ROMol
;
21
namespace
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
*/
45
inline
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);
50
MMFF::MMFFMolProperties
mmffMolProperties(mol, mmffVariant);
51
if
(mmffMolProperties.
isValid
()) {
52
std::unique_ptr<ForceFields::ForceField> ff(
MMFF::constructForceField
(
53
mol, nonBondedThresh, confId, ignoreInterfragInteractions));
54
res =
ForceFieldsHelper::OptimizeMolecule
(*ff, maxIters);
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
*/
81
inline
void
MMFFOptimizeMoleculeConfs
(
ROMol
&mol,
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
) {
87
MMFF::MMFFMolProperties
mmffMolProperties(mol, mmffVariant);
88
if
(mmffMolProperties.
isValid
()) {
89
std::unique_ptr<ForceFields::ForceField> ff(
90
MMFF::constructForceField
(mol, &mmffMolProperties, nonBondedThresh, -1,
91
ignoreInterfragInteractions));
92
ForceFieldsHelper::OptimizeMoleculeConfs
(mol, *ff, res, numThreads,
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
FFConvenience.h
ForceField.h
AtomTyper.h
Builder.h
RDThreads.h
RDKit::MMFF::MMFFMolProperties
Definition
MMFF/AtomTyper.h:79
RDKit::MMFF::MMFFMolProperties::isValid
bool isValid() const
Definition
MMFF/AtomTyper.h:153
RDKit::ROMol
Definition
ROMol.h:344
RDKit::ROMol::getNumConformers
unsigned int getNumConformers() const
Definition
ROMol.h:765
export.h
RDKit::ForceFieldsHelper::OptimizeMoleculeConfs
void OptimizeMoleculeConfs(ROMol &mol, ForceFields::ForceField &ff, std::vector< std::pair< int, double > > &res, int numThreads=1, int maxIters=1000)
Definition
FFConvenience.h:116
RDKit::ForceFieldsHelper::OptimizeMolecule
std::pair< int, double > OptimizeMolecule(ForceFields::ForceField &ff, int maxIters=1000)
Definition
FFConvenience.h:95
RDKit::MMFF
Definition
MMFF/AtomTyper.h:30
RDKit::MMFF::MMFFOptimizeMolecule
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::MMFF::constructForceField
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.
RDKit::MMFF::MMFFOptimizeMoleculeConfs
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
RDKit
Std stuff.
Definition
Abbreviations.h:19
GraphMol
ForceFieldHelpers
MMFF
MMFF.h
Generated on
for RDKit by
1.17.0