The keys of resi_to_group and resi_to_name are residue positions at the protein sequence, from residue 1 to the last residue (ex. 390). However, the mdtraj “residue index” gives the residue position at the PDB file, starting by 0. Therefore, if in the PDB the first residue sequence number is the 38, what mdtraj considers as residue index 0 will be residue 38 at resi_to_group and resi_to_name dicts. That's why we obtained shifted numbering: the H bonds were being assigned at residues shifted some positions with respect to the correct ones.
From Mariona:
The keys of resi_to_group and resi_to_name are residue positions at the protein sequence, from residue 1 to the last residue (ex. 390). However, the mdtraj “residue index” gives the residue position at the PDB file, starting by 0. Therefore, if in the PDB the first residue sequence number is the 38, what mdtraj considers as residue index 0 will be residue 38 at resi_to_group and resi_to_name dicts. That's why we obtained shifted numbering: the H bonds were being assigned at residues shifted some positions with respect to the correct ones.