molsysmt.basic.has_attribute#
- molsysmt.basic.has_attribute(molecular_system, attribute, include_none=False, 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 to analyze, in any of the supported forms.
attribute (str) – Name of the attribute to check.
include_none (bool, default False) – Whether to consider attributes currently holding None as available. If True, an attribute that exists but is None will return True.
skip_digestion (bool, default False) –
Whether to skip MolSysMT’s internal argument digestion mechanism.
MolSysMT includes a built-in digestion system that validates and normalizes function arguments. This process checks types, shapes, and values, and automatically adjusts them when possible to meet expected formats.
Setting skip_digestion=True disables this process, which may improve performance in workflows where inputs are already validated. Use with caution: only set this to True if you are certain all input arguments are correct and consistent.
- 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 Forms.
Selection strings must follow one of the syntaxes described in Selection syntaxes.
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.