class openff.toolkit.typing.engines.smirnoff.parameters.MappedParameterAttribute(default=UNDEFINED, unit=None, converter=None, docstring='')[source]

The attribute of a parameter in which each term is a mapping.

The substantial difference with IndexedParameterAttribute is that, unlike indexing, the mapping can be based on artbitrary references, like indices but can starting at non-zero values and include non-adjacent keys.

  • default (object, optional) – When specified, the descriptor makes this attribute optional by attaching a default value to it.

  • unit (openmm.unit.Quantity, optional) – When specified, only sequences of mappings where values are quantities with compatible units are allowed to be set.

  • converter (callable, optional) – An optional function that can be used to validate and cast each component of each element of the sequence before setting the attribute.

See also


A parameter attribute representing a sequence.


A parameter attribute representing a sequence, each term of which is a mapping.


Create an optional indexed attribute with unit of angstrom.

>>> from openmm import unit
>>> class MyParameter:
...     length = MappedParameterAttribute(default=None, unit=unit.angstrom)
>>> my_par = MyParameter()
>>> my_par.length is None

Like other ParameterAttribute objects, strings are parsed into Quantity objects.

>>> my_par.length = {1:'1.5 * angstrom', 2: '1.4 * angstrom'}
>>> my_par.length[1]
Quantity(value=1.5, unit=angstrom)

Unlike other ParameterAttribute objects, the reference points can do not need ot be zero-indexed, non-adjancent, such as interpolating defining a bond parameter for interpolation by defining references values and bond orders 2 and 3:

>>> my_par.length = {2:'1.42 * angstrom', 3: '1.35 * angstrom'}
>>> my_par.length[2]
Quantity(value=1.42, unit=angstrom)
__init__(default=UNDEFINED, unit=None, converter=None, docstring='')


__init__([default, unit, converter, docstring])


Create a new ParameterAttribute with an associated converter.




Custom type used by ParameterAttribute to differentiate between None and undeclared default.


Create a new ParameterAttribute with an associated converter.

This is meant to be used as a decorator (see main examples).