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

atomate2 / OpenMM OPLS-AA Enhancements #1111

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

shehan807
Copy link

Summary

This PR resolves the first two enhancements proposed in Issue #1102:

  • Feature 1: Implements the correct geometric combination rules for OPLS MD simulations via opls_lj()

I've changed create_system_from_xml to create_ff_from_xml in src/atomate2/openmm/jobs/generate.py. Why? The OPLS geometric combination rules have two requirements, (1) a CustomNonbondedForce in OpenMM that combines the sigma and eps parameters geometrically, and (2) the coulomb14scale and lj14scale attributes of the ForceField are both 0.5. The latter was enough justification for raising an error if not the case--to do so, the ForceField object would need to be accessible in generate_openmm_interchange (instead of adding unsuitable arguments to create_system_from_xml). Originally, create_system_from_xml created both the ForceField and System within the same function; now, system and ff are separate variables in generate_openmm_interchange.

  • Feature 2: Allows users to create OPLS forcefield files via generate_opls_xml() via LigParGen and BOSS source code directly. To do so, users would need to follow the steps in the docs from this fork.

Currently, generate_opls_xml is only functional so long as the user has a local installation of Docker and created a private (for now, pending approval for pushing to public registries) image of LigParGen. The documentation is provided to completion in docs/user/codes/openmm.md.

Additional dependencies introduced

  • defusedxml, resolves ruff failures for safely loading XML files, e.g.,
self.tree = DiffET.parse(xml_string)
  • textwrap, enables easier text wrapping of long warnings/errors printed for the user, e.g.,
        if (c14 != 0.5) or (lj14 != 0.5):
            raise ValueError(
                textwrap.dedent(f"""\
                    NonbondedForce class in XML,
                    <NonbondedForce coulomb14scale="0.5" lj14scale="0.5">,
                    does not match OPLS convention,
                    <NonbondedForce coulomb14scale="{c14}" lj14scale="{lj14}">.""")
            )

CC'ing @utf, @orionarcher

Shehan M Parmar and others added 14 commits January 16, 2025 14:27
…haps this is fine? and (2) usused eps14 variable (need to check that eps == eps14)
…tead; solution: comment out eps14 line to match original ligpargen code
… 14 interaction scale values (i.e., 0.5); changed create_system_from_xml to create_ff_from_xml to enable generate_openmm_interchange to have access to combination rules only available via the forcefield...still experiencing NoneType error when creating OpenMMInterchange object which prohibits inspection of OpenMMInterchange in generate_openmm_interchange
… to convert xml to string, leaving this commented for now before checking other cases
…to cutoff; incorporated diffusedxml to follow linter guidelines
… and solution was to .split() command into a list of strings
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.

1 participant