gufe.settings.typing

Custom types that inherit from openff.units.Quantity and are pydantic-compatible.

Module Attributes

GufeQuantity

Pydantic type inherits from openff.units.Quantity but serializes in a gufe-compatible way.

GufeArrayQuantity

Convert to a pint.Quantity array, if possible.

NanometerQuantity

Pydantic type that requires a pint.Quantity compatible with nanometers.

BarQuantity

Pydantic type that requires a pint.Quantity compatible with bar.

KelvinQuantity

Pydantic type that requires a pint.Quantity compatible with kelvin.

NanosecondQuantity

Pydantic type that requires a pint.Quantity compatible with nanoseconds.

PicosecondQuantity

Pydantic type that requires a pint.Quantity compatible with picoseconds.

AngstromQuantity

Pydantic type that requires a pint.Quantity compatible with angstroms.

KCalPerMolQuantity

Pydantic type that requires a pint.Quantity compatible with kilocalorie_per_mole.

VoltsQuantity

Pydantic type that requires a pint.Quantity compatible with volts.

NanometerArrayQuantity

Pydantic type that requires an array of pint.Quantity compatible with nanometer.

BoxQuantity

Pydantic type that requires a 3x3 or 3x1 array of pint.Quantity values compatible with nanometers.

Functions

specify_quantity_units(unit_name)

Helper function for generating custom quantity types.

gufe.settings.typing.GufeQuantity

Pydantic type inherits from openff.units.Quantity but serializes in a gufe-compatible way.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always)]

gufe.settings.typing.GufeArrayQuantity

Convert to a pint.Quantity array, if possible.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=_is_array)]

gufe.settings.typing.specify_quantity_units(unit_name: str) AfterValidator

Helper function for generating custom quantity types.

Parameters:

unit_name (str) – unit name to validate against (e.g. ‘nanometer’)

Returns:

An AfterValidator for defining a custom Quantity type.

Return type:

AfterValidator

gufe.settings.typing.NanometerQuantity

Pydantic type that requires a pint.Quantity compatible with nanometers. Input will be converted to nanometers upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’nanometer’, convert=True))]

gufe.settings.typing.BarQuantity

Pydantic type that requires a pint.Quantity compatible with bar. Input will be converted to bar upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’bar’, convert=True))]

gufe.settings.typing.KelvinQuantity

Pydantic type that requires a pint.Quantity compatible with kelvin. Input will be converted to kelvin upon model validation. Note: to define input in Celsius, you must use Quantity explicitly, e.g. openff.units.Quantity(25, "celsius") instead of 25 * unit.celsius. See https://pint.readthedocs.io/en/stable/user/nonmult.html for more information.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’kelvin’, convert=True))]

gufe.settings.typing.NanosecondQuantity

Pydantic type that requires a pint.Quantity compatible with nanoseconds. Input will be converted to nanoseconds upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’nanosecond’, convert=True))]

gufe.settings.typing.PicosecondQuantity

Pydantic type that requires a pint.Quantity compatible with picoseconds. Input will be converted to picoseconds upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’picosecond’, convert=True))]

gufe.settings.typing.AngstromQuantity

Pydantic type that requires a pint.Quantity compatible with angstroms. Input will be converted to angstroms upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’angstrom’, convert=True))]

gufe.settings.typing.KCalPerMolQuantity

Pydantic type that requires a pint.Quantity compatible with kilocalorie_per_mole. Input will be converted to kilocalorie_per_mole upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’kilocalorie_per_mole’, convert=True))]

gufe.settings.typing.VoltsQuantity

Pydantic type that requires a pint.Quantity compatible with volts. Input will be converted to volts upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’volts’, convert=True))]

gufe.settings.typing.NanometerArrayQuantity

Pydantic type that requires an array of pint.Quantity compatible with nanometer. Input will be converted to nanometers upon model validation.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=_is_array), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’nanometer’, convert=True))]

gufe.settings.typing.BoxQuantity

Pydantic type that requires a 3x3 or 3x1 array of pint.Quantity values compatible with nanometers. Input will be converted to nanometer upon model validation. If input is a 3x1 array, it will be converted to 3x3 diagonal array with zeroes on the off-diagonal.

alias of Annotated[Quantity, FieldInfo(annotation=NoneType, required=True, validate_default=True), PlainValidator(func=_plain_quantity_validator, json_schema_input_type=Any), WithJsonSchema(json_schema={‘type’: ‘number’}, mode=None), PlainSerializer(func=_plain_quantity_serializer, return_type=PydanticUndefined, when_used=always), AfterValidator(func=functools.partial(<function _has_compatible_dimensionality>, unit=’nanometer’, convert=True)), AfterValidator(func=_is_box_shape)]