Skip to content

Conversation

@CalCraven
Copy link
Contributor

@CalCraven CalCraven commented Sep 24, 2025

PR Summary:

This PR should allow for matching of forcefield connection parameters for Bonds and Angles. This was already usable with Dihedrals, the functionality has just been extended to dihedrals using the "*" syntax.

Additionally, the ability to match connections by the bond_order of the internal bonds of the connection is also included, using the "~" syntax to designate wildcard bonds, and the SMILES tokens for single, double, triple, and aromatic bonds.

PR Checklist


  • Includes appropriate unit test(s)
  • Appropriate docstring(s) are added/updated
  • Code is (approximately) PEP8 compliant
  • Issue(s) raised/addressed?

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 85.08772% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.93%. Comparing base (e054116) to head (956809c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
gmso/core/forcefield.py 79.31% 24 Missing ⚠️
gmso/utils/misc.py 33.33% 6 Missing ⚠️
gmso/core/angle.py 94.11% 1 Missing ⚠️
gmso/core/bond.py 87.50% 1 Missing ⚠️
gmso/core/dihedral.py 94.11% 1 Missing ⚠️
gmso/core/improper.py 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #928      +/-   ##
==========================================
- Coverage   94.20%   93.93%   -0.27%     
==========================================
  Files          67       67              
  Lines        7591     7668      +77     
==========================================
+ Hits         7151     7203      +52     
- Misses        440      465      +25     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@chrisjonesBSU chrisjonesBSU left a comment

Choose a reason for hiding this comment

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

I left some comments, mostly related to doc strings. So far this is looking great. I'll try and get some minimal working examples going to further test it out.


__members_creator__: ClassVar[Callable] = Atom.model_validate

connectivity: ClassVar[Tuple[Tuple[int]]] = ((0, 1), (1, 2))
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a description here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, do we need an alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I specified connectivity as a ClassVar, so it's not modifiable across classes, and doesn't get treated the same way as other pydantic variables, which are defined under with pydantic Field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So also no alias here.


__members_creator__: ClassVar[Callable] = Atom.model_validate

connectivity: ClassVar[Tuple[Tuple[int]]] = ((0, 1),)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as in angle.py. Do we need a description and alias here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above.

raise MissingPotentialError(msg)

def _get_angle_type(self, atom_types, return_match_order=False, warn=False):
for i in range(1, 3):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: This masking schema won't work, should try masking outside in, i.e. -opls_135- should be masked before opls_135--.

@CalCraven
Copy link
Contributor Author

This PR will not work until mosdef-hub/foyer#640 is completed.

@CalCraven CalCraven mentioned this pull request Oct 30, 2025
4 tasks
@CalCraven CalCraven merged commit 4201b26 into mosdef-hub:main Oct 30, 2025
12 of 14 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.

2 participants