Change colors every frame in VMD according to dump file of LAMMPS

Hi all,
I have a LAMMPS dump file which I am trying to visualise on VMD. In my LAMMPS dump file the type field changes every frame but as you all may know, VMD just reads the type field for the first frame and then uses that for all the other frames. I, on the other hand, wish that the colors are dynamically changed according to the type field for each frame.
Is this possible? Has anyone faced similar issues? Any help would go a long way. Thanks!

1 Like

It may be possible with some VMD scripting.
There are three possible approaches:

  • split your trajectory file into multiple files with one frame per file (or use a * in the filename to let LAMMPS do that for you) and read those files into different VMD “molecules”. then you can use the multimolanim plugin to animate over the different molecules.
    (NB: you can use the clone representations plugin to copy the visualization from one of the molecules to all others)
  • use a LAMMPSREMAPFIELDS=vx=type environment variable setting to alias the “type” field into the x velocity field (which VMD will read and store per-atom per-frame). then you can either use that directly though a colormap and color by velocity (the other two components will be zero), or do a loop over the trajectory and copy the vx property for all atoms to the user (or user1, user2, user3) field and use that for visualization and analysis.
  • write a parser for LAMMPS dump files in Tcl and read the type information from it and store it in the corresponding per-atom per-frame user field.

Of course, you could also use a different visualization tool that does not suffer from VMD’s limitation (but with some other limitations that VMD doesn’t have).

1 Like

Thanks a lot!