molsysmt.basic.is_composed_of#

molsysmt.basic.is_composed_of(molecular_system, selection='all', syntax='MolSysMT', skip_digestion=False, **kwargs)[source]#

Checking whether a molecular system is composed exclusively of specific elements.

This function returns True if the selected portion of the molecular system is entirely composed of the requested element types and counts provided via keyword conditions in **kwargs; otherwise it returns False.

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

  • selection (str, list, tuple, or numpy.ndarray, default='all') – Selection string or boolean/integer array specifying elements.

  • syntax (str, default='MolSysMT') – Selection syntax used to evaluate selection (e.g., ‘MolSysMT’, ‘MDTraj’).

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

Returns:

True if all provided conditions are satisfied by the selection; False otherwise.

Return type:

bool

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

  • ArgumentError – If any argument is invalid or inconsistent.

Notes

See also

molsysmt.basic.select()

Select specific elements from a molecular system.

molsysmt.basic.contains()

Check whether certain elements or attributes are present in a molecular system.

Examples

>>> import molsysmt as msm
>>> from molsysmt import systems
>>> molsys = systems['T4 lysozyme L99A']['181l.h5msm']
>>> msm.basic.is_composed_of(molsys, waters=True, ions=True)
False
>>> msm.basic.is_composed_of(molsys, waters=True, ions=True, small_molecules=2, proteins=1)
True
>>> msm.basic.is_composed_of(molsys, n_chains=6)
True

Tutorial with more examples

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

Added in version 1.0.0.