In this tutorial we will explain how to make beautiful pictures using openDX. Open DX is a very powerful, although quite complex, program for the 3D visualization of data. It is completely general-purpose, and uses a visual language to process the data to be plotted. Don't worry, as you will probably not need to learn this language. We have provided a program (mf.net and mf.cfg) that you can get from the SHARE/util directory in the Octopus installation (probably it is located in /usr/share/octopus/util).
Before starting, please make sure you have it installed together with the Chemistry extensions. You may find some instructions here. Note that openDX is far from trivial to install and to use. However, the outcomes are really spectacular, so if you are willing to suffer a little at the beginning, we are sure that your efforts will be compensated.
For other file formats and visualization software, see Manual:External utilities:Visualization.
At this point, the input should be quite familiar to you:
= gs = eV_Angstrom = 5 = 0.15 = wfs + density + elf + potential = dx = "benzene.xyz"
Coordinates are in this case given in the file benzene.xyz file. This file should look like:
12 Geometry of benzene (in Angstrom) C 0.000 1.396 0.000 C 1.209 0.698 0.000 C 1.209 -0.698 0.000 C 0.000 -1.396 0.000 C -1.209 -0.698 0.000 C -1.209 0.698 0.000 H 0.000 2.479 0.000 H 2.147 1.240 0.000 H 2.147 -1.240 0.000 H 0.000 -2.479 0.000 H -2.147 -1.240 0.000 H -2.147 1.240 0.000
Note that we asked octopus to output the wavefunctions (wfs), the density, the electron localization function (elf) and the Kohn-Sham potential. The output will be in dx format. If you want to use the XCrySDen format, you can replace
xcrysden or put
dx + xcrysden to get the output in both formats.
If you run Octopus with this input file you will find, in the static directory several files with the extension .dx. These files contain the wave-functions, the density, etc. in a format that can be understood by Open DX (you will need the chemistry extensions package installed on top of DX, you can find it in our releases page).
So, let us start. First copy the files mf.net and mf.cfg to your open directory, and open dx with the command line
If you followed the instructions given in here you should see a window similar to the one shown on the right.
Now select Run Visual Programs..., select the mf.net file, and click on OK. This will open the main dialog of our application. You will no longer need the main DX window, so it is perhaps better to minimize it to get it out of the way. Before continuing, go to the menu Execute > Execute on Change, which instructs to open DX to recalculate out plot whenever we make a change in any parameters.
Now, let us choose a file to plot. As you can see, the field File in the mains dialog is NULL. If you click on the three dots next to the field a file selector will open. Just select the file static/density-1.dx and press OK. Now we will instruct open DX to draw a iso-surface. Click on Isosurfaces and a new dialog box will open (to close that dialog box, please click again on Isosurfaces in the main dialog!) In the end you may have lots of windows lying around, so try to be organized. Then click on Show Isosurface 1 - an image should appear with the density of benzene. You can zoom, rotate, etc the picture if you follow the menu Options > View control... in the menu of the image panel. You can play also around in the isosurfaces dialog with the Isosurface value in order to make the picture more appealing, change the color, the opacity, etc. You can even plot two isosurfaces with different values.
We hope you are not too disappointed with the picture you just plotted. Densities are usually quite boring (even if the Hohenberg-Kohn theorem proves that they know everything)! You can try to plot other quantities like the electronic localization function, the wave-functions, etc, just by choosing the appropriate file in the main dialog. You can try it later: for now we will stick to the "boring density".
Let us now add a structure. Close the isosurfaces dialog by clicking again in Isosurfaces in the main dialog box, and open the Geometry dialog. In the File select the file benzene.xyz, and click on Show Geometry. The geometry should appear beneath the isosurface. You can make bonds appear and disappear by using the slide Bonds length, change its colors, etc. in this dialog.
To finish, let us put some "color" in our picture. Close the Geometry dialog (you know how), and open again the isosurfaces dialog. Choose Map isosurface and in the File field choose the file static/vh.dx. There you go, you should have a picture of an isosurface of benzene colored according to the value of the electrostatic potential! Cool, no? If everything went right, you should end with a picture like the one on the right.
As an exercise you can try to plot the wave-functions, etc, make slabs, etc. Play around. As usual some things do not work perfectly, but most of it does!
Those .dx files can be also be opened by UCSF Chimera.
Once having UCSF Chimera installed and opened, open the benzene.xyz file from File > Open.
To open the .dx file, go to Tools > Volume Data > Volume Viewer. A new window opens. There go to File > Open and select static/density.dx.
To "color" the density go to Tools > Surface Color. A new dialog opens and there choose Browse to open the vh.dx file. Then click Color and you should have an image similar to the below one.