[lammps-users] jmol load trajectory and lammps xyz output

Hi there! I will send this to the lammps and the jmol list, because any solution will probably involve either of the programs :slight_smile:

I have problems when reading a lammps xyz trajectory with jmol :frowning:

It’s a system consisting of LJ particles and a metal, in different parts of the box, obviously

pair_style hybrid eam lj/cut 10.0
pair_coeff 1 1 eam Pt_u3.eam
pair_coeff * 2 lj/cut 0.00673850588 3.165648

dump 1 gbigbox xyz 10000 rawdump.1.xyz

I run this as a parallel job on 8 processors.

Afterwards I substitute the atom types 1, 2 with awk into something that jmol can read (Se is chosen for its nice color ;):

awk ‘{if ($1 == ‘1’){print "Pt “,$2,” “,$3,” ",$4}else if($1 == ‘2’){print "Se “,$2,” “,$3,” ",$4} else{print $0}}’ $1 > tempdump.$1.xyz

I make a file with the 10 last snapshots. From that file I make another file, containing the first of those 10 snapshots.
This opens correctly in jmol, so far so good.

Then, I try to open the file with all 10 last snapshots, and open it with ‘load trajectory’

The last snapshot is correct:
http://www.molmod.com/~schraven/jmol/last_frame_out_of_ten__ten_frame_file.jpg

But it created a misrepresentation of the first 9 of these 10 snapshots: some of the atoms within the metal and the LJ layer seem all mixed up :frowning:
http://www.molmod.com/~schraven/jmol/first_frame_out_of_ten__ten_frame_file.jpg

That happening is not very possible due to the quite solid nature of the metal :wink:

I also checked by just reading the first snapshot of the 10 from a file with only this snapshot in it:
http://www.molmod.com/~schraven/jmol/first_frame_out_of_ten__single_frame_file.jpg

That is the same structure as the previous picture, but with the correct distribution of atom types.

My conclusion is that jmol assumes that the atom order in the last frame of a trajectory is the order in all frames, and that lammps does not keep the atom order constant in the printing of xyz files. For all practical purposes, is there a way to make lammps always use the same order of atoms?

I hope anyone can shed some light on this issue!

Greetings, Pim

hi pim,

My conclusion is that jmol assumes that the atom order in the last frame of
a trajectory is the order in all frames, and that lammps does not keep the
atom order constant in the printing of xyz files. For all practical

this is documented behavior of lammps for dumping groups to a file.
only when dumping the whole system, the order in .xyz is preserved.
checkout the lammps manual.

purposes, is there a way to make lammps always use the same order of atoms?

there is but it requires changes to the code or writing a regular dump style
and then using a tools like VMD's catdcd to convert the dump to xyz.

i have since submitted two sets of patches to steve to have that allow sorting
of particles for groups. the first got rejected because of potential performance
problems and am still waiting on the ruling whether the second patchset is
meeting the quality requirements for lammps.

cheers,
   axel.

From the doc page for the dump command:

When LAMMPS is running in parallel, the atom information written to
dump files (typically one line per atom) may be written in an
indeterminate order. This is because data for a single snapshot is
collected from multiple processors. This is always the case for the
atom, local, and custom styles. It is also the case for the xyz style
if the dump group is not all. It is not the case for the dcd and xtc
styles which always write atoms in sorted order. So does the xyz style
if the dump group is all. The cfg style supports the sort option of
the dump_modify command which allows sorting to be turned on or off.

So if you dump xyz for group all, then the atoms will be sorted. If not, they
won't. In that case you'd need to use another dump style.

Steve

ok, clear! Sorry for not finding this in the very first paragraph of the manual! (shame falls upon me…)