ConstraintType

class openff.toolkit.typing.engines.smirnoff.parameters.ConstraintType(smirks, allow_cosmetic_attributes=False, **kwargs)

A SMIRNOFF constraint type

Warning

This API is experimental and subject to change.

__init__(smirks, allow_cosmetic_attributes=False, **kwargs)

Create a ParameterType.

Parameters:
  • smirks – The SMIRKS match for the provided parameter type.

  • allow_cosmetic_attributes – Whether to permit non-spec kwargs (“cosmetic attributes”). If True, non-spec kwargs will be stored as an attribute of this parameter which can be accessed and written out. Otherwise an exception will be raised.

Methods

__init__(smirks[, allow_cosmetic_attributes])

Create a ParameterType.

add_cosmetic_attribute(attr_name, attr_value)

Add a cosmetic attribute to this object.

attribute_is_cosmetic(attr_name)

Determine whether an attribute of this object is cosmetic.

delete_cosmetic_attribute(attr_name)

Delete a cosmetic attribute from this object.

to_dict([discard_cosmetic_attributes, ...])

Convert this object to dict format.

Attributes

distance

id

parent_id

smirks

add_cosmetic_attribute(attr_name, attr_value)

Add a cosmetic attribute to this object.

This attribute will not have a functional effect on the object in the OpenFF Toolkit, but can be written out during output.

Warning

The API for modifying cosmetic attributes is experimental and may change in the future (see issue #338).

Parameters:
  • attr_name – Name of the attribute to define for this object.

  • attr_value – The value of the attribute to define for this object.

attribute_is_cosmetic(attr_name)

Determine whether an attribute of this object is cosmetic.

Warning

The API for modifying cosmetic attributes is experimental and may change in the future (see issue #338).

Parameters:

attr_name – The attribute name to check

Returns:

is_cosmetic – Returns True if the attribute is defined and is cosmetic. Returns False otherwise.

delete_cosmetic_attribute(attr_name)

Delete a cosmetic attribute from this object.

Warning

The API for modifying cosmetic attributes is experimental and may change in the future (see issue #338).

Parameters:

attr_name – Name of the cosmetic attribute to delete.

to_dict(discard_cosmetic_attributes: bool = False, duplicate_attributes: list[str] | None = None) dict

Convert this object to dict format.

The returning dictionary contains all the ParameterAttribute and IndexedParameterAttribute as well as cosmetic attributes if discard_cosmetic_attributes is False.

Parameters:
  • discard_cosmetic_attributes – Whether to discard non-spec attributes of this object

  • duplicate_attributes – A list of names of attributes that redundantly decsribe data and should be discarded during serializaiton

Returns:

smirnoff_dict – The SMIRNOFF-compliant dict representation of this object.