Open liuyujie714 opened 1 year ago
Thanks @liuyujie714 for opening this issue and for giving such detailed information on a fix! It sounds like you already have a very good idea of what to do to fix it. If you have time to open a PR, we would very much welcome help on this -- otherwise, it's definitely on our to-do list!
I recommend modify atoms.resids behavior for tpr or add new keywords resnrs to represent original number
Personally I think the former option is better, since this is more in the spirit of resids
.
Question
When read topology information from gromacs tpr file, the discontinuous residue number is unsupported. such as, test.zip
Will get original discontinuous residue number in output gro(pdb, etc.):
99, 101 is corrected.
However, if I use mda to read top and save gro/pdb, the residue number is always continuous from
atoms.resids
.In most situation, we need original residue number do somethings, so I recommend modify
atoms.resids
behavior for tpr or add new keywordsresnrs
to represent original number.Related code
https://github.com/MDAnalysis/mdanalysis/blob/2bf55dd714292bbf7c12023a28153a6443a52ec6/package/MDAnalysis/topology/tpr/utils.py#L796
data.unpack_int() is need if fver >= 63, otherwise use i+1 for i in range(nres), like as
tpxio.cpp
in gromacs source: https://github.com/gromacs/gromacs/blob/0c5644d839bb80ac38f778e5e9e258e662a83642/src/gromacs/fileio/tpxio.cpp#L2359C1-L2372C6ri[j].nr
represents original residue number, used in output structure by gmx editconf, etc. tools