-
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
Changes from 15 commits
99933ab
7128362
d8da81e
272fb39
e5bb131
0d62054
dcf82b3
6d80bba
63c09e9
d7df8de
3aef84c
1f5c393
b6ba7bd
ef08138
4e9836b
5c6f7bc
a41cbe6
956809c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably have a |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,8 @@ class Bond(Connection): | |
|
|
||
| __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 commentThe reason will be displayed to describe this comment to others. Learn more. Same as in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. |
||
|
|
||
| connection_members_: Tuple[Atom, Atom] = Field( | ||
| ..., | ||
| description="The 2 atoms involved in the bond.", | ||
|
|
@@ -46,12 +48,20 @@ class Bond(Connection): | |
| """, | ||
| alias="restraint", | ||
| ) | ||
|
|
||
| bond_order_: Optional[float] = Field( | ||
| default=None, | ||
| description="Bond order of this bond.", | ||
| alias="bond_order", | ||
| ) | ||
|
|
||
| model_config = ConfigDict( | ||
| alias_to_fields=dict( | ||
| **Connection.model_config["alias_to_fields"], | ||
| **{ | ||
| "bond_type": "bond_type_", | ||
| "restraint": "restraint_", | ||
| "bond_order": "bond_order_", | ||
| }, | ||
| ) | ||
| ) | ||
|
|
@@ -71,6 +81,16 @@ def restraint(self): | |
| """Return the restraint of this bond.""" | ||
| return self.__dict__.get("restraint_") | ||
|
|
||
| @property | ||
| def bond_order(self): | ||
| """Return the bond_order of this bond.""" | ||
| return self.__dict__.get("bond_order_") | ||
|
|
||
| @bond_order.setter | ||
| def bond_order(self, order): | ||
| """Set the bond_order of this bond.""" | ||
| self._bond_order = order | ||
|
|
||
| def equivalent_members(self): | ||
| """Get a set of the equivalent connection member tuples. | ||
|
|
||
|
|
||
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?
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 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.
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.
So also no alias here.