Skip to content

allow valence and nagl parameters#733

Open
lilyminium wants to merge 11 commits intomainfrom
fix-system-subset
Open

allow valence and nagl parameters#733
lilyminium wants to merge 11 commits intomainfrom
fix-system-subset

Conversation

@lilyminium
Copy link
Contributor

Description

Fixes #727 by adding vdW forces to the system_subset and a bunch of tests.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.25%. Comparing base (ed240a6) to head (442261c).
⚠️ Report is 2 commits behind head on main.

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

@lilyminium lilyminium marked this pull request as ready for review February 12, 2026 21:13
@mattwthompson
Copy link
Member

I'd like to briefly table this while we sort out openforcefield/openff-interchange#1431, but probably keep these tests in either way

Copy link
Member

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

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

Approved pending two blocking comments; I'm not asking to re-review but can if you think that would be valuable.

Please also

  • update docstring/comments to the new implementation; IIUC since vdW handlers no longer need to be added when vdW parameters aren't being fit, they shouldn't be added or present in system subsets.
  • add a one-liner in the release notes, doesn't need to be well-formatted

topology=topology,
)

# Should have both bond force and nonbonded force (for vdW)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Should have both bond force and nonbonded force (for vdW)
# Should have bond force and no nonbonded force (for vdW)

I assume this is just an out-of-date comment

Comment on lines +599 to +600
# Create a dummy topology
topology: Topology = Molecule.from_mapped_smiles("[Cl:1][H:2]").to_topology()
Copy link
Member

Choose a reason for hiding this comment

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

(non-blocking) This could be a fixture

Comment on lines +582 to +585
"""Test that vdW handler is automatically included when dealing with Constraints.

This tests the new code addition that includes vdW for valence terms.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Test that vdW handler is automatically included when dealing with Constraints.
This tests the new code addition that includes vdW for valence terms.
"""
"""
Test that no forces exist in a system subset designed for use with (only) constraints.
"""

From the code I assume this is the intended behavior.

(blocking) This seems weird - can you actually fit constraints, or anything, when no forces are added?

topology=topology,
)

# Should have nonbonded force (for vdW) even though we're dealing with constraints
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Should have nonbonded force (for vdW) even though we're dealing with constraints
# Should have no forces since no force-bearing handlers are in this gradient

Comment on lines +616 to +619
"""Test that vdW handler is automatically included when dealing with Angles.

This tests the new code addition that includes vdW for valence terms.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Test that vdW handler is automatically included when dealing with Angles.
This tests the new code addition that includes vdW for valence terms.
"""
"""
Test basic behavior of creating system subsets for angle parameters
"""

Comment on lines +675 to +678
"""Test that vdW handler is automatically included when dealing with ProperTorsions.

This tests the new code addition that includes vdW for valence terms.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Test that vdW handler is automatically included when dealing with ProperTorsions.
This tests the new code addition that includes vdW for valence terms.
"""
"""
Test basic behavior of creating system subsets for torsion parameters from a minimal force field
"""

Comment on lines +719 to +722
"""Test that vdW handler is automatically included when dealing with ImproperTorsions.

This tests the new code addition that includes vdW for valence terms.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Test that vdW handler is automatically included when dealing with ImproperTorsions.
This tests the new code addition that includes vdW for valence terms.
"""
"""
Test basic behavior of creating system subsets for torsion parameters from a "full" force field
"""

)

# The system should be created successfully with NAGL handler registered
assert system.getNumForces() >= 1
Copy link
Member

Choose a reason for hiding this comment

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

(blocking) would like this constraint to be =, I think it should still be 1?

Suggested change
assert system.getNumForces() >= 1
assert system.getNumForces() == 1

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.

Can't re-fit valence parameters in Evaluator, or vsites + NAGL

2 participants