# openforcefield.typing.engines.smirnoff.parameters.IndexedParameterAttribute

class `openforcefield.typing.engines.smirnoff.parameters.``IndexedParameterAttribute`(default=<class 'openforcefield.typing.engines.smirnoff.parameters.ParameterAttribute.UNDEFINED'>, unit=None, converter=None)

  The attribute of a parameter with an unspecified number of terms.

  Some parameters can be associated to multiple terms, For example, torsions have parameters such as k1, k2, …, and `IndexedParameterAttribute` can be used to encapsulate the sequence of terms.

  The only substantial difference with `ParameterAttribute` is that only sequences are supported as values and converters and units are checked on each element of the sequence.

  Currently, the descriptor makes the sequence immutable. This is to avoid that an element of the sequence could be set without being properly validated. In the future, the data could be wrapped in a safe list that would safely allow mutability.

  Parameters
    default object, optional

      When specified, the descriptor makes this attribute optional by attaching a default value to it.

    unit simtk.unit.Quantity, optional

      When specified, only sequences of quantities with compatible units are allowed to be set.

    converter callable, optional

      An optional function that can be used to validate and cast each element of the sequence before setting the attribute.

  See also

  `ParameterAttribute`

    A simple parameter attribute.

  Examples

  Create an optional indexed attribute with unit of angstrom.

      >>> from simtk import unit
      >>> class MyParameter:
      ...     length = IndexedParameterAttribute(default=None, unit=unit.angstrom)
      ...
      >>> my_par = MyParameter()
      >>> my_par.length is None
      True

  Strings are parsed into Quantity objects.

      >>> my_par.length = ['1 * angstrom', 0.5 * unit.nanometer]
      >>> my_par.length[0]
      Quantity(value=1, unit=angstrom)

  Similarly, custom converters work as with `ParameterAttribute`, but they are used to validate each value in the sequence.

      >>> class MyParameter:
      ...     attr_indexed = IndexedParameterAttribute(converter=float)
      ...
      >>> my_par = MyParameter()
      >>> my_par.attr_indexed = [1, '1.0', '1e-2', 4.0]
      >>> my_par.attr_indexed
      [1.0, 1.0, 0.01, 4.0]

  Attributes
    name

  Methods

  `UNDEFINED`() | Custom type used by `ParameterAttribute` to differentiate between `None` and undeclared default.
  `converter`(self, converter) | Create a new ParameterAttribute with an associated converter.

  `__init__`(self, default=<class 'openforcefield.typing.engines.smirnoff.parameters.ParameterAttribute.UNDEFINED'>, unit=None, converter=None)

    Initialize self. See help(type(self)) for accurate signature.

  Methods

  `__init__`(self[, default, unit, converter]) | Initialize self.
  `converter`(self, converter) | Create a new ParameterAttribute with an associated converter.

  Attributes

  `name` |