Skip to content

Re-create SMIRNOFF force field from tensor force field - #166

Merged
mattwthompson merged 6 commits into
mainfrom
smirnoff-to-tensors
Sep 24, 2026
Merged

mattwthompson merged 6 commits into
mainfrom
smirnoff-to-tensors

Conversation

@mattwthompson

@mattwthompson mattwthompson commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Closes #146

Tests

  • Perturb parameter in a section, compare result
    • vdW
    • Bonds
    • Angles
    • Proper torsions
    • Improper torsions
    • Electrostatics skipping this
    • Virtual sites
  • Un-modified force field is returned un-modified
  • Double round-trip through conversions

@codecov-commenter

codecov-commenter commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.37%. Comparing base (0b3a51a) to head (debfbf0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   81.29%   81.37%   +0.08%     
==========================================
  Files          55       56       +1     
  Lines        5041     5064      +23     
==========================================
+ Hits         4098     4121      +23     
  Misses        943      943              

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

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.

Copilot review overview

🟢 Approval recommended

The core implementation and tests look sound, with only minor cleanup issues (unused import, debug print, typos) remaining.

Review effort: Lite
Findings: 3 Low severity

Open (3)
What changed in this PR

Adds a converter that reconstructs a SMIRNOFF openff.toolkit.ForceField from a tyff.TensorForceField, using an existing ForceField as the template (addressing #146 and enabling round-trips between tensor and SMIRNOFF representations).

Changes:

  • Added convert_tensor_force_field(...) to write tensor parameter values back onto a deepcopy of an input SMIRNOFF ForceField (skipping electrostatics and not yet supporting v-sites).
  • Exported the new converter from tyff.converters.
  • Added tests covering no-op conversion, double round-trip stability, and parameter perturbation round-trips (with an explicit v-site unsupported case).
File Description
tyff/​converters/​openff/​_tensors.py Implements tensor → SMIRNOFF conversion by applying tensor parameters onto a template ForceField.
tyff/​converters/​__init__.py Exposes convert_tensor_force_field at the tyff.converters API surface.
tyff/​_tests/​convertors/​openff/​test_tensors.py Adds test coverage for round-trips, perturbations, and v-site unsupported behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tyff/_tests/convertors/openff/test_tensors.py Outdated
Comment thread tyff/_tests/convertors/openff/test_tensors.py Outdated
Comment thread tyff/converters/openff/_tensors.py Outdated
Corrected comment for clarity and removed debug print statement.

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 24, 2026 21:56
@mattwthompson
mattwthompson merged commit 727332b into main Sep 24, 2026
5 checks passed
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.

Create SMIRNOFF FF from TensorForceField

3 participants