11 #ifndef RD_MMFFCONVENIENCE_H 12 #define RD_MMFFCONVENIENCE_H 45 ROMol &mol,
int maxIters = 1000, std::string mmffVariant =
"MMFF94",
46 double nonBondedThresh = 10.0,
int confId = -1,
47 bool ignoreInterfragInteractions =
true) {
51 if (mmffMolProperties.
isValid()) {
53 mol, nonBondedThresh, confId, ignoreInterfragInteractions);
59 return std::make_pair(res, e);
61 #ifdef RDK_THREADSAFE_SSS 64 std::vector<std::pair<int, double>> *res,
65 unsigned int threadIdx,
66 unsigned int numThreads,
int maxIters) {
71 if (i % numThreads != threadIdx)
continue;
72 for (
unsigned int aidx = 0; aidx < mol->
getNumAtoms(); ++aidx) {
73 ff.
positions()[aidx] = &(*cit)->getAtomPos(aidx);
76 int needsMore = ff.
minimize(maxIters);
78 (*res)[i] = std::make_pair(needsMore, e);
106 std::vector<std::pair<int, double>> &res,
107 int numThreads = 1,
int maxIters = 1000,
108 std::string mmffVariant =
"MMFF94",
109 double nonBondedThresh = 10.0,
110 bool ignoreInterfragInteractions =
true) {
114 if (mmffMolProperties.
isValid()) {
116 mol, nonBondedThresh, -1, ignoreInterfragInteractions);
117 if (numThreads == 1) {
121 for (
unsigned int aidx = 0; aidx < mol.
getNumAtoms(); ++aidx) {
122 ff->
positions()[aidx] = &(*cit)->getAtomPos(aidx);
125 int needsMore = ff->
minimize(maxIters);
127 res[i] = std::make_pair(needsMore, e);
130 #ifdef RDK_THREADSAFE_SSS 132 std::vector<std::thread> tg;
133 for (
int ti = 0; ti < numThreads; ++ti) {
134 tg.emplace_back(std::thread(detail::MMFFOptimizeMoleculeConfsHelper_,
135 *ff, &mol, &res, ti, numThreads, maxIters));
137 for (
auto &thread : tg) {
138 if (thread.joinable()) thread.join();
145 res[i] = std::make_pair(static_cast<int>(-1), static_cast<double>(-1));
int minimize(unsigned int snapshotFreq, RDKit::SnapshotVect *snapshotVect, unsigned int maxIts=200, double forceTol=1e-4, double energyTol=1e-6)
minimizes the energy of the system by following gradients
unsigned int getNumAtoms(bool onlyExplicit=1) const
returns our number of atoms
RDGeom::PointPtrVect & positions()
returns a reference to our points (a PointPtrVect)
double calcEnergy(std::vector< double > *contribs=NULL) const
calculates and returns the energy (in kcal/mol) based on existing
unsigned int getNumConformers() const
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.
void initialize()
does initialization
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.
unsigned int getNumThreadsToUse(int target)
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)
Convenience function for optimizing all of a molecule's conformations using.
ConformerIterator endConformers()
ConformerIterator beginConformers()
A class to store forcefields and handle minimization.