molsysmt.basic.get_attributes#

molsysmt.basic.get_attributes(molecular_system, include_none=False, attribute_type='all', output_type='list', skip_digestion=False)[source]#

Retrieving available attributes from a molecular system.

This function inspects the input molecular system and reports which attributes are available according to MolSysMT’s attribute registry. The result can be returned either as a dictionary mapping attribute names to booleans or as a list containing only the present attributes.

Parameters:
  • molecular_system (molecular system) – Molecular system in any supported MolSysMT format.

  • include_none (bool, default=False) – Whether to include attributes whose value is None.

  • attribute_type (str or None, default='all') – Attribute category used to filter the comparison or result.

  • output_type (str, default='list') – Representation used for the returned result.

  • skip_digestion (bool, default=False) – Whether to skip MolSysMT’s internal argument digestion mechanism.

Returns:

If output_type == 'dictionary': dictionary with attribute names as keys and booleans as values indicating availability. If output_type == 'list': list with the names of attributes present.

Return type:

dict or list

Raises:
  • NotSupportedFormError – If the input molecular system has an unsupported form.

  • ArgumentError – If input arguments are invalid or inconsistent.

Notes

See also

molsysmt.basic.has_attribute()

Check whether a specific attribute exists in a molecular system.

molsysmt.basic.get_form()

Retrieve the form of a molecular system.

molsysmt.basic.get()

Retrieve attribute values from a molecular system.

Examples

>>> import molsysmt as msm
>>> molsys = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm'])
>>> attributes = msm.get_attributes(molsys, output_type='dictionary')
>>> attributes['box']
True
>>> attributes['forcefield']
False
>>> output = msm.get_attributes(molsys, output_type='list')
>>> isinstance(output, list)
True
>>> 'molecule_id' in output
True
>>> 'forcefield' in output
False

Tutorial with more examples

See the following tutorial for a practical demonstration of how to use this function, along with additional examples: Get attributes.

Added in version 1.0.0.