Closed ptosco closed 3 years ago
Thanks for submitting this, @ptosco . Rachel/Nic/I will take a look at this in the next couple of days.
The CI failure isn't real - we disabled appveyor.
@ptosco - This is a great bug report and solid proposed fix. I think we're going to iterate on it slightly, but we'll either accept this or propose an alternate fix in the next week or so. (I think that we can slightly improve on the treatment of that ethyl)
Thank you for submitting this! It looks like the 16-17 bond isn't flipping around the 15-16 bond because the 16-17 bond is considered a constrained fragment. I tried introducing a fully_constrained
field to sketcherMinimizerFragment, which is set to true
when all atoms in a given fragment are constrained. If we do something like this in CoordgenMinimizer::flipFragments
:
for (auto fragment : fragments) {
if (!fragment->fixed && !fragment->fully_constrained) {
...
}
}
the 16-17 bond will flip around the 15-16 bond, as shown below.
As @ZontaNicola mentioned, it may sometimes be necessary to flip constrained fragments. Maybe we could specifically penalize flipping fully constrained fragments? Or degrees of freedom that only affect constrained atoms?
@rachelnwalker Thank you Rachel for looking into this.
I have just updated my PR taking into account @ZontaNicola's remark on countHeteroatoms
and included a possible fix for your finding: a fragment should not be considered constrained if a single atom is contrained, as that's just the attachment point. With that fix, I get a much better layout:
Paolo - We're going to merge https://github.com/schrodinger/coordgenlibs/pull/93 instead of this. It's a riff on this with some of Nic and Rachel's ideas. Once again - I really appreciate the work, and feel silly that I didn't just merge it before we worked on #93.
Hello,
working with the RDKit interface to
CoordGen
I noticed that when I do a constrained depiction in RDKit usingrdDepictor.GenerateDepictionMatching2DStructure
and my constrained scaffold consists of two ring systems connected by a rotatable bond,CoordGen
may flip the two rings with respect to each other in the attempt to escape a steric clash. This is a simple reproducible:I think this is undesirable as the resulting 2D layout does not honor the original constraint anymore. I did a bit of investigation and I have seen that while
sketcherMinimizer::alignWithParentDirectionConstrained
indeed prevents the flip at theCoordgenMinimizer::buildMoleculeFromFragments
stage, at theCoordgenMinimizer::avoidClashes
stage the flip may still take place in an attempt to escape the clash between the amino group and the ethyl group.With the change proposed in this PR, that prevents the possibility to flip in
CoordgenMinimizer::flipFragments
also for constrained fragments and not only for fixed fragments, the above flip does not take place anymore, but if the clash is quite bad the molecule is still allowed to bend to alleviate the clash. This still does not look great as it would be better to rather rotate by 180 degrees the ethyl substituent around the 15-16 bond:You may have better solutions to this issue than the one proposed in this PR, but I hope what I described makes sense to you. When I tried to switch the RDKit
CoordGen
interface to usefixed
rather thanconstrained
results I got really bad layouts, so I guess that's not an option at the moment.In passing, I have also introduced a change into the
sketcherMinimizerFragment::countHeavyAtoms
, that does not seem to do what is written on the tin at the moment :-).