Add examples - #15
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
==========================================
+ Coverage 98.79% 98.94% +0.15%
==========================================
Files 35 35
Lines 3317 3317
==========================================
+ Hits 3277 3282 +5
+ Misses 40 35 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
j-wags
left a comment
There was a problem hiding this comment.
Two straightforward-to-resolve blocking comments, other than that this is good to go!
| base-py312 = ["py312", "openeye", "ambertools", "test", "typing"] | ||
| base-py313 = ["py313", "openeye", "ambertools", "test", "typing"] | ||
| mm-py312 = ["py312", "ambertools", "mm", "test", "typing"] | ||
| mm-py313 = ["py313", "ambertools", "mm", "test", "typing"] | ||
| mm-py312 = ["py312", "openeye", "ambertools", "mm", "test", "typing"] | ||
| mm-py313 = ["py313", "openeye", "ambertools", "mm", "test", "typing"] | ||
| examples-py312 = ["py312", "mm", "openeye", "examples", "test", "typing"] | ||
| examples-py313 = ["py313", "mm", "openeye", "examples", "test", "typing"] |
There was a problem hiding this comment.
(blocking) All examples envs now contain openeye. Should there be a permutation that tests a no-openeye stack?
There was a problem hiding this comment.
For the record this is mostly because of the AmberTools + Packmol packaging conflict, not trying to make anything OpenEye-dependent
| * [Evaluating the energy of a water dimer with virtual sites](compute-energy.ipynb) | ||
| * [Minimizing the conformer of a molecule](conformer-minimization.ipynb) | ||
| * [Computing the gradient of the energy w.r.t. force field parameters](parameter-gradients.ipynb) | ||
| * [Registering custom parameter handlers](custom-handler.ipynb) |
There was a problem hiding this comment.
(blocking) This notebook doesn't exist.
|
|
||
| [tasks] | ||
| test = "python -m pytest -n auto --cov=fitlib --cov-append --cov-report=xml --color=yes fitlib/_tests/" | ||
| # doesn't include examples/md-simulations.ipynb, should it? |
There was a problem hiding this comment.
(not blocking) Since it isn't present in the smee testing configuration I don't think this is a blocker to this PR, though it could be a good issue to open longer term.
|
Thanks for the comments - I need to be more careful with this and I'll give it a closer look |
|
Fat-fingered that Copilot review request, which I seemingly can neither cancel nor delete (?!) |
There was a problem hiding this comment.
🟡 Changes recommended
It introduces CI-breaking / workflow-breaking issues (broken README link, Ruff unused import, missing explicit openff-interchange dep, and OE license step not guarded for fork PRs).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR ports example notebooks into fitlib and wires them into the developer workflow (pixi tasks + CI) so the examples can be executed as part of validation.
Changes:
- Add an
examples/folder with multiple Jupyter notebooks demonstrating commonfitlibworkflows. - Add pixi “examples” environments and a CI job matrix entry to execute example notebooks.
- Update dependency pins / CI and adjust tests to skip when optional
NNPOpsis unavailable.
File summaries
| File | Description |
|---|---|
pixi.toml |
Adds test-examples task, new examples feature/envs, and updates core deps. |
fitlib/_tests/potentials/test_potentials.py |
Adds NNPOps import skip and an extra fitlib.mm import inside a test. |
fitlib/_tests/potentials/test_nonbonded.py |
Skips tests when NNPOps is missing. |
examples/README.md |
Adds a top-level index of available example notebooks. |
examples/compute-energy.ipynb |
New example: compute water dimer energies and compare TIP3P vs TIP4P(-FB). |
examples/conformer-minimization.ipynb |
New example: minimize a molecule conformer via PyTorch autodiff. |
examples/parameter-gradients.ipynb |
New example: compute gradients w.r.t. FF parameters. |
examples/md-simulations.ipynb |
New example: differentiable ensemble averages from MD trajectories. |
.pre-commit-config.yaml |
Bumps ruff-pre-commit and pyproject-fmt revisions. |
.github/workflows/ci.yaml |
Adds examples to the matrix, runs notebook execution, and tweaks OE licensing step. |
Review details
- Files reviewed: 10/11 changed files
- Comments generated: 7
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "# move the force field to the GPU for faster processing of the simulation\n", | ||
| "# trajectories - the system and force field must be on the same device.\n", | ||
| "tensor_ff = tensor_ff.to(\"cuda\")" | ||
| ] |
| def test_energy_backward_pass(periodic): | ||
| import fitlib.mm |
| openff-toolkit = "0.19.*" | ||
| pytorch = "*" |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This reverts commit 45fbc3f.
Closes #13