Collection

pydantic model openff.interchange.components.potentials.Collection[source]

Bases: _BaseModel

Base class for storing parametrized force field data.

Fields:
field type: str [Required]

The type of potentials this handler stores.

field is_plugin: bool = False

Whether this collection is defined as a plugin.

field expression: str [Required]

The analytical expression governing the potentials in this handler.

field key_map: dict[TopologyKey | LibraryChargeTopologyKey, PotentialKey] = {}

A mapping between TopologyKey objects and PotentialKey objects.

Constraints:
  • func = <function serialize_key_map at 0x7f0fa9947eb0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = always

field potentials: dict[openff.interchange.models.PotentialKey, typing.Annotated[openff.interchange.components.potentials.Potential | openff.interchange.components.potentials.WrappedPotential, WrapValidator(func=<function validate_potential_or_wrapped_potential at 0x7f0fa99444c0>, json_schema_input_type=PydanticUndefined)]] = {}

A mapping between PotentialKey objects and Potential objects.

Constraints:
  • func = <function serialize_potentials at 0x7f0fa99b4040>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = always

property independent_variables: set[str]

Return a set of variables found in the expression but not in any potentials.

get_force_field_parameters(use_jax: bool = False) _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | jax.Array[source]

Return a flattened representation of the force field parameters.

set_force_field_parameters(new_p: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) None[source]

Set the force field parameters from a flattened representation.

get_system_parameters(p=None, use_jax: bool = False) _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | jax.Array[source]

Return a flattened representation of system parameters.

These values are effectively force field parameters as applied to a chemical topology.

get_mapping() dict[PotentialKey, int][source]

Get a mapping between potentials and array indices.

parametrize(p=None, use_jax: bool = True) _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | jax.Array[source]

Return an array of system parameters, given an array of force field parameters.

parametrize_partial()[source]

Return a function that will call self.parametrize() with arguments specified by self.mapping.

get_param_matrix() _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | jax.Array[source]

Get a matrix representing the mapping between force field and system parameters.