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

Fix cutoff and lifting parameters in RESTCapableHybridTopologyFactory #1046

Merged
merged 5 commits into from Jun 22, 2022

Conversation

zhang-ivy
Copy link
Contributor

@zhang-ivy zhang-ivy commented Jun 15, 2022

Description

This PR addresses the following problem:

The RESTCapableHybridTopologyFactory is not performing lifting to the 4th dimension correctly in vacuum. We are maximally lifting to 100 nm, which is much too large. The maximal lifting distance is currently defined by w_scale * r_cutoff. For vacuum, we set r_cutoff to be 100 nm, which is the distance we want to use when calling CustomNonbondedForce.setCutoffDistance(), but we do not want the maximal lifting distance to be that large, therefore, we need to remove the dependence of the maximal lifting distance on r_cutoff.

In fact, we actually don't need the maximal lifting distance to depend on 2 parameters, we can use just 1 parameter, which I'll call w_lifting, that defines the maximal lifting distance in nanometers.

This PR does the following:

  • Renames r_cutoff to cutoff. cutoff is copied from the real system and if the nonbonded method is vacuum, cutoff is set to 100 nm. cutoff is only used when setting the cutoff distance in the CustomNonbondedForces via setCutoffDistance and not in the custom expression when defining lifting expressions.
  • When defining the lifting expressions, use a single user-controlled parameter (w_lifting)

Motivation and context

How has this been tested?

Change log

Bug fix in the `RESTCapableHybridTopologyFactory` lifting expression -- fixed by separating the cutoff distance from the lifting distance.

@zhang-ivy zhang-ivy added this to the 0.10.1 - Bugfix release milestone Jun 15, 2022
@zhang-ivy zhang-ivy changed the title fix lifting Fix cutoff and lifting parameters in RESTCapableHybridTopologyFactory Jun 15, 2022
@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #1046 (3c866c8) into main (28885ab) will not change coverage.
The diff coverage is 80.95%.

@ijpulidos
Copy link
Contributor

The change of the parameter name from w_scale to w_lifting breaks API compatibility. That is, people using perses 0.10.0 will have problem getting their code to work with subsequent versions, if we decide to change this. I know we probably don't have many users of this new HTF yet. Is there a special reason why we would like to change the name? Just curious if it is worth to break the compatibility.

Also, if we decide to change this, then I think there are also some other things we have to review in setup_relative_calculation.py and the parent PointMutationExecutor, which are using w_scale.

@ijpulidos
Copy link
Contributor

ijpulidos commented Jun 15, 2022

I guess the bigger concern I see, is that it could also just silently fail, if the user decide to use w_scale but the actual name is changed to w_lifting, as far as I can see.

@zhang-ivy
Copy link
Contributor Author

zhang-ivy commented Jun 17, 2022

The change of the parameter name from w_scale to w_lifting breaks API compatibility. That is, people using perses 0.10.0 will have problem getting their code to work with subsequent versions, if we decide to change this. I know we probably don't have many users of this new HTF yet. Is there a special reason why we would like to change the name? Just curious if it is worth to break the compatibility.

I've updated the description above to be more clear -- hopefully its now more obvious why this PR is necessary. More specifically, the name change is needed because w_scale no longer reflects what the argument represents. It is now a distance, not a scaling factor.

The RESTCapableHybridTopologyFactory is still pretty experimental and under development. I think the first priority is to make sure that code works properly, and the second priority is backwards compatibility. Once we reach a more stable, working version, I think we can prioritize backwards compatibility, but I don't think we are that point now.

Also, in the last release (0.10.0), we introduced at least one PR that break backwards compatibility: #1024
But I think this is ok, because we are still iterating on the best version of the API and we aren't advertising the API as stable yet.

Also, if we decide to change this, then I think there are also some other things we have to review in setup_relative_calculation.py and the parent PointMutationExecutor, which are using w_scale.

I can add these changes today.

Copy link
Contributor

@dominicrufa dominicrufa left a comment

Choose a reason for hiding this comment

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

this looks fine. it seems there's quite a bit of code duplication though. might want to think about revising this at some point.

to clarify, this is a better handler for vacuum lifting, correct? otherwise you would have been lifing to ~100nm, which is probably problematic w.r.t. convergence?

rest_radius=0.3,
w_scale=0.3,
rest_radius=0.3 * unit.nanometer,
w_lifting=0.3 * unit.nanometer,
Copy link
Contributor

Choose a reason for hiding this comment

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

you found that 0.3nm is a good lifting value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, from preliminary experiments I found that 0.3 was good. I still need to run the w_lifting optimization experiments for the paper, but hopefully the results will be similar to the preliminary experiments.

@zhang-ivy
Copy link
Contributor Author

zhang-ivy commented Jun 17, 2022

to clarify, this is a better handler for vacuum lifting, correct? otherwise you would have been lifing to ~100nm, which is probably problematic w.r.t. convergence?

@dominicrufa : yes, see the description of the PR for more details on this.

Copy link
Contributor

@ijpulidos ijpulidos left a comment

Choose a reason for hiding this comment

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

I think we can afford the API-breaking changes. I like that we are using explicit units in the parameters. Looks good!

@zhang-ivy
Copy link
Contributor Author

zhang-ivy commented Oct 11, 2022 via email

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

3 participants