Skip to content

Add option to keep original Atom IDs when writing PDB #1072

@kain88-de

Description

@kain88-de

Expected behaviour

When I use ag.write('foo.pdb') I expect the atom ids to be the same as in the AtomGroup

Actual behaviour

The atom ids's always start from 0.

Code to reproduce the behaviour

import MDAnalysis as mda
from MDAnalysisTests.datafiles import PDB

u = mda.Universe(PDB)
bb = u.select_atoms('backbone')
bb.write('foo.pdb')
u2 = mda.Universe('foo.pdb')
assert np.all(bb.ids == u2.atoms.ids)

Currently version of MDAnalysis:

(run python -c "import MDAnalysis as mda; print(mda.__version__)")
develop branch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions