Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch meanBondLen of 0.0 #6699

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Conversation

DavidACosgrove
Copy link
Collaborator

Reference Issue

Fixes problem in discussion (not issue) #6683.

What does this implement/fix? Explain your changes.

Catches a zero mean bond length when setting the ACC1996 draw options.

Any other comments?

@@ -481,6 +481,7 @@ void drawMolACS1996(MolDraw2D &drawer, const ROMol &mol,

// ****************************************************************************
void setACS1996Options(MolDrawOptions &opts, double meanBondLen) {
PRECONDITION(meanBondLen > 0.0, "mean bond length <= 0 for ACS1996 mode")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better as a ValueError than a PRECONDITION (which generally indicates a catastrophic programming failure, not bad input)

MolDraw2DSVG drawer(-1, -1);
auto reactIter = rxn->beginReactantTemplates();
REQUIRE_THROWS(MolDraw2DUtils::setACS1996Options(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the exception is changed to ValueError, then this should also check specifically for that exception type.

@DavidACosgrove
Copy link
Collaborator Author

Good point. Change pushed.

Copy link
Member

@greglandrum greglandrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@greglandrum greglandrum merged commit e441967 into rdkit:master Sep 8, 2023
10 checks passed
@greglandrum greglandrum added the bug label Sep 8, 2023
@greglandrum greglandrum added this to the 2023_03_4 milestone Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants