Has hydrogens#
Checking whether a molecular system or selection contains hydrogen atoms.
The function molsysmt.build.has_hydrogens() evaluates whether hydrogen atoms are present in a molecular system or within a specific selection, returning True or False.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.build.has_hydrogens().
Basic usage#
Let’s show how this function works using T4 lysozyme (PDB ID: 181L):
import molsysmt as msm
molsys = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm'], to_form='molsysmt.MolSys')
Note
Demo Systems Catalog
This tutorial uses demonstration datasets provided by MolSysMT. To explore the full catalog of bundled systems, forms, and file paths, visit the Demo Systems guide.
Let’s check the number of hydrogen atoms using molsysmt.basic.get():
msm.get(molsys, selection='atom_type=="H"', n_atoms=True)
0
We check if the system contains hydrogen atoms using molsysmt.build.has_hydrogens():
msm.build.has_hydrogens(molsys)
False
We can also restrict the check to a specific selection (such as protein molecules):
msm.build.has_hydrogens(molsys, selection='molecule_type=="protein"')
False
Now let’s complete terminal cappings, heavy atoms, and add hydrogen atoms to the system:
molsys = msm.build.add_missing_terminal_cappings(molsys)
molsys = msm.build.add_missing_heavy_atoms(molsys)
molsys = msm.build.add_missing_hydrogens(molsys)
We check again to confirm that hydrogen atoms are now present:
msm.build.has_hydrogens(molsys)
True
msm.build.has_hydrogens(molsys, selection='molecule_type=="protein"')
True
See also
Related Tools & References
Convert: Convert molecular systems between different forms with
molsysmt.basic.convert().Get: Retrieve attribute values from a molecular system with
molsysmt.basic.get().Has hydrogens: Check whether a molecular system contains hydrogen atoms with
molsysmt.build.has_hydrogens().Add missing terminal cappings: Add terminal cappings to peptides or proteins with
molsysmt.build.add_missing_terminal_cappings().Add missing heavy atoms: Reconstruct missing non-hydrogen heavy atoms with
molsysmt.build.add_missing_heavy_atoms().Add missing hydrogens: Add missing hydrogen atoms to a molecular system with
molsysmt.build.add_missing_hydrogens().