for atom in new_mol.GetAtoms():
info = atom.GetPDBResidueInfo()
res_id = (info.GetResidueNumber(), info.GetResidueName(), info.GetChainId())
if res_id not in resiues_atom_map:
resiues_atom_map[res_id] = []
resiues_atom_map[res_id].append(atom.GetIdx())
After Change
for atom in new_mol.GetAtoms():
info = atom.GetPDBResidueInfo()
res_id = (info.GetResidueNumber(), info.GetResidueName().strip(),
info.GetChainId())
if res_id not in resiues_atom_map:
resiues_atom_map[res_id] = []