Skip to content

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Sep 19, 2025

This is a PR that includes a bunch of new features that I had in the wings but was waiting for some feedback from the folks I made the changes for (which never came). In light of openwebwork/mathquill#41, I thought I'd fix that problem, and include these other changes as well.

The changes here are to:

  • Tighten syntactic checks,
  • combine adjacent equal elements,
  • add conversion to molecular form,
  • allow comparisons based on molecular forms,
  • and better handling of charges.

See the changes to the comments (in particular the new large section on molecular form). There are a bunch of new flags to control how the checking is performed.

The new section in the Close() method of the context::Reaction package is the part that fixes the parentheses around charges.

Some methods that are common to multiple objects have been moved into a new context::Reaction::common package, and there is new data stored about the elements in a compound that is used to manage the molecular form. Most of the rest is new methods used for computing the molecular forms.

…sion to molecular form, and allow comparisons based on molecular forms, better handling of charges
@sfiedle1
Copy link
Contributor

The following warning appears when running the MWE given in openwebwork/mathquill#41:

Argument "type" isn't numeric in subtraction (-) at line 874 of [PG]/macros/contexts/contextReaction.pl

Without sinking into the code, this warning can be suppressed if "$other -type" in line 874 is changed to "$other ->type".

@dpvc
Copy link
Member Author

dpvc commented Sep 19, 2025

Thanks @sfiedle1, I'm not sure how that got messed up. I've added a commit to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants