File: plot_wave_functions.rst

package info (click to toggle)
gpaw 25.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,888 kB
  • sloc: python: 174,804; ansic: 17,564; cpp: 5,668; sh: 972; csh: 139; makefile: 45
file content (69 lines) | stat: -rw-r--r-- 2,384 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.. _plot_wave_functions:

=======================
Plotting wave functions
=======================

-----------------------------
Creating a wave function file
-----------------------------

The following script will do a calculation for a CO
molecule and save the wave functions in a file (``CO.gpw``).

.. literalinclude:: CO.py

---------------------------------
Creating wave function cube files
---------------------------------

You can get separate cube files (the format used by Gaussian) for each wavefunction with the script:

.. literalinclude:: CO2cube.py

The script produced the files CO_0.cube .. CO_5.cube, which might be viewed using for example `jmol <https://jmol.sourceforge.net/>`_ or `VMD <https://www.ks.uiuc.edu/Research/vmd/>`_. 

Plotting wave functions with jmol
---------------------------------

See https://jmol.sourceforge.net/docs/surface/

You can visualize an isosurface from a cube file by creating the
`myscript.spt` script:
  
.. literalinclude:: myscript.spt

and executing it with jmol::

   jmol -s myscript.spt

You can also save the image directly on the command line::

   jmol -ions myscript.spt -w JPEG:myfile.jpg
  
Plotting wave functions with VMD
--------------------------------

To view the wavefunctions, start VMD with the command line::

    vmd CO_*.cube

You will get two windows, one with a very primitive representation of
the molecule, and one called 'VMD Main'.  In the VMD Main window,
select Graphics/Representation.  In the top panel there will be a
single "representation" of the molecule called "Line".  Select it, and
change the type to "CPK".  This will show the molecule with spheres for
atoms and rods for bonds.  You probably want to reduce the size of the
spheres and increase the resolution of the spheres.  Now you see the
atoms!

To see the wavefunctions, click on the "Create Rep" button, and select
the new representation.  Select type "Isosurface".  Near the bottom,
find the menu labeled "Draw" and select the value "Solid Surface".
Now you can see an iso-surface of the wavefunction, you select the
value in the field "Isovalue".  The default 0 is rarely useful.  You
select the different Kohn-Sham states (stored in the different cube
files) with the pull-down menu labeled "Vol".

**IMPORTANT:** This works best for molecules.  In solids, the
wavefunctions will be complex, VMD does not handle this well.