-
Notifications
You must be signed in to change notification settings - Fork 51
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
grab forces by name instead of hard-coded index #976
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
@@ -823,16 +823,18 @@ def flattenedHybridTopologyFactory_energies(topology, chain, system, positions, | |||
# Make list of off atoms that should have flattened torsions/exceptions | |||
off_atoms = topology_proposal.unique_new_atoms if endstate == 0 else topology_proposal.unique_old_atoms | |||
system = topology_proposal.old_system if endstate == 0 else topology_proposal.new_system | |||
# TODO will openmm ever allow duplicate names here? | |||
force_names = {force.__class__.__name__ : index for index, force in enumerate(system.getForces())} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: There's now a force.getName()
method that can be used instead, though this is a recent addition.
The name can even be set by users if nonstandard names are desired.
@mikemhenry : Can you clarify what changes in openmm caused the change in order of the forces? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I'm just worried that there's no guarantee that the forces names will be different. According to official doc they would default to using the class name if the name is not specified. When was this changed upstream? I tried looking but couldn't find a direct cause for it.
No idea what changed, but it seems clear the order can change either from where we set them or grab them so getting by name seems safer
I did print all the names and there are no duplicates, given this is a test, it seems it would be up to whoever is re-writing the test and adding duplicate forces names to not do that. |
RE: Our dev meeting, I'm going to see what prints out on CI to see what the order is for OpenMM 7.7 and Nightly |
Nightly the order is:
On openMM 7.7.0
I have no idea why it changes. |
@mikemhenry : Hmm very strange. Is it worth opening an issue in openmm about this to see what may have changed in the nightly? |
Looks like I had to fix another hard-coded force index. Not sure if I should fix all of them or just the ones that are giving us problems. |
@mikemhenry : Maybe would be best to fix all of them? |
Let's fix anything that used a hard-coded force index. |
The nightlys are still failing here.
|
@zhang-ivy That is a different issue #993 (which I would love ideas on how to fix/what you think might be causing it, there is a TODO that looks like it could be the solution, but I wonder if there is some regression causing us to get different energies now) |
@mikemhenry I agree, it is a different issue. This one should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Ah thanks! I didn’t notice that issue before
On May 12, 2022, at 15:51, Mike Henry ***@***.***> wrote:
Merged #976<#976> into main.
—
Reply to this email directly, view it on GitHub<#976 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIPGJCTMKQBPB7XMGPL66VLVJVOLFANCNFSM5SD4A7AQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Description
While working on #949 I found that we were grabbing forces by index, and it seems some changes to openmm changed the order of these forces, causing errors. See https://github.com/choderalab/perses/pull/953/files#issuecomment-1083962468
Motivation and context
Resolves #???
How has this been tested?
Change log