Dear Qianzhen,
To to map the atom id to the labels you should iterate over the PDB's
residues, like:
idToAtomicLabel = {}
for res in openbabel.OBResidueIter(mol):
for atom in openbabel.OBResidueAtomIter(res):
idToAtomicLabel[atom.GetId()] = res.GetAtomID(atom).strip()
Best,
Dear Open Babel support team,
I tried to protonate a ligand from a PDB file and save a protonated PDB
that keeps the atom label (e.g.: C2A) and residue name.
The PDB openbabel exported just leaves element type (e.g.: C) but not the
original atom label (e.g.: C2A). And the residue name was changed