Grid/Geometry Viewer/Editor (GV)
is an OpenGL based code for visualization of molecular orbitals and
densities, density differences and spin-densities, and visualization
of molecular structures (with the possibility to manipulate them on
the screen), and visualization of some properties.
The name should
not be confused with gv (aka ghostview).
GV is built from source with a standard C compiler (GCC or Clang) and requires OpenGL, GLU, and freeglut development libraries. Three STB single-header libraries (stb_image_write.h, stb_truetype.h, stb_easy_font.h) are downloaded automatically by make if not present (curl or wget required).
Linux (Debian / Ubuntu):
sudo apt install freeglut3-dev libglu1-mesa-dev fonts-dejavu
make
macOS (Homebrew):
brew install freeglut
make
Windows (MSYS2 / MinGW64):
pacman -S mingw-w64-x86_64-freeglut
make
Cross-compile Linux → Windows:
sudo apt install gcc-mingw-w64-x86-64
make windows
(set FREEGLUT_PREFIX if freeglut
is not in the default MinGW sysroot)
For headless / server-side rendering without a display see the OSMesa build section below. For in-browser use see the WebAssembly build section below.
GV can operate with different kinds of files:
grid files (usually with extension grid) (generated by the program GRID_IT from MOLCAS package),
XYZ files,
molden files, generated by MOLCAS,
CIF files (Crystallographic Information Files),
MOLCAS SEWARD/GATEWAY input files (auto-detected by &GATEWAY or &SEWARD marker; coordinates are converted to XYZ internally).
If a file name is specified in a command line, GV will determine the type of the file, and switch to the appropriate mode. If no file is specified, GV will search the current directory for files with a known type.
Command line parameters for GV
|
Command |
Purpose |
|
filename |
: name of a grid file, XYZ file, molden file, CIF file, or MOLCAS SEWARD/GATEWAY input file. If this parameter is omitted program will try to find a first relevant file in the current directory. |
|
-h |
display help information |
|
-n filename |
create an empty XYZ file |
|
-d real |
set an initial size for the molecule |
|
-f filename |
set the basename of output files (.xyz, .tga, .eps, .pov). By default the basename is taken from the filename. |
|
-s integer |
Set initial size for the screen. |
|
-z |
Force coordinate-editing mode (is_coord=2), even if the file has no unit cell. Useful for XYZ files where auto-detection picks the wrong mode. |
|
-m |
Start in animation mode (same as pressing m key on startup). |
|
-w |
Draw isosurface as wireframe instead of solid. |
|
-v |
Load saved viewpoint from .ViewPoint file on startup; or compute an automatic best viewpoint if no file exists. |
|
-q |
Batch/headless mode: render and save PNG image(s), then exit. No window is opened. Typically used with the OSMesa build and the -o flag. Example: gv -q -o all molecule.lus |
|
-S |
Reset all saved settings: delete the .molcasgv configuration directory and restart with defaults. |
|
--record filename |
Record all keyboard, mouse and menu events to filename for later playback. See the Record/Playback section below. |
|
--play filename |
Play back a previously recorded session from filename. The file may also contain script commands (speed, wait, open, status, echo). See the Record/Playback section below. |
The rest of command line parameters have meaning only for displaying grid files:
|
Command |
Purpose |
|
-l real |
: set initial isolevel value |
|
-i real |
: set increment value for changing isovalue |
|
-t real |
: set transparency level (between 0.0 and 1.0) for isosurfaces |
|
-b color |
: set initial background color ( white|gray|black) |
|
-o integer |
: set the number of initial orbitals (by default: display density) |
|
filename2 |
: name of a second grid file to display a density difference |
|
-a real |
: a weight of second grid. The default is -1 (to calculate density difference). |
|
--minus |
: shorthand for -a -1 (density difference, grid1 − grid2). |
|
--plus |
: shorthand for -a 1 (sum of two grids). |
|
--same-space |
: allow combining two grids that share the same coordinate space but have different mesh resolutions. Grid1 is trilinearly resampled onto grid2’s mesh before the linear combination. Without this flag the program aborts if grid sizes differ. |
|
--align |
: combine two grids whose atoms are in the same order but at slightly different positions (e.g. two steps of a geometry optimisation or IRC path). A Kabsch rigid-body alignment (optimal rotation + translation) is computed from the matched atom pairs and used to resample grid2 onto grid1’s coordinate frame before forming the linear combination. The output grid is on grid1’s mesh and carries grid1’s atom positions. The program aborts if any atom displacement exceeds the tolerance (default 2 Å; see --align-tol). The alignment RMSD is printed to stderr. |
|
--align-tol real |
: maximum allowed atom displacement in Ångström when using --align. Default is 2.0. Set to 0 to skip the check entirely. |
|
--out filename |
: specify output file name for a grid constructed with -a option. |
|
--version |
: print the version number |
|
-o N | all | list |
: select which orbital(s) to display or export in batch mode. -o 3 selects orbital 3 (1-based), -o all selects all orbitals, -o 1,3,5 selects a comma-separated list. In interactive mode this sets the initial orbital. In batch mode (-q) each orbital is saved as a separate PNG. |
|
--findsym |
: run the built-in findsym symmetry utility and exit. Only available in builds compiled with USE_FINDSYM. |
For an advanced configuration of GV one can save the current configuration (F9 key), and edit the ASCII formatted configuration files. The configuration files are located in the subdirectory .molcasgv in the user home directory:
gv.rc — global settings: colors, transparency, atom/bond sizes, screen size, font mode. Reset with gv -S.
atoms.rc — per-element van der Waals radii and CPK colors.
gv.keys — key remapping table (native builds only). Format: new_key = existing_key. Supported key names: F1–F12, Insert, Home, End, PageUp, PageDown, arrow keys, Ctrl+x.
gv.frag — saved molecular fragment library (used by F3 → fragment menu).
The main control of GV can be done by the mouse: the left mouse button is used to rotate the grid or the molecule, right mouse button is used for the on-screen menu. The major operations from menus can also be performed by hot-keys. Note, that behavior of GV, e.g. on-screen menus and hot-keys is different for the different types of visualized files.
Some keys like PageUp/PageDown, plus/minus have different meaning in different modes, with a general rule - plus/minus changes a value, PageUp/PageDown changes a property of selected item.
Note for Mac users. To press functional keys (F1-F10) you have to use 'fn' button. Insert button (missing on Mac keyboard) can be emulated by 'I' key. For more control, set up key remapping table.
General HotKeys.
|
Command |
Purpose |
|
Ctrl-Q |
Quit |
|
F10 |
Exit (exit implies possible back up of edited files). |
|
Escape |
unset different editing modes |
|
F1 |
Display context-dependent help screen (with a list of hot-keys for the current mode: orbital/grid, coordinate, or molden). Press F1 again to scroll to additional pages. |
|
q/Q |
decrease/increase quality of drawing |
|
F2 |
save INPORB file (lus/grid mode) or XYZ coordinates (all other modes); in lus/grid mode Shift-F2 saves atoms as a new XYZ file |
|
F9 |
Save current settings |
|
Shift+F9 |
Edit colors for background, labels, orbitals and extra planes. |
|
r/R/g/G/b/B |
Interactively change RGB code for the background, labels, and orbitals (selected by Shift-F9 key) |
|
F5 |
Print screen in tga format. The output files will be named as filename000.tga |
|
Shift+F5 |
Print screen in PostScript format. The output files will be named as filename000.eps |
|
P |
Print screen in PostScript (level 2) format. |
|
p |
Save povray file. |
|
z/Z |
Zoom the grid or the molecule |
|
x |
Maximize the screen |
|
v/V |
Create/restore .ViewPoint file (viewing conditions) |
|
Home |
Move the molecule to the center of the screen |
|
Up/Down/Left/Right |
Move the position of the picture on screen (with shift - make bigger steps) |
|
l |
Switch to/from the mode: move the light position with the mouse. |
|
w |
Switch between grey-scale and colored picture |
|
m |
Start/stop animation |
|
W |
Switch to Tee time mode |
|
F |
Cycle font rendering mode: GLUT bitmap → stb_easy_font → TrueType. Affects all on-screen text labels and status line. (Not available in the WebAssembly build.) |
|
Ctrl-A |
Toggle alternate modifier flag. Use this if Shift or Ctrl appears to be “stuck” after a modifier key was not released properly. |
Hot keys in Grid Mode.
|
Command |
Purpose |
|
+/- |
increase/decrease the isosurface value (the step and initial value can be modified by command line parameters) |
|
PageUp/PageDown |
display next/previous orbital. In multiview mode (F3 has been pressed), use magnify glass. |
|
t/T |
change transparency level |
|
f/i/1/2(a)/3/s/d |
change the type of the current orbital to frozen, inactive, RAS1, RAS2, RAS3, secondary, deleted. |
|
Space/middle mouse |
change the type of the current orbital (by loop) |
|
F2 |
save INPORB file (file will be saved as filename.GvOrb); Shift-F2 saves the atom coordinates as a new XYZ file |
|
F3 |
Switch to/from multiview mode. In multiview mode the orbital type is shown by different backgrounds (rainbow colors). User can modify the type of orbitals, by pressing middle mouse button (or Space). |
|
F4 |
Enter an isovalue (if a number was typed), or an orbital number (# n m - to display orbital with symmetry n and number m), or create a filter (for more information check tutorial for GV). |
|
Delete |
Hide the orbital from the list |
|
Insert |
Restore all hidden orbitals |
If GV is used to display a molecule, it is possible to make a selection of an atom, a bond, an angle, or a dihedral angle by clicking (by left mouse button) on the atom. First selected atom will be displayed with a blue colored net, the rest (for bond and angle) with a magenta colored net. Using hot keys it is possible to make modification of the selected part of the structure. In addition to selection (note that only 4 atoms can be selected), it is possible to highlight a group of atoms. Highlighting is made either by mouse (is Shift button is hold), or by keyboard (F7 button). Highlighted atoms can be modified as a single unit - e.g. rotated, moved. To remove current selection - press middle mouse button or space. If user has both selected and highlighted atoms - the first press of space button will unselect 'selected', and the second one - unhighlight atoms.
GV can understand an extended syntax of XYZ file, and draw additional elements: axises, polygons, etc.
Hot keys available when atoms are loaded (XYZ, Molden atoms, or lus file).
|
Command |
Purpose |
|
F2 |
Save coordinates (file will be saved as filename000.xyz) |
|
Shift-F2 |
Save coordinates (overwrite the file) |
|
left mouse |
select an atom by clicking on it. |
|
left mouse + shift |
highlight an atom |
|
drag left mouse + shift pressed, followed by left click |
highlight atoms in the rectangular area |
|
F3 |
display menu with molecular fragments. |
Hot keys in if no atoms are selected
|
Command |
Purpose |
|
+/- |
change a size of atoms and bonds |
|
Insert |
add an atom, or last inserted fragment |
|
End |
add dummy atoms (reference points, symbol Z or Bq) on the direction of axis. Dummy atoms are invisible and excluded from bounding box and center-of-mass. |
|
a |
Mark hydrogen atoms in the molecule |
|
F8 |
analyze the symmetry of the molecule and display symmetry elements. |
|
Delete |
delete all dummy atoms (Z or Bq) |
|
Home |
Move the molecule to the center of screen |
|
* |
Reverse the selection |
|
# |
if several atoms are highlighted, sort them, and place into the beginning of xyz file. |
|
C |
Generate concentric-shell clusters from a periodic structure (XYZ, Molden, or lus file with unit cell vectors). The selected atom (or the origin if none is selected) is placed at the center. Clusters are written to _clusters.molden, with the largest cluster first. Cell axes are removed after generation. |
|
M |
Run MOPAC geometry optimization on the current XYZ file. Requires the $MOPAC environment variable to be set to the MOPAC binary path. The optional $MOPAC_KEYWORDS variable selects the method (default: PM6). Optimized coordinates overwrite the current XYZ file. (Not available in the WebAssembly build.) |
|
Backspace |
Undo the last geometry change. |
|
F6 |
Enable watch mode: automatically reload the current file whenever it changes on disk (useful for following an ongoing calculation). Shift-F6 disables watch mode. |
|
F12 |
Insert atom (same as the Insert key). |
|
k / K |
Dump SLAPAF constraint indices (k) or plain atom indices (K) to the status line. Useful for preparing MOLCAS geometry constraint input. |
Hot keys in Selection mode (1 atom is selected)
|
Command |
Purpose |
|
Space/middle mouse |
remove selection. |
|
F3 |
display a menu with fragments, to be inserted close to selected atom |
|
Insert |
add an atom (or last selected fragment) near selected atom |
|
Delete |
delete selected atom |
|
Home |
place the origin to the position of selected atom |
|
PageUp/PageDown |
Change selected atom to one from the list (H,C,N,O,F,S,Cl) |
|
F4 or = |
invoke an edit box, where you can type an element name for selected atom. |
|
F7 |
Mark atoms connected to the selected atom. |
|
a |
Mark all atoms which are the same elements as selected |
|
F8 |
apply Inversion symmetry around selected atom |
|
+/- |
desaturate the color of the atom |
Hot keys in Selection mode for bond (2 atoms are selected)
|
Command |
Purpose |
|
Space/middle mouse |
remove selection. |
|
Insert |
create a bond between selected atoms |
|
Delete |
delete the bond between selected atoms |
|
PageUp/PageDown |
change the type of the bond between atoms |
|
+/- |
change the distance between atoms. Note that first selected atom (blue) will move. |
|
F4 or = |
invoke an edit box, where you can type an interatomic distance |
|
F7 |
Mark all connected atoms around the first atom in a selected bond into a group. |
|
F8 |
apply translation by the axis specified by selected atoms. |
|
F6 |
Watch the value of selected bond |
|
# |
Change the order of selected atoms |
|
v |
toggle behavior of F8: use C2 symmetry instead of translation |
Hot keys in Selection mode for angle (3 atoms are selected)
|
Command |
Purpose |
|
Space/middle mouse |
remove selection. |
|
+/- |
change the angle between selected atoms. Note that first selected atom (blue) will move. |
|
PageUp/PageDown |
change the angle according to 'standard' angle values (by loop) |
|
F4 or = |
invoke an edit box, where you can type an angle value (or, you may type the value directly) |
|
F8 |
apply mirror symmetry around an plain specified by selected atoms. |
|
F6 |
Watch the value of selected angle |
|
3 |
draw a triangle between points |
|
4 |
Draw a plane |
Hot keys in Selection mode for dihedral angle (4 atoms are selected)
|
Command |
Purpose |
|
Space/middle mouse |
Remove selection. |
|
+/- |
Change the dihedral angle between selected atoms. Note that first selected atom (blue) will move. |
|
F4 or = |
Invoke an edit box, where you can type a dihedral angle value (or, you may type the value directly) |
|
F6 |
Watch the value of selected angle |
|
F7 |
Mark atoms located at other side from the plane defined by selected atoms 2-3-4, in comparison to atom 1 |
|
F7+Shift |
Use selected atoms as a cell, and highlight atoms outside this cell |
|
6 |
Draw a cell, using selected atoms as axis definition. First atom indicate the origin. |
Hot keys in Molden mode for a orbital file (e.g. scf.molden)
|
Command |
Purpose |
|
PageUp/PageDown |
Display charges |
Hot keys in Molden mode for a
frequency file
|
Command |
Purpose |
|
PageUp/PageDown |
Load next/previous vibration mode |
|
F3 |
Draw graphical information in a separate window. |
|
+/- |
Change the speed of vibrations |
Hot keys in Molden mode for a
geometry file
|
Command |
Purpose |
|
PageUp/PageDown |
Load next/previous geometry |
|
F3 |
Draw graphical information in a separate window. |
|
Home |
Show initial structure |
|
End |
Show the resulting structure |
Program GV is used to manipulate molecular structures, build new molecules, etc. It is also used to show orbitals , densities, etc. Here, we shall exemplify how structures are manipulated.
To open a coordinate file, use command gv Water.xyz, or to create a new file, use flag -n: gv -n Water.xyz. If a filename is not specified, GV will open a first coordinate file in the current directory.
Some common hot keys are shown if F1 key is pressed. And extra menu are available via right mouse click.
order to make modifications of coordinates we have to select one,
two, three or four atoms. Selection is made by clicking on an atom.
The first selected atom is covered by blue-colored net, the following
selected atoms are covered by magenta-colored net. The number of
selected atoms determines the behavior of GV.
If only one atom is selected - any operations will refer to this
atom, if two atoms are selected - any operations will be done for the
bond, connecting these atoms, if three atoms are selected -
operations will be performed for the angle, and finally, four atoms
defines the dihedral angle. As a general rule - '+/-' changes the
value of selected object, PageUp/PageDown changes the property, = (or
F4) allows to set up the value.
To remove selection - use 'space'
button, or click middle button on the mouse.Pressing + or - will
modify the value, e.g. if a bond is selected, and user pressed '+'
key, the bond length will increase, so the first selected atom will
move away from the second atom.
Example of selected
atom:
pressing
F4 (or =) and typing O (note that you do not need to focus into
'edit' window), we change the H atom to O.
It
is also possible to use PgUp and change the atom name from the list
of of most common elements.
Backspace button can be used to
Undo modifications.
If two atoms are selected - the bond
length can be modified (using +/- or =/F4)
Note
that first atom (blue) is moving during the operation.
Similarly,
if three atoms are selected - a value of the angle will be modified,
and if four atoms are selected the dihedral angle will be modified.
Pressing PageUp/PageDown will modify the 'property' of
selected object. If only one atom is selected - it will change
element name, if bond is selected - it will change the type of the
bond (single, double, etc.), and for angle selected, it will change
the angle to most common values.
F2 key can be used to save
the coordinate file. The file name will be generated from the
original name, by adding a counter. Shift-F2 will overwrite the
original file. These operations work for XYZ, Molden, and lus files.
If one atom is selected it is possible to use Delete or Insert key to delete or insert a new atom. These operations are available for XYZ, Molden, and lus files. Let make H2O2 molecule started from Water.xyz file.
select a H atom
press PageUp until the atom becomes oxygen.
select another O atom
press F4 and type 1.474 followed by Enter
press Space bar to un select atoms.
select H-O-O
press F4 and type 94.8 followed by Enter
press Space button to unselect atoms
select two Oxygen atoms
press End to create a dummy atom in the middle of the bond
select this dummy atom
press F8 to apply inversion symmetry
Now we will continue to edit the H2O2 molecule. If we select the O-O bond and change interatomic distance - only one atom will move. If we want to move a group (O-H), we have to highlight this group first.
[PLACEHOLDER: screenshot — H₂O₂ molecule with the O–O bond selected (shown in blue); no atoms highlighted yet — the starting state before pressing F7]
There are different ways to highlight atoms into a group. One can do this manually, clicking on an atom with pressed Shift button. Or, it is possible to highlight connected (bonded) atoms, in respect to a selected bond. Select an O-O bond and press F7 button. All atoms, which are connected to the first selected atom will be 'highlighted', and shown as cyan-colored. Finally, holding a Shift key, and dragging a rectangular area by mouse - all atoms inside this rectangle will become highlighted.
Now we can move all highlighted atoms simultaneously:
If you change the length of the O-O bond, all highlighted group will move accordingly. Note that unselection (Space key, or mouse middle click) will remove selection first, and the second use of unselect button will remove highlighting of a group.
The modified value (of a bond length or an angle) is shown on the information line of the screen. Sometime you would like to observe another value during a modification of coordinates. To achieve such behavior, select a bond, or an angle, and press F6 button. Now you can make another selection and make modifications in the geometry. But in this case originally selected value will be watched. Pressing Shift-F6 key switches off the watching mode.
GV contains a short list of molecular fragments, which can be added to a molecule. Press F3 key, to get a list of available fragments. Clicking on a picture with a fragment, you will add this fragment into your screen. If no atoms are selected, the fragment will be added somewhere around the current molecule. If one atom is selected, the fragment will be inserted near the selected atom. Note, that once a fragment has been selected, an Insert key will insert this fragment.
Example. Let's make mesitylene (1,3,5-trimethylbenzene).
open Benzene.xyz file
highlight (not select) 3 hydrogen atoms
[PLACEHOLDER: screenshot — benzene with 3 alternate hydrogen atoms highlighted cyan (Shift+click); the other 3 H atoms and all 6 C atoms are unchanged]
Press Delete
select C atom, press F3 and click on CH3 icon
select another C atom, and press Insert
select third C atom, and press Insert
To make modifications of coordinates via distances and angles, you might need dummy (reference) atoms. These dummy atoms can be set by End button. If there is no selected atoms, 'End' key will add dummy atoms located on X- Y- and Z- axis. If a bond is selected, the dummy atom will be placed in the middle of the bond. For example, if you have a planar molecule, but it is not oriented according to Cartesian axis, you can add dummy atoms on each axis, highlight all atoms in the molecule, and select a dihedral angle between the plane of the molecule and desired plane, created by dummy atoms.
Program GV can recognize the symmetry elements of a molecule, or apply symmetry operations for all, or highlighted atoms in the molecule. If no selection is made, F8 key displays symmetry elements of the molecule. Two symmetry engines are available: msym (default) and findsym. Press Shift-F8 to toggle between them.
If some atoms are selected, F8 key will apply a symmetry
operation: in case of only one atoms being selected inversion, in
case of a bond, translation or C2 axis, and
in case of an angle - a mirror plane. This feature can be used to
construct symmetrical molecules.
Let us start from a benzene molecule. Delete two hydrogen
atoms (in ortho positions), and select two carbon atoms (with broken
bonds). Press 'v' to use C2 instead of
translation. Pressing F8 key will duplicate the structure, creating
naphthalene.
If,
during such transformation coordinates of a new atom are very close
to another atom - the average coordinates will be used. For example,
if you have an almost planar molecule, you can flatten it, by
applying a mirror plane symmetry. Let move one carbon atom in benzene
out of plane for a small angle.
Now
we can select 3 carbon atoms, and press F8 to mirror the molecule.
Moved carbon atom will return into the plane.
Also
note, that if a part of the molecule is highlighted, the symmetry
operation will be applied only for highlighted part.
In the example
below, we highlighted 2 atoms, and select 2 another. F8 will translate
highlighted group into vector defined by selected atoms.
GV can be customized. Press F9 key to save current setting. It will create a directory .molcasgv in user HOME directory, with default settings for used colors, initial sizes etc. User can edit this files to reset the default values.
GV can remember a ViewPoint (the current orientation of the molecule) and save it to a file. Later this file can be used to rotate another molecule accordingly. Use keys (v/V) to save or restore Viewpoint.
In some occasions, user would like to change the order of atoms in XYZ file. Although the simplest way to do this includes usage of editor, GV provides some tools for resorting. If two atoms are selected, and # button pressed, selected atoms will exchange their order. Pressing # resorts atoms.
GV provides some possibilities to
modify appearance of the picture. To highlight some part of the
molecule,
user can highlight a part of the molecule, and use '-' key
to make these atoms looks pale. 'A' key changes the
look of
atoms.
[PLACEHOLDER: screenshot — molecule with some highlighted atoms rendered pale/faded using the ‘−’ key; the highlighted group appears washed out against the fully opaque rest of the molecule]
GV understands some extensions of XYZ file. At the end of XYZ file it is possible to add lines #sphe (followed by 2 coordinates), #axis (followed by 2 coordinates), #tria (followed by 3 coordinates) to add correspondingly a sphere, an axis, or a triangle.
GV automatically recognises CIF and MOLCAS SEWARD/GATEWAY input files and converts them to XYZ internally — no external tools required.
CIF files (Crystallographic Information Files, extension .cif):
Run gv structure.cif
GV reads the unit cell, symmetry operators, and atomic coordinates, expands them into the asymmetric unit, and displays the result.
[PLACEHOLDER: screenshot — GV window showing a crystal structure loaded from a .cif file, with unit cell axes visible]
SEWARD/GATEWAY input files (MOLCAS input, typically .inp or any file containing &GATEWAY or &SEWARD):
Run gv molcas_input.inp
GV detects the &GATEWAY / &SEWARD marker, converts Basis Set and Xfield sections to XYZ (applying symmetry generators if present), and opens the result.
[PLACEHOLDER: screenshot — GV window showing a molecule loaded from a MOLCAS .inp file; compare with the original input to show correct geometry expansion]
When a coordinate file contains unit cell vectors (e.g. an XYZ file exported from a periodic calculation, or loaded from a CIF), GV shows the cell axes on screen and enables cluster generation.
[PLACEHOLDER: screenshot — GV showing a periodic crystal structure with the three unit cell axes (a, b, c) drawn in red/green/blue]
To generate a cluster of concentric shells around a chosen atom:
Click on the atom that should be at the centre of the cluster (it will be highlighted in blue).
Press C.
GV builds a supercell, cuts it into clusters of increasing radius (each adding one coordination shell), writes them to basename_clusters.molden, and immediately opens that file. The largest cluster is shown first. Cell axes are removed and the atom selection is cleared.
[PLACEHOLDER: screenshot — atom selected (blue) in a periodic structure before pressing C]
[PLACEHOLDER: screenshot — largest cluster loaded from _clusters.molden; selected atom is at the origin, surrounded by coordination shells]
Use PageDown to step through smaller clusters (or PageUp for larger ones). The cluster frames are stored in Molden geo format, so all the Molden navigation keys apply.
[PLACEHOLDER: screenshot — a smaller cluster after pressing PageDown several times; status bar shows current frame number and atom count]
GV can drive a MOPAC semi-empirical geometry optimization and reload the result directly, without leaving the viewer. This requires the $MOPAC environment variable to point to the MOPAC binary.
Setup (once, e.g. in ~/.bashrc):
export MOPAC=/opt/mopac/mopac
export MOPAC_KEYWORDS="PM7 GNORM=0.01"
# optional; default is PM6
Open an XYZ file in GV.
Make sure no atoms are selected (press Space or middle-click to deselect).
Press M.
GV writes a .dat input file, runs MOPAC, parses the optimized Cartesian coordinates from the .out file, overwrites the .xyz file, and reloads it.
[PLACEHOLDER: screenshot — molecule before MOPAC optimization (e.g. manually distorted geometry)]
[PLACEHOLDER: screenshot — same molecule after optimization; status bar shows "MOPAC done" or similar; bond lengths are now at equilibrium values]
Note: this feature is not available in the WebAssembly build.
Watch mode lets you monitor an ongoing calculation in real time. GV polls the current file and automatically reloads it whenever the file changes on disk.
Open the output XYZ file that your calculation is writing to (e.g. opt.xyz).
Press F6 to start watching.
Each time the calculation writes a new geometry, GV reloads and displays it. Use m to animate through the accumulated frames.
Press Shift-F6 to stop watching.
[PLACEHOLDER: screenshot — GV in watch mode; status bar indicates "Watch: opt.xyz"; molecule is mid-optimization with partial geometry change visible]
Watch mode works for XYZ, molden, and multi-frame files. It is particularly useful combined with m (animation) to see the trajectory build up as the calculation runs.
GV can record a session to a text file and play it back later. This is useful for creating reproducible demonstrations, automated tests, or batch processing scripts.
To start recording, launch GV with:
gv --record session.gvr molecule.xyz
All keyboard, mouse, and menu events are written to session.gvr with millisecond timestamps. To play back:
gv --play session.gvr molecule.xyz
The playback file may also contain script directives (without timestamps) to control the session:
|
Directive |
Purpose |
|
speed <factor> |
Playback speed multiplier (e.g. 2.0 = twice as fast). |
|
wait <ms> |
Insert an extra pause (milliseconds) before the next event. |
|
open <filename> |
Load a different molecule or grid file during playback. |
|
status <text> |
Display a message in the GV status bar. |
|
echo <text> |
Print a message to standard output. |
Lines beginning with # are treated as comments.
[PLACEHOLDER: screenshot — GV window during session playback; status bar shows “Playing back session.gvr”; molecule is mid-rotation or mid-edit as the recorded events replay]
For server-side or automated rendering without a display, GV can be compiled against the OSMesa off-screen rendering library:
make osmesa (requires libosmesa6-dev)
The OSMesa build renders entirely in memory; no X11 display, GPU, or xvfb is needed. Combined with the -q flag, it exports PNG images and exits:
gv -q -o all -v molecule.lus
This exports every orbital to separate PNG files named molecule_MO001.png, molecule_MO002.png, etc. The -v flag applies an automatic best viewpoint. The -o flag accepts all, a single number, or a comma-separated list of orbital numbers.
[PLACEHOLDER: screenshot — a directory listing or file manager showing the exported PNG files (molecule_MO001.png, molecule_MO002.png, …) produced by the OSMesa headless build]
GV can be compiled to WebAssembly for in-browser visualization:
make -f Makefile.emscripten (requires Emscripten SDK)
The browser build provides the same core visualization features as the native build. Grid density differences (Diff menu in the toolbar) are fully supported: load a second .lus file, choose Minus or Plus and Same-space or Align (Kabsch rigid-body alignment), then click Compute Diff to display the result immediately.
The following features are not available in the WebAssembly version:
MOPAC geometry optimization (key M) — requires a local binary.
Sub-window multiview panels — the browser uses canvas overlays instead.
Font mode cycling (key F) — font is fixed.
Key remapping via gv.keys file.
Record/playback (--record / --play) — file access is sandboxed.
The JavaScript interface exposes functions such as gv_load_file, gv_compute_diff, gv_key_page_up, gv_save_png, gv_make_clusters, and others, allowing the browser UI to control GV programmatically. PNG images are downloaded directly via the browser's download mechanism.
[PLACEHOLDER: screenshot — GV running in a web browser; toolbar buttons (Save, Diff, Actions, Options, Colors, Cell) are visible at the top; a molecule or orbital is displayed in the canvas below]
To visualize orbitals and density by program GV
you have to compute a grid file (.grid)
first by using GRID_IT program from
MOLCAS package.
Note that the quality of the picture depends on
the keywords used in GRID_IT input.
Orbitals can be browsed by PageUp/PageDown key, or selected by a menu, invoked by the right mouse button. If you know the symmetry and number of an orbital, you would like to display, you can press F4 (or =) key, and press # followed by symmetry and orbital number, e.g. (# 1 3).
In order to change isosurface value, you can use + or - key, or press F4 key, and type a desired isosurface value.
Sometime you would like to filter orbitals, shown by GV. Pressing Delete key you can hide an orbital. All hidden orbitals will become visible if Insert key is pressed. Alternatively, you can apply a filter to hide some orbitals by a criteria: symmetry number (s), orbital energy (e), occupation number (o), or typeindex (i). Usage of filters is clear from the following example: Press F4 key and type #: followed by a filter command - #:s14 to display orbitals only from symmetry 1 and 4, #:e-2:1 to display orbitals in an energy range between -2 and 1.
When the grid file is loaded, GV displays subspaces (frozen, inactive, RAS1, RAS2, RAS3, secondary, deleted). User can modify the typeindex of the orbital, save (F2 key) the INPORB file (it will have an extension GvOrb), and use this file in the following RASSCF calculation without having to reorder the orbitals. In order to modify the index of the displayed molecule, user can use a menu, or press one of the keys: fi123sd. Pressing Space key (or middle mouse button) changes the typeindex in a loop.
It is possible to display all orbitals of the grid file simultaneously. Press F3 key to get the screen with all orbitals.
By default, the background (rainbow colors) for each orbital corresponds to the type index information. Clicking on an individual orbital you can use the same keys to modify it's type, or delete it from the screen. Pressing F3 button again, or Escape will close the multiview mode. Using PageUp/PageDown in multiview mode will increase/decrease the sizes of subscreens. These features of GV can be quite helpful for selecting the different orbital spaces in RASSCF calculations.
GV can also be used to compare densities from different GRID_IT calculations. A command gv --minus scf.grid rasscf.grid --out diff.grid computes the density difference (SCF − RASSCF) and writes it to diff.grid. The shorthand flags --minus and --plus are equivalent to -a -1 and -a 1 respectively.
The simplest case requires both grid files to have the same mesh (same Net= dimensions). If the two calculations used the same coordinate frame but different mesh resolutions, add --same-space: GV will trilinearly resample the first grid onto the second grid’s mesh before forming the linear combination.
If the two densities come from slightly different molecular geometries (e.g. consecutive steps of a geometry optimisation or points along an IRC path), use --align. GV checks that both files contain the same atoms in the same order, verifies that no atom has moved more than the displacement tolerance (default 2 Å, overridden with --align-tol), and then computes an optimal rigid-body transformation (Kabsch rotation + translation) from the paired atom positions. Grid2 is resampled onto grid1’s coordinate frame using trilinear interpolation, the linear combination is formed, and the result is written on grid1’s mesh with grid1’s atom positions. The alignment RMSD is printed to stderr so you can check whether the fit is reasonable:
gv --align --minus step_001.grid step_002.grid --out ddiff.grid
For the interaction-density workflow (comparing the density of a complex AB to the sum of its fragments A and B in ghost-atom calculations) the grids must share the same coordinate frame. Compute the fragment sum first: gv --plus A.grid B.grid --out sum.grid, then subtract it from the complex: gv --minus AB.grid sum.grid --out interaction.grid.
GV can compute and display an electrostatic potential (ESP) surface: a Gaussian-blended van der Waals isosurface colored by the Coulomb potential, with red for electron-rich (negative) regions and blue for electron-poor (positive) regions. The ESP is computed as
E(r) = ∑i qi / |r − ri|
where qi are point charges at the atomic positions. Three sources of charges are supported.
If a .molden file is loaded that contains a [CHARGE] (MULLIKEN) or [CHARGE] (LOPROP) section, the ESP surface can be computed directly:
Right-click → ESP surface → Compute from Molden charges (native build).
In the browser build, use the Actions menu → ESP surface (Molden charges).
LoProp charges (if present) are preferred over Mulliken charges when both sections exist.
A plain-text file with one atom per line in the format
N comment Element x y z charge ...
where coordinates are in Ångström and charges in electron units (e), can be loaded via Right-click → ESP surface → From XYZ+charges file (native) or the Actions menu in the browser build (upload button).
A Gaussian Cube file (.cube) containing an electrostatic potential grid — as produced by Gaussian, ORCA, or similar programs — can be loaded via Right-click → ESP surface → From EPOT grid (Cube format) or the Actions menu in the browser build (upload button). The atom positions from the currently loaded file are used for the van der Waals surface; the cube grid values are interpolated onto the surface vertices by trilinear interpolation. Cube coordinates are converted from Bohr to Ångström and values from e/Bohr to e/Å automatically. The color range is auto-scaled from the cube data.
The script molden2esp_lus.py (included in the GV distribution) reads atom positions and Mulliken/LoProp charges from a Molden file, computes the Coulomb ESP on a 3-D grid, and writes a Luscus .lus file with GridName= Electrostatic that can be loaded into GV as a regular grid file for isosurface display:
python3 molden2esp_lus.py scf.molden esp.lus python3 molden2esp_lus.py scf.molden esp.lus --step 0.2 --pad 3.0
The --step option sets the grid spacing in Ångström (default 0.25) and --pad sets the margin beyond the van der Waals radius of each atom (default 3.0 Å). The script requires only the Python standard library.
[PLACEHOLDER: screenshot — ESP surface on a small molecule; red region near electronegative atom (e.g. O), blue region near electropositive hydrogen; color bar or legend optional]
The color mapping uses three parameters (defined in esp.c):
esp_max_value — ESP magnitude (e/Å) at which the color reaches full saturation (default 0.10).
esp_white_region — ESP magnitude below which the surface appears white (default 0.025).
esp_color_pos — RGBA color for positive ESP (default blue, 0,0,1,0.7).
esp_color_neg — RGBA color for negative ESP (default red, 1,0,0,0.7).
Use Show/Hide ESP surface to toggle visibility without discarding the computed surface, and Clear ESP surface to remove it. Loading a new file clears the ESP surface automatically.