-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add "canary" workflow for HMR simulations [WIP] #22
Conversation
891d497
to
a79c760
Compare
This will be a little tricky to review, let me try to provide the necessary context:
|
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 is so cool! I think NaNs aren't being caught properly, but an uncaught NaN is still an informative canary, so it's up to you whether to try and catch them. Also, I don't think these sims are actually running for 10ps (rather they're still just at 2), so I left a comment on that.
Before you merge, could you modify step 2 of the release process to include the best way of running the canaries, and the criteria for blocking/not blocking the release? I think it will look like "ensure the new FF was tested by looking for these lines, and then ensure that no tests failed"
"rigidWater": True, | ||
"removeCMMotion": False, | ||
"hydrogenMass": 4 | ||
* unit.amu, # Does this also _subtract_ mass from heavy atoms?:w |
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.
I think so. So carbons get really light sometimes.
canary/scripts/test_hmr.py
Outdated
context.setPositions(mol.conformers[0]) | ||
|
||
# Run for 10 ps | ||
integrator.step(500) |
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 is only 2ps
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.
Also, here's where we could put the try
/except
to catch NaN
s from the simulation.
for mol in hmr_mols: | ||
try: | ||
hmr_driver(mol, ff_name) | ||
except NANEnergyError: |
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.
On linux, NaN
failures don't seem to be getting caught. Not a huge deal since failing is the whole point of the canary, but it may be helpful to make it so that multiple NaNs can be caught and a summary of failures can be shown to users.
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.
Unfortunately, we run into one of those "un-Pythonic" behaviors in OpenMM, as the triggered exception cannot be caught.
>>> from simtk.openmm import OpenMMException
>>> try:
... raise OpenMMException
... except OpenMMException:
... print('caught!')
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: exceptions must derive from BaseException
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
TypeError: catching classes that do not inherit from BaseException is not allowed
I can just catch it later, but not with the specificity we'd normally prefer (catching more than less is better for these tests, anyway):
(test) root@af8cfd33010c:/openforcefields# echo openforcefields/offxml/openff-1.2.0.offxml | python canary/scripts/test_hmr.py -vs
Warning: Unable to load toolkit 'OpenEye Toolkit'. The Open Force Field Toolkit does not require the OpenEye Toolkits, and can use RDKit/AmberTools instead. However, if you have a valid license for the OpenEye Toolkits, consider installing them for faster performance and additional file format support: https://docs.eyesopen.com/toolkits/python/quickstart-python/linuxosx.html OpenEye offers free Toolkit licenses for academics: https://www.eyesopen.com/academic-licensing
[16:05:40] WARNING: no name column found on line 0
[16:05:40] WARNING: no name column found on line 1
Running HMR with force field openff-1.2.0 and molecule with SMILES [H][C]#[C][C]([H])([H])[H]
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
Running HMR with force field openff-1.2.0 and molecule with SMILES [H][c]1[c]([H])[c]([H])[c]([C]#[C][C]([H])([H])[H])[c]([H])[c]1[H]
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
/bin/bash: /opt/conda/envs/test/lib/libtinfo.so.6: no version information available (required by /bin/bash)
Traceback (most recent call last):
File "canary/scripts/test_hmr.py", line 94, in <module>
raise HMRCanaryError(failed_runs)
__main__.HMRCanaryError: [[Molecule with name '' and SMILES '[H][C]#[C][C]([H])([H])[H]', 'openff-1.2.0', 'NaN Position(s)'], [Molecule with name '' and SMILES '[H][c]1[c]([H])[c]([H])[c]([C]#[C][C]([H])([H])[H])[c]([H])[c]1[H]', 'openff-1.2.0', 'NaN Position(s)']]
All canary tests failing in 372a96a, rolling back the bad OFFXML and merging |
The 1.2.0 OFFXML was used just for testing, as it needed to mimic a new file that not tracked by git on the master branch
Resolves #21
What the script looks like in action: