Set useCutOff in PrepareConformer. (#8446)

This commit is contained in:
David Cosgrove
2025-04-16 11:14:59 +01:00
committed by GitHub
parent 0e592ab981
commit a88ef96b33
2 changed files with 21 additions and 1 deletions

View File

@@ -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)

View File

@@ -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);
}