LibraryChargeType

class openff.toolkit.typing.engines.smirnoff.LibraryChargeType(**kwargs)

A SMIRNOFF Library Charge type.

Warning

This API is experimental and subject to change.

__init__(**kwargs)

Create a ParameterType.

Parameters
  • smirks (str) – The SMIRKS match for the provided parameter type.

  • allow_cosmetic_attributes (bool optional. Default = False) – 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__(**kwargs)

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.

from_molecule(molecule)

Construct a LibraryChargeType from a molecule with existing partial charges.

to_dict([discard_cosmetic_attributes, ...])

Convert this object to dict format.

Attributes

charge

id

name

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 (str) – Name of the attribute to define for this object.

  • attr_value (str) – 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 (str) – The attribute name to check

Returns

is_cosmetic (bool) – 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 (str) – Name of the cosmetic attribute to delete.

classmethod from_molecule(molecule: Molecule)

Construct a LibraryChargeType from a molecule with existing partial charges.

Parameters

molecule (Molecule) – The molecule to create the LibraryChargeType from. The molecule must have partial charges.

Returns

library_charge_type (LibraryChargeType) – A LibraryChargeType that is expected to match this molecule and its partial charges.

:raises MissingPartialChargesError : If the input molecule does not have partial charges.:

to_dict(discard_cosmetic_attributes=False, duplicate_attributes=None)

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 (bool, optional. Default = False) – Whether to discard non-spec attributes of this object

  • duplicate_attributes (list of string, optional. Default = None) – A list of names of attributes that redundantly decsribe data and should be discarded during serializaiton

Returns

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