mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
fix a thread-safety bug in the UFF parameter acquisition (#4553)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// $Id$
|
||||
//
|
||||
// Copyright (C) 2004-2006 Rational Discovery LLC
|
||||
// Copyright (C) 2004-2021 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -393,7 +392,7 @@ std::string getAtomLabel(const Atom *atom) {
|
||||
std::pair<AtomicParamVect, bool> getAtomTypes(const ROMol &mol,
|
||||
const std::string &) {
|
||||
bool foundAll = true;
|
||||
ParamCollection *params = ParamCollection::getParams();
|
||||
auto params = ParamCollection::getParams();
|
||||
|
||||
AtomicParamVect paramVect;
|
||||
paramVect.resize(mol.getNumAtoms());
|
||||
@@ -420,7 +419,7 @@ std::pair<AtomicParamVect, bool> getAtomTypes(const ROMol &mol,
|
||||
|
||||
bool getUFFBondStretchParams(const ROMol &mol, unsigned int idx1,
|
||||
unsigned int idx2, UFFBond &uffBondStretchParams) {
|
||||
ParamCollection *params = ParamCollection::getParams();
|
||||
auto params = ParamCollection::getParams();
|
||||
unsigned int idx[2] = {idx1, idx2};
|
||||
AtomicParamVect paramVect(2);
|
||||
unsigned int i;
|
||||
@@ -445,7 +444,7 @@ bool getUFFBondStretchParams(const ROMol &mol, unsigned int idx1,
|
||||
bool getUFFAngleBendParams(const ROMol &mol, unsigned int idx1,
|
||||
unsigned int idx2, unsigned int idx3,
|
||||
UFFAngle &uffAngleBendParams) {
|
||||
ParamCollection *params = ParamCollection::getParams();
|
||||
auto params = ParamCollection::getParams();
|
||||
unsigned int idx[3] = {idx1, idx2, idx3};
|
||||
AtomicParamVect paramVect(3);
|
||||
unsigned int i;
|
||||
@@ -477,7 +476,7 @@ bool getUFFAngleBendParams(const ROMol &mol, unsigned int idx1,
|
||||
bool getUFFTorsionParams(const ROMol &mol, unsigned int idx1, unsigned int idx2,
|
||||
unsigned int idx3, unsigned int idx4,
|
||||
UFFTor &uffTorsionParams) {
|
||||
ParamCollection *params = ParamCollection::getParams();
|
||||
auto params = ParamCollection::getParams();
|
||||
unsigned int idx[4] = {idx1, idx2, idx3, idx4};
|
||||
AtomicParamVect paramVect(2);
|
||||
unsigned int i;
|
||||
@@ -599,7 +598,7 @@ bool getUFFInversionParams(const ROMol &mol, unsigned int idx1,
|
||||
bool getUFFVdWParams(const ROMol &mol, unsigned int idx1, unsigned int idx2,
|
||||
UFFVdW &uffVdWParams) {
|
||||
bool res = true;
|
||||
ParamCollection *params = ParamCollection::getParams();
|
||||
auto params = ParamCollection::getParams();
|
||||
unsigned int idx[2] = {idx1, idx2};
|
||||
AtomicParamVect paramVect(2);
|
||||
unsigned int i;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2004-2018 Greg Landrum and Rational Discovery LLC
|
||||
// Copyright (C) 2004-2021 Greg Landrum and other RDKit contributors
|
||||
//
|
||||
// @@ All Rights Reserved @@
|
||||
// This file is part of the RDKit.
|
||||
@@ -1387,8 +1387,7 @@ void testGitHubIssue613() {
|
||||
TEST_ASSERT(foundAll);
|
||||
TEST_ASSERT(types.size() == mol->getNumAtoms());
|
||||
|
||||
ForceFields::UFF::ParamCollection *params =
|
||||
ForceFields::UFF::ParamCollection::getParams();
|
||||
auto params = ForceFields::UFF::ParamCollection::getParams();
|
||||
const ForceFields::UFF::AtomicParams *ap = (*params)("Eu6+3");
|
||||
TEST_ASSERT(ap);
|
||||
TEST_ASSERT(ap->r1 == types[0]->r1);
|
||||
|
||||
Reference in New Issue
Block a user