# An automated approach to visualize several xyz structures

I have several .xyz files (each composed of several molecules) and I'd like to find an automated way to visualize and save them. I'd appreciate any guidance.

• What do you mean by "visualize", e.g. what is the desired output format? Also, what kind of information needs to be visualized? May 21 '20 at 16:34
• May 21 '20 at 16:36
• Thanks for the reply. By visualization I mean I need something which reads my set of xyz files and saves their "images" automatically. I mean I don't want to save the figures one by one. About the posts you have referred me to, I feel they are not fully relevant cause I have the 3D coordinates (se don't need to generate them at this stage) and don't want to save the figures (extracted e.g from ASE) one by one. Ideally, I need some sort of TCL script for vmd where it can read xyz files sequentially and saves the images automatically.
– Rose
May 21 '20 at 18:01
• Wouldn't the orientation be a problem? If you can't see the individual files and rotate them, then you might get a picture that's in an odd orientation. May 17 at 11:19

You can use VMD to do this.

Note that the following is only tested on Linux with VMD version 1.9.2, i don't know how it works out on Windows or Apple OS.

The following is from a script that i used to render a trajectory. The first thing to do is to load your xyz file as trajectory. I.e. in a format so that vmd allows you to "slide" through the structures in its normal view. Then execute the script in the tlc console. The script iterates over the steps in incremenets of 2 and assumes that you have 2000 structures. The iteration variable is i. The actual command that changes the frames is the animate goto \$i command. You would need to adjust that to fit your requirement. I used the tachyion renderer and saved the output figures in tga format. You will most likely have to adjust the path to the renderer binary which is the path /software/vmd-1.9.2/lib/vmd/tachyon_LINUXAMD64 in my case. VMD saves first a .dat file that contains the scene and then applies the renderer to this dat file. This is why i am setting two path variables, first fin for the .dat file and then fout for the actual tga file.

for {set i 0} {$$i < 2001} {incr i 2} { animate goto i set fin [format "pic_%04d.dat" i] set fout [format "pic_%04d.tga" i] render Tachyon fin "/software/vmd-1.9.2/lib/vmd/tachyon_LINUXAMD64" -aasamples 12 fin -format TARGA -o$$fout -res 1920 1080
}


The nice part about this is that you can implement other commands during your loop, like a zoom or a rotation. All you have to do, is find out what the tcl command in vmd is.

I recommend using software called ChemCraft. The software isn't free; however, they offer a 150 day trial period. I typically use this program to open formatted checkpoint files from Gaussian calculations to view orbitals. It has plenty of other functions, including the ability to open multiple .xyz files and save multiple images.

The default colors are a bit yucky, but I recommend using one of the following from the Display menu: CPK, GaussView, or Spartan. Those will color atoms with the typical scheme: Nitrogen (blue), Oxygen (red), etc.

I hope this helps!

• There are also programs such as jmol, avogadro, and pymol (which can be obtained for free if you compile it yourself). There just isn't really any good reason to pay for a software if you all you want to do is use it for visualization. Sep 19 '20 at 4:25