11 #ifndef RD_UFFCONVENIENCE_H 12 #define RD_UFFCONVENIENCE_H 40 ROMol &mol,
int maxIters = 1000,
double vdwThresh = 10.0,
int confId = -1,
41 bool ignoreInterfragInteractions =
true) {
43 mol, vdwThresh, confId, ignoreInterfragInteractions);
48 return std::make_pair(res, e);
50 #ifdef RDK_THREADSAFE_SSS 53 std::vector<std::pair<int, double>> *res,
54 unsigned int threadIdx,
55 unsigned int numThreads,
int maxIters) {
60 if (i % numThreads != threadIdx)
continue;
61 for (
unsigned int aidx = 0; aidx < mol->
getNumAtoms(); ++aidx) {
62 ff.
positions()[aidx] = &(*cit)->getAtomPos(aidx);
65 int needsMore = ff.
minimize(maxIters);
67 (*res)[i] = std::make_pair(needsMore, e);
92 std::vector<std::pair<int, double>> &res,
93 int numThreads = 1,
int maxIters = 1000,
94 double vdwThresh = 10.0,
95 bool ignoreInterfragInteractions =
true) {
98 if (numThreads == 1) {
103 ignoreInterfragInteractions);
106 #ifdef RDK_THREADSAFE_SSS 109 mol, vdwThresh, -1, ignoreInterfragInteractions);
110 std::vector<std::thread> tg;
111 for (
int ti = 0; ti < numThreads; ++ti) {
112 tg.emplace_back(std::thread(detail::UFFOptimizeMoleculeConfsHelper_, *ff,
113 &mol, &res, ti, numThreads, maxIters));
115 for (
auto &thread : tg) {
116 if (thread.joinable()) thread.join();
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
void initialize()
does initialization
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.
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.
unsigned int getNumThreadsToUse(int target)
ConformerIterator endConformers()
ConformerIterator beginConformers()
A class to store forcefields and handle minimization.
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.