Re: [lammps-users] Postprocessing Software/Codes

Dear LAMMPS users,
Along with OVITO, is there any other paid/open source code for visualization/plotting that can work with LAMMPS outputs and produce high quality images?

Thank you.

Dear LAMMPS users,
Along with OVITO, is there any other paid/open source code for visualization/plotting that can work with LAMMPS outputs and produce high quality images?

VMD, AtomEye, and LAMMPS own dump image feature can generate publication quality images. I’ve used VMD a lot, but it has some limitations, and the default colors, field-of-view, and rendering settings are kind of ugly (in my opinion). But with some experimentation, you can make some really great images and movies. (Play with the settings in the “Graphics->Representations” menu, including the "Draw Style, “Periodic”, “Create Rep” and “Delete Rep” buttons. Also try “Display”->“Render Mode”->“GSL” (to improve the frame rate), and “Display”->“Display Settings”, where you can change the field-of-view, and add shadows and ambient occlusion “Amb. Occ.”)

I’m curious to know what feature you would like to see in OVITO?
(I actually usually prefer OVITO over VMD. The only limitation I’ve noticed is the ability to specify the bonds between specific pairs of atoms. They are currently determined by atom type and distance, I think.)

Hi Raj
OVITO has the ability to make really beautiful ray traced images, but they charge money for some of the ray-tracing features. (For what it’s worth, I support them for doing that. It’s hard to get funding to feed yourself when writing software like this.) Don’t feel bad if you are a graduate student and you can’t afford a license (currently $420). The free version makes pretty good images also. I have never seen a scientific journal reject a paper because the authors did not use the latest ray-tracing methods to produce prettier pictures.

I’m not sure if VMD makes images which are better than the free version of OVITO. They both use the tachyon rendering engine. VMD is a older and it is more confusing to use because it was designed for rendering proteins (which most LAMMPS users don’t care about). VMD can’t render ellipsoids, dipoles or handle trajectories with bonds breaking and forming. But it is also a very useful program. So here’s a more detailed reply to your question with VMD-specific instructions, if you want to try VMD:

  1. I assume you are using a LAMMPS data file. If not, use the LAMMPS “write_data” command to create one.
  2. Then, use topotools to load the data file into VMD. To do that
    a) Start VMD (preferably from a terminal, by entering “vmd”. Sometimes VMD prints useful information to the terminal from which it was invoked.))
    b) Select the “Extensions”->“Tk Console” menu option
    c) In the newly created window enter:
    topo readlammpsdata MYDATAFILE full
    (I assume you are using “atom_style full”)
  3. Use the “Graphics->Representations” menu and change the appearance using the ("Draw Style, “Coloring Method”, “Periodic”, “Create Rep” and “Delete Rep” buttons) Some of options for the draw styles and coloring methods use terminology which were originally intended for proteins. For example, “ResID” refers to the LAMMPS Molecule-ID number, and “Index” refers to the LAMMPS Atom-ID.
  4. Optional: Select the “Display”->“Render Mode”->“GSL” menu option (to improve the frame rate)
  5. Select the “Display”->“Display Settings” menu option to enable ambient occlusion and change the field of view.
  6. Select the “File”->“Render” menu option and click on “Snapshot” and change it to “Tachyon (in-memory rendering” option. Then click on “Start Rendering”.
  7. USEFUL FEATURE: If you press the % button, you can click on the atoms in your system, and the coordinates, atom-ID, molecule-ID, and atom type will printed to the terminal that you used to start VMD. (The Index, ResID, and type numbers correspond to the Atom-ID, Molecule-ID, and Type numbers in the LAMMPS data file. But the numbers begin at 0, not 1, so you have to add 1 to them, since LAMMPS numbering begins at 1.) After you’re done, press the “R” key to return to rotation mode. You can press the “T” key if you want to shift the position of the camera without rotating it.
  8. Here’s how to make movie of your simulation running:
    a) Right click on the entry in VMD’s main window (the small window with all the menus). It should be black text on a white background to the right of the “T A D F”.
    b) Pull down and select “Load Data into Molecule”
    c) Click “Browse” and look for your LAMMPS dump file. (I don’t know if VMD can read other kinds of LAMMPS trajectory files yet, but it can read standard dump files. I recommend giving your dump files a name ending in “.lammpstrj” before doing this so that VMD can recognize the file format.)
    d) Select the “Extensions”->“Visualizations”->“Movie Maker” , click on “Movie Settings”, and select “Trajectory”.
    e) Click on “Format” and select “Targa frames”. (This will generate a list of still images instead of the low-quality mpeg files that VMD makes by default.)
    f) Click on “/usr/tmp” and change the directory where you want to save your images.

g) OPTIONAL: Change the size of the big VMD window to have the correct size for the movie you are trying to create. I recommend selecting the “Extensions”->“Tk Console” menu option, and entering this command to control the display size:
display resize 1920 1080
This will create large high resolution images that are compatible with youtube.

h) Click “Make Movie” and select the name of the image files you want to create. (Example: If you select a name like “TRAJECTORY” then the image files will end up with names like “final.TRAJECTORY00001.tga”, “final.TRAJECTORY00002.tga”,…)
i) Stitch the images together into a movie. I use ffmpeg to do that. I use this command (typing it into the shell):

ffmpeg -r 30 -crf 10 -f image2 -i “final,TRAJECTORY%05d.tga”
-codec:v libx264 -pix_fmt yuv420p
-vf “scale=trunc(iw/2)*2:trunc(ih/2)*2”

The “-r” argument (eg. “30” controls the frame rate).
The “-crf” argument controls the quality (0 for high quallity large files, 20 for lower-quality smallerfiles)
The optional “-vf” argument makes sure the horizontal and vertical resolution is divisible by 2

The “-codec”, “-pix_fmt” arguments are also optional, but in my experience, adding them produces movies that work on all platforms (including MacOS and iOS). Otherwise you might end up with a movie which looks great on your computer, but nobody else can open it.

Thanks for your reply.
I hope this information helps.


Dear Andrew,
Thank you for an elaborate explanation. I will try with these instructions with VMD. And you are right, no journal has ever declined to accept OVITO generated images because I have published all my work using OVITO only.

Thanks again.