molsysmt.basic.has_attribute#

molsysmt.basic.has_attribute(molecular_system, attribute, include_none=False, structure_indices='all', chemical_state='reference', skip_digestion=False)[source]#

Checking whether a molecular system has a specific attribute.

This function returns True if the given attribute is available for the input molecular system, and False otherwise. Availability depends on the form-specific backend and the global attribute registry.

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

  • attribute (str) – Name of the molecular-system attribute to locate or inspect.

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

  • structure_indices (int, list, tuple, or numpy.ndarray, default='all') – Structure indices (0-based) to include or process.

  • chemical_state ({'reference', 'structure'}, int, or None, default='reference') – Chemical state used to resolve state-dependent attributes.

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

Returns:

True if the attribute is available in the molecular system, False otherwise.

Return type:

bool

Raises:
  • NotSupportedFormError – If the molecular system has a form that is not supported.

  • ArgumentError – If input arguments are invalid or inconsistent.

Notes

  • Supported molecular-system forms are summarized in Items and Forms.

  • Selection strings must follow one of the syntaxes described in Selection syntaxes.

  • For native multi-state systems, chemical_state resolves availability without changing the topology’s reference state.

  • Explicit integer state selection currently requires a native Topology or MolSys.

  • For a partial native MolSys, availability depends on the domains that are present. A missing topology or structures domain does not count as an available attribute even with include_none=True.

See also

molsysmt.basic.get_attributes()

Retrieve the list of available attributes in a molecular system.

molsysmt.basic.get()

Retrieve values of specific attributes from a molecular system.

Examples

>>> import molsysmt as msm
>>> from molsysmt import systems
>>> molsys = msm.convert(systems['T4 lysozyme L99A']['181l.h5msm'])
>>> msm.has_attribute(molsys, 'box')
True
>>> msm.has_attribute(molsys, 'forcefield')
False

Tutorial with more examples

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

Added in version 1.0.0.