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

Use openmm.LangevinMiddleIntegrator #588

Merged
merged 3 commits into from
Dec 4, 2024
Merged

Use openmm.LangevinMiddleIntegrator #588

merged 3 commits into from
Dec 4, 2024

Conversation

mattwthompson
Copy link
Member

Description

Implements #587

Todos

Notable points that this PR has either accomplished or will accomplish.

  • openmmtools.integrators.LangevinIntegrator -> openmm.LangevinMiddleIntegrator

Questions

  • Arguments actually a drop-in replacement?

Status

  • Ready to go

@mattwthompson
Copy link
Member Author

mattwthompson commented Dec 3, 2024

I am quite annoyed that I can't pass named arguments to these SWIG-generated functions:

In [1]: from openmm import LangevinMiddleIntegrator

In [2]: LangevinMiddleIntegrator(1, 1, 1)
Out[2]: <openmm.openmm.LangevinMiddleIntegrator; proxy of <Swig Object of type 'OpenMM::LangevinMiddleIntegrator *' at 0x107e67e40> >

In [3]: LangevinMiddleIntegrator(temperature=1, frictionCoeff=1, stepSize=1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 LangevinMiddleIntegrator(temperature=1, frictionCoeff=1, stepSize=1)

TypeError: LangevinMiddleIntegrator.__init__() got an unexpected keyword argument 'temperature'
__init__(self, temperature, frictionCoeff, stepSize) → LangevinMiddleIntegrator
__init__(self, other) → LangevinMiddleIntegrator
    Create a LangevinMiddleIntegrator.

    Parameters
    temperature (double) – the temperature of the heat bath (in Kelvin)

    frictionCoeff (double) – the friction coefficient which couples the system to the heat bath (in inverse picoseconds)

    stepSize (double) – the step size with which to integrate the system (in picoseconds)

@mattwthompson mattwthompson marked this pull request as ready for review December 3, 2024 17:00
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.69%. Comparing base (3637ed9) to head (3a8655f).
Report is 7 commits behind head on main.

Additional details and impacted files

@lilyminium
Copy link
Contributor

Arguments actually a drop-in replacement?

I think they should be -- not only are the units and default argument the same, but the collision_rate is converted to self._gamma in openmmtools, where gamma is typically used to represent the friction coefficient.

Copy link
Contributor

@lilyminium lilyminium left a comment

Choose a reason for hiding this comment

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

LGTM -- thanks for the quick fix @mattwthompson!

My only thought -- does this need tests of some kind, e.g. to check the temperature issue? But that might be out of scope and a lot more work for a one-line change, happy to defer to you.

@mattwthompson
Copy link
Member Author

Agree it would be useful but I don't know a quick way to test that right now

@mattwthompson mattwthompson merged commit f76dc99 into main Dec 4, 2024
14 checks passed
@mattwthompson mattwthompson deleted the new-integrator branch December 5, 2024 16:16
@mattwthompson mattwthompson added this to the 0.4.11 milestone Jan 15, 2025
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