Skip to content

Add examples - #15

Merged
mattwthompson merged 30 commits into
mainfrom
examples
Sep 3, 2026
Merged

Add examples#15
mattwthompson merged 30 commits into
mainfrom
examples

Conversation

@mattwthompson

Copy link
Copy Markdown
Member

Closes #13

@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.94%. Comparing base (2724c4b) to head (f902f0a).

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     
Flag Coverage Δ
unittests 98.94% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mattwthompson

Copy link
Copy Markdown
Member Author

pixi run -e examples-py313 test passes for me locally, not sure why it's failing in CI

@mattwthompson
mattwthompson marked this pull request as ready for review September 1, 2026 19:50

@j-wags j-wags left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two straightforward-to-resolve blocking comments, other than that this is good to go!

Comment thread fitlib/_tests/potentials/test_potentials.py Outdated
Comment thread pixi.toml Outdated
Comment on lines +120 to +125
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"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(blocking) All examples envs now contain openeye. Should there be a permutation that tests a no-openeye stack?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For the record this is mostly because of the AmberTools + Packmol packaging conflict, not trying to make anything OpenEye-dependent

Comment thread examples/README.md Outdated
* [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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(blocking) This notebook doesn't exist.

Comment thread pixi.toml Outdated

[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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(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.

@mattwthompson

Copy link
Copy Markdown
Member Author

Thanks for the comments - I need to be more careful with this and I'll give it a closer look

@mattwthompson

Copy link
Copy Markdown
Member Author

Fat-fingered that Copilot review request, which I seemingly can neither cancel nor delete (?!)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 common fitlib workflows.
  • 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 NNPOps is 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.

Comment thread .github/workflows/ci.yaml
Comment on lines +41 to +44
"# 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\")"
]
Comment on lines +246 to +247
def test_energy_backward_pass(periodic):
import fitlib.mm
Comment thread pixi.toml
Comment on lines +26 to 27
openff-toolkit = "0.19.*"
pytorch = "*"
Comment thread examples/README.md
Comment thread examples/parameter-gradients.ipynb Outdated
Comment thread pixi.toml Outdated
mattwthompson and others added 8 commits September 3, 2026 12:29
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>
@mattwthompson
mattwthompson marked this pull request as ready for review September 3, 2026 19:42
@mattwthompson
mattwthompson merged commit 94b00d8 into main Sep 3, 2026
13 checks passed
@mattwthompson
mattwthompson deleted the examples branch September 3, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port examples

4 participants