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

Bases: DefaultModel

Base class for storing parametrized force field data.

field type: str [Required]

The type of potentials this handler stores.

field expression: str [Required]

The analytical expression governing the potentials in this handler.

field slot_map: Dict[TopologyKey, PotentialKey] = {}

A mapping between TopologyKey objects and PotentialKey objects.

field potentials: Dict[PotentialKey, Union[Potential, WrappedPotential]] = {}

A mapping between PotentialKey objects and Potential objects.

property independent_variables: Set[str]

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

store_matches(parameter_handler: ParameterHandler, topology: Topology) None[source]

Populate self.slot_map with key-val pairs of [TopologyKey, PotentialKey].

store_potentials(parameter_handler: ParameterHandler) None[source]

Populate self.potentials with key-val pairs of [PotentialKey, Potential].

get_force_field_parameters(use_jax: bool = False) ArrayLike[source]

Return a flattened representation of the force field parameters.

set_force_field_parameters(new_p: ArrayLike) None[source]

Set the force field parameters from a flattened representation.

get_system_parameters(p=None, use_jax: bool = False) ndarray[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) ndarray[source]

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


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

get_param_matrix() DeviceArray[source]

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