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()) {
55 delete ff;
56 }
57 return res;
58}
59
60//! Convenience function for optimizing all of a molecule's conformations using
61/// MMFF
62/*
63 \param mol the molecule to use
64 \param res vector of (needsMore,energy) pairs
65 \param numThreads the number of simultaneous threads to use (only has an
66 effect if the RDKit is compiled with thread support).
67 If set to zero, the max supported by the system will be
68 used.
69 \param maxIters the maximum number of force-field iterations
70 \param mmffVariant the MMFF variant to use, should be "MMFF94" or "MMFF94S"
71 \param nonBondedThresh the threshold to be used in adding non-bonded terms
72 to the force field. Any non-bonded contact whose
73 current
74 distance is greater than \c nonBondedThresh * the minimum
75 value
76 for that contact will not be included.
77 \param ignoreInterfragInteractions if true, nonbonded terms will not be added
78 between
79 fragments
80
81*/
83 std::vector<std::pair<int, double>> &res,
84 int numThreads = 1, int maxIters = 1000,
85 std::string mmffVariant = "MMFF94",
86 double nonBondedThresh = 10.0,
87 bool ignoreInterfragInteractions = true) {
89 if (mmffMolProperties.isValid()) {
94 maxIters);
95 delete ff;
96 } else {
97 res.resize(mol.getNumConformers());
98 for (unsigned int i = 0; i < mol.getNumConformers(); ++i) {
99 res[i] = std::make_pair(static_cast<int>(-1), static_cast<double>(-1));
100 }
101 }
102}
103} // namespace MMFF
104} // end of namespace RDKit
105#endif
A class to store forcefields and handle minimization.
Definition ForceField.h:79
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:82
Std stuff.
bool rdvalue_is(const RDValue_cast_t)