Re-create SMIRNOFF force field from tensor force field - #166
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
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.
Corrected comment for clarity and removed debug print statement. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Closes #146
Tests
Electrostaticsskipping this