[MMTK] keeping the order of atoms as in a PDB

Konrad Hinsen research at khinsen.fastmail.net
Wed Apr 4 15:49:45 UTC 2012

Ramon Crehuet writes:

 > I'd like to save the coordinates of some atoms, with the same
 > orther they had in the original PDB. This order is lost when the
 > objects are added to the universe. But I have found that the order
 > of universe.atomNames() corresponds to the original PDB. Can I rely
 > on that (or is it pure chance)?

Neither extreme is true. You can rely on that order being the same as
the order in the PDB file if your universe was created from that PDB
file without any modification: no atoms added (not even missing
hydrogens), no atoms deleted, no residues omitted, etc.

This feature exists to make it possible to work with binary trajectory
files such as DCD which require an additional PDB file to define the

 > If I can, then, knowing the name of an atom, how can I access its
 > position?

You don't even need the name, just use atom.index+1 to get the atom's
serial number in the PDB file.

Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: research AT khinsen DOT fastmail DOT net

More information about the mmtk mailing list