create_atom_names#

biotite.structure.create_atom_names(atoms)[source]#

Create atom names for a single residue based on elements.

The atom names are simply enumerated separately for each element.

Parameters:
atomsAtomArray or AtomArrayStack or array-like of str

The atoms for which the atom names should be created. Alternatively the elements can be passed directly.

Returns:
atom_namesndarray, dtype=str

The atom names.

See also

infer_elements

The opposite of this function

Notes

The atom names created this way may differ from the ones in the original source, as different schemes for atom naming exist. This function only ensures that the created atom names are unique. This is e.g. necessary for writing bonds to PDBx files.

Note that this function should be used only on single residues, otherwise enumeration would continue in the next residue.

Examples

>>> atoms = residue("URA")  # Uracil
>>> print(atoms.element)
['N' 'C' 'O' 'N' 'C' 'O' 'C' 'C' 'H' 'H' 'H' 'H']
>>> print(create_atom_names(atoms))
['N1' 'C1' 'O1' 'N2' 'C2' 'O2' 'C3' 'C4' 'H1' 'H2' 'H3' 'H4']