mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Set useCutOff in PrepareConformer. (#8446)
This commit is contained in:
2
External/pubchem_shape/PubChemShape.cpp
vendored
2
External/pubchem_shape/PubChemShape.cpp
vendored
@@ -161,6 +161,8 @@ std::vector<std::vector<const ROMol *>> *getPh4Patterns() {
|
||||
|
||||
// the conformer is translated to the origin
|
||||
ShapeInput PrepareConformer(const ROMol &mol, int confId, bool useColors) {
|
||||
Align3D::setUseCutOff(true);
|
||||
|
||||
ShapeInput res;
|
||||
|
||||
// unpack features (PubChem-specific property from SDF)
|
||||
|
||||
20
External/pubchem_shape/test.cpp
vendored
20
External/pubchem_shape/test.cpp
vendored
@@ -302,4 +302,22 @@ TEST_CASE("Serialization") {
|
||||
CHECK_THAT(shape2.sov, Catch::Matchers::WithinAbs(253.764, 0.005));
|
||||
CHECK_THAT(shape2.sof, Catch::Matchers::WithinAbs(5.074, 0.005));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
TEST_CASE("d2CutOff set") {
|
||||
// Previously, shape1.sov and shape2.sov were slightly different because
|
||||
// useCutOff was only being set in AlignMolecule, not PrepareConformer.
|
||||
// Thus aligning a different molecule meant that PrepareConformer gave
|
||||
// different results before and after the alignment.
|
||||
auto m1 =
|
||||
"c1ccc(-c2ccccc2)cc1 |(-3.26053,-0.0841607,-0.741909;-2.93383,0.123873,0.593407;-1.60713,0.377277,0.917966;-0.644758,0.654885,-0.0378428;0.743308,0.219134,0.168663;1.82376,1.0395,-0.0112769;3.01462,0.695405,0.613858;3.18783,-0.589771,1.09649;2.15761,-1.50458,1.01949;0.988307,-1.1313,0.385783;-1.1048,0.797771,-1.34022;-2.39754,0.435801,-1.69921)|"_smiles;
|
||||
REQUIRE(m1);
|
||||
auto shape1 = PrepareConformer(*m1, -1, true);
|
||||
std::vector<float> matrix(12, 0.0);
|
||||
auto m2 =
|
||||
"c1ccc(-c2ccccc2)cc1 |(-3.26053,-0.0841607,-0.741909;-2.93383,0.123873,0.593407;-1.60713,0.377277,0.917966;-0.644758,0.654885,-0.0378428;0.743308,0.219134,0.168663;1.82376,1.0395,-0.0112769;3.01462,0.695405,0.613858;3.18783,-0.589771,1.09649;2.15761,-1.50458,1.01949;0.988307,-1.1313,0.385783;-1.1048,0.797771,-1.34022;-2.39754,0.435801,-1.69921)|"_smiles;
|
||||
REQUIRE(m2);
|
||||
AlignMolecule(*m2, *m2, matrix);
|
||||
auto shape2 = PrepareConformer(*m1, -1, true);
|
||||
CHECK(shape1.sov == shape2.sov);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user