-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b8c4e7
commit 3b752ff
Showing
8 changed files
with
95 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from typing import Annotated | ||
|
||
from openff.interchange._annotations import ( | ||
_dimensionality_validator_factory, | ||
_DimensionlessQuantity, | ||
_DistanceQuantity, | ||
quantity_json_serializer, | ||
quantity_validator, | ||
) | ||
from openff.toolkit import Quantity | ||
from pydantic import AfterValidator, WrapSerializer, WrapValidator | ||
|
||
__all__ = ( | ||
"_InverseDistanceQuantity", | ||
"_DistanceQuantity", | ||
"_DimensionlessQuantity", | ||
"_kJMolNanometerQuantity", | ||
) | ||
|
||
( | ||
_is_inverse_distance, | ||
_is_kj_mol_nanometer, | ||
) = ( | ||
_dimensionality_validator_factory(unit=_unit) | ||
for _unit in [ | ||
"nanometer ** -1", | ||
"kilojoules_per_mole * nanometer ** -1", | ||
] | ||
) | ||
|
||
_InverseDistanceQuantity = Annotated[ | ||
Quantity, | ||
WrapValidator(quantity_validator), | ||
AfterValidator(_is_inverse_distance), | ||
WrapSerializer(quantity_json_serializer), | ||
] | ||
|
||
_kJMolNanometerQuantity = Annotated[ | ||
Quantity, | ||
WrapValidator(quantity_validator), | ||
AfterValidator(_is_kj_mol_nanometer), | ||
WrapSerializer(quantity_json_serializer), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters