Has attribute#

Checking if a specific molecular system form supports a given attribute.

The function molsysmt.form.has_attribute() returns a boolean indicating whether a target form provides a specific topological or structural property.

Added in version 1.0.0.

Basic usage#

Let’s check attribute support across different forms:

import molsysmt as msm
print('Does molsysmt.Topology have coordinates?:', msm.form.has_attribute('molsysmt.Topology', 'coordinates'))
print('Does molsysmt.Topology have atom names?:', msm.form.has_attribute('molsysmt.Topology', 'atom_name'))
print('Does file:pdb have box dimensions?:', msm.form.has_attribute('file:pdb', 'box'))
print('Does string:amino_acids_1 have coordinates?:', msm.form.has_attribute('string:amino_acids_1', 'coordinates'))
Does molsysmt.Topology have coordinates?: False
Does molsysmt.Topology have atom names?: True
Does file:pdb have box dimensions?: True
Does string:amino_acids_1 have coordinates?: False