-
Notifications
You must be signed in to change notification settings - Fork 37
Bonds and Angles handle wildcards for bonds and sites. #928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
return f"<{self.__class__.__name__} {self.name}, id: {id(self)}> " | ||
|
||
def get_connection_identifiers(self): | ||
from gmso.core.bond import Bond |
Check notice
Code scanning / CodeQL
Cyclic import Note
gmso.core.bond
def _get_virtual_type( | ||
self, atom_types, return_match_order=False, exact_match=False | ||
): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #928 +/- ##
==========================================
- Coverage 94.17% 93.89% -0.29%
==========================================
Files 67 67
Lines 7536 7646 +110
==========================================
+ Hits 7097 7179 +82
- Misses 439 467 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
|
||
@bonds.setter | ||
def bonds(self, bonds): | ||
"""Return the bonds that makeup this Improper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these doc strings aren't correct for this setter method?
|
||
@model_validator(mode="before") | ||
@classmethod | ||
def set_dependent_value_default(cls, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a concise doc string for this method would be helpful.
|
||
__members_creator__: ClassVar[Callable] = Atom.model_validate | ||
|
||
connectivity: ClassVar[Tuple[Tuple[int]]] = ((0, 1),) |
There was a problem hiding this comment.
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?
|
||
@property | ||
def bonds(self): | ||
"""Return the bond_order symbol of this bond.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the doc string to say that it returns a tuple of gmso.core.Bond
instances that make up this angle.
|
||
@bonds.setter | ||
def bonds(self, bonds): | ||
"""Return the bonds that makeup this Improper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update doc strings here.
|
||
@model_validator(mode="before") | ||
@classmethod | ||
def set_dependent_value_default(cls, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a concise doc string for this method would be helpful.
|
||
@model_validator(mode="before") | ||
@classmethod | ||
def set_dependent_value_default(cls, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a concise doc string for this method would be helpful.
|
||
@bonds.setter | ||
def bonds(self, new_bonds): | ||
"""Return the bonds that makeup this Improper. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the doc strings here.
return virtual_type_graph | ||
|
||
|
||
def create_pattern(combination): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick doc string here would be helpful.
raise MissingPotentialError(msg) | ||
|
||
def _get_angle_type(self, atom_types, return_match_order=False, warn=False): | ||
for i in range(1, 3): |
There was a problem hiding this comment.
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--.
This PR will not work until mosdef-hub/foyer#640 is completed. |
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