Making Atomistic Movies using OVITO
Revision as of 15:35, 15 August 2011
This example shows how to use output from the molecular dynamics code LAMMPS with Ovito and ImageJ in order to create an animated movie. This example will reference the scripts and data of the Uniaxial Compression in Single Crystal Aluminum example. This assumes that Ovito and ImageJ are already downloaded.
Author(s): Nathan R. Rhodes, Mark A. Tschopp
In order for LAMMPS to output compatible data, one must set up an appropriate dump file with the desired data in the LAMMPS input script. Near the end of the LAMMPS script, use the 'dump' command in order to output desired data to a 'custom' file type for use in Ovito. The following lines create a dumpfile for every atom in the simulation every 250 timesteps, and each file is named according to its associated timestep. Then, the file is specified to show, for each atom, the atom ID, atom type, scaled atom coordinates, previously computed centrosymmetry and potential energy variables, and forces upon each atom.
# Dump to cfg for Ovito post processing dump 1 all custom 250 dump.comp.* id type xs ys zs c_csym c_peratom fx fy fz
An example dumpfile is displayed below. This is the initial dumpfile from the Uniaxial Compression example with 4,000 atoms at 10 K.
ITEM: TIMESTEP 0 ITEM: NUMBER OF ATOMS 4000 ITEM: BOX BOUNDS -0.00194951 40.5019 -0.00194951 40.5019 -0.00194951 40.5019 ITEM: ATOMS id type xs ys zs c_csym c_peratom fx fy fz 4 1 0.000170336 0.0496471 0.0501861 0.0190701 -3.36248 -0.0745574 0.0414501 -0.0543807 8 1 0.099786 0.0498953 0.0508957 0.0517112 -3.35214 0.0486293 -0.0229895 -0.143769 43 1 0.0500606 0.0996001 0.0488291 0.0869119 -3.35753 -0.0631582 0.0496892 0.147736 45 1 0.100489 0.0997987 0.000770305 0.040524 -3.35329 -0.0949618 -0.00834898 -0.100968 202 1 0.0499904 0.0502952 0.0993613 0.0400135 -3.35974 -0.0659737 -0.0387528 0.138855 ...
- Open Ovito.
- Select "File/Import," one of the dumpfiles you wish to animate, and "Open."
- Select "Use following wild-card name to load multiple files."
- You must tell Ovito what each column of data in the dumpfile is. Often, Ovito can do this for you if you click "Auto-assign columns."
- Use the Modifier List to add the desired modifications to your images and future animation. For this example, the "Common Neighbor Analysis" modifier was used to visualize dislocations.
- Test the animation by using the animation tools below the graphics.
- Click the "Render" tab.
- Select "Complete animation" and choose an output filename in "Output Filename." Save to a new directory for use later in ImageJ. Be sure to include an appropriate extension, such as ".bmp."
- Select the view that you would like to animate and click "Render Active Viewport" above "Render settings."
- Now you should have an image for every frame of your simulation.
- Open ImageJ
- Drag the folder that contains the images created by Ovito into ImageJ.
- Select "Convert to RGB" to keep the color from the AtomEye images.
- Choose "yes" to load a stack.
- Adjust the size as needed (Image/Adjust/Size)
- Adjust frame rate as desired (Image/Stacks/Animation Options)
- Save as Animated Gif file