Not only querying, but also modifying system parameters#18
Not only querying, but also modifying system parameters#18peastman merged 14 commits intoopenmm:mainfrom
Conversation
in the same manner as in Espaloma
|
cross-ref: #12 |
peastman
left a comment
There was a problem hiding this comment.
These notebooks have a lot of overlap with existing ones. There's already a cookbook entry on inspecting system parameters. Is there a good reason to have two on the same thing? The other notebook is esoteric and sort of out of scope: using OpenMM to validate your own MD code that you've written separately. Mostly that isn't about OpenMM. The only part that's really about OpenMM is the discussion of how to query energy components, but we already have a cookbook entry on that.
| "Some machine learning force field construction schemes, such as [Espaloma](https://pubs.rsc.org/en/content/articlehtml/2022/sc/d2sc02739a), would output parameters which can be picked up by the parameter-holding `System` object of OpenMM, which could be further used in molecular dynamics (MD) simulations just like a vanilla `System`.\n", | ||
| "In this tutorial, we show how you can modify the parameters of `System` object so you can write your own machine learning force field API.\n", | ||
| "\n", | ||
| "This example is inspired by the [Espaloma deployment](https://github.com/choderalab/espaloma/blob/master/espaloma/graphs/deploy.py) implementation." |
There was a problem hiding this comment.
This description is overly specific. Nothing in this notebook is really specific to machine learning. You're just showing how to examine and change the parameters in a System. How about something like this?
Sometimes it is useful to examine the parameters in a System. For example, you might want to check what parameters a ForceField has assigned to a particular bond or angle. In other cases you may want to modify those parameters to make a bond behave differently from what the ForceField assigned.
|
@peastman how about I get rid of the separate "modify the parameters" one and simply append the existing "query the parameters" tutorial with ways to modify them in-place. For the other one, I have seen so many people trying to using OpenMM to benchmark their own MM implementations. I feel like the community would benefit from a tutorial. |
|
see 38035e4 where I combined the modifying parameter tutorial with the querying parameter tutorial |
|
I think the setting different parameters is a good addition to the existing cookbook entry! I think as you have suggested the notebook for "Use OpenMM to Verify Your MM Functional Form Implementation" should be a separate tutorial. Can you remove it from this PR and make a new PR adding that as a tutorial, we can then review it properly in the new PR. |
|
@sef43 I've made the changes as requested. Will follow up with another PR for the separate notebook. |
|
Separated PR here: #22 |
peastman
left a comment
There was a problem hiding this comment.
Looks good! I made a few very minor suggestions.
|
I just realized it's missing one very important part. Let's add the following at the end.
|
|
@peastman I've made the changes per your suggestions. I've also added the code to modify existing |
| " bonded.setBondParameters(\n", | ||
| " i, particle1, particle2, length, \n", | ||
| " 2666 * unit.kilojoules_per_mole/unit.nanometer**2\n", | ||
| " )" |
There was a problem hiding this comment.
No need to split this onto four lines. It makes the code less readable, and it can easily fit on a single line.
There was a problem hiding this comment.
Sure! If we don't worry about the 80 char limit.
There was a problem hiding this comment.
If someone wants to view the entry on a VT52 terminal, I admit it will be inconvenient. But I think we can say VT100 is the earliest terminal we support. :)
|
I've updated the PR accordingly. |
|
Just one unnecessary line that still needs to be removed. Then I think it will be ready to merge. |
Sorry which unnecessary line? |
bonded = [f for f in system.getForces() if isinstance(f, HarmonicBondForce)][0] |
|
Looks good. Thanks! |
Uh oh!
There was an error while loading. Please reload this page.