An open API service indexing awesome lists of open source software.

https://github.com/briling/v

A simple X11 molecular viewer
https://github.com/briling/v

computational-chemistry molecular-visualization quantum-chemistry x11

Last synced: 3 months ago
JSON representation

A simple X11 molecular viewer

Awesome Lists containing this project

README

          

# v

A simple X11 molecular viewer.

![Animation of 128 molecules](figures/intro.gif)

## Contents
* [Supported formats](#formats-)
* [Download](#download-)
* [Build](#build-)
* [Usage](#usage-)
* [Examples](#examples-)

---

## Supported formats [↑](#download)
- [Priroda](http://rad.chem.msu.ru/~laikov) input and output files
- [`.xyz`](https://en.wikipedia.org/wiki/XYZ_file_format) files
- [extended `.xyz`](https://github.com/libAtoms/extxyz) files (currently the extra columns are ignored)

## Python package (wrapper / API) available

See python package page
[here.](python/README.md)

Provides wrapper scripts with a simple installation and
allows to open unsupported file formats with `cclib`.

## Download [↑](#download)
```
wget https://github.com/briling/v/releases/download/v2.0/v.2.0 -O v
chmod +x ./v
```

## Build [↑](#contents)
```
make v
```

### Requirements:
* `GNU/Linux` or `Cygwin`
* `X11`
* `gcc >= 4.7`
* `libX11-devel libXpm-devel xproto-devel` (`libx11-dev libxpm-dev x11proto-dev` on Ubuntu)
* `make`

## Usage [↑](#contents)
```
./v file [file2 ... fileN] [options]
```
A filename `-` stands for the standard input.

Show the reference:
```
./v
```

Command-line options

| | |
| ------------------------ | ------------------------------------------------------------- |
| `vib:%d` | force to show geometries (`0`) / vibrations (`1`) |
| `bonds:0` | disable bonds |
| `bohr:1` | assume input files are in Bohr (default is Å) |
| `dt:%lf` | delay between frames in seconds (default 0.02) |
| `symtol:%lf` | tolerance for symmetry determination in Å (default 0.001) |
| `bmax:%lf` | max. length of a bond to display |
| `z:%d,%d,%d,%d,%d` | show an internal coordinate (`1,i,j,0,0` — distance i-j; `2,i,j,k,0` — angle i-j-k; `3,i,j,k,l` — torsion i-j-k-l) |
| `rot:%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf` | rotation matrix to start with (default identity matrix) |
| `frame:%d` | frame to start with (default 1) |
| `font:%s` | font ([xlfd](https://en.wikipedia.org/wiki/X_logical_font_description)) |
| `cell:b%lf,%lf,%lf` | cuboid size in a.u. (for periodical boundary conditions) |
| `cell:%lf,%lf,%lf` | cuboid size in Å |
| `cell:b%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf` | cell parameters in a.u. |
| `cell:%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf` | cell parameters in Å |
| `shell:b%lf,%lf` | spheres radii in a.u. |
| `shell:%lf,%lf` | spheres radii in Å |
| `center:%d` | origin is geometric center (`1`, default) / center of mass (`2`) / as is (`0`) |
| `inertia:%d` | if rotate molecules wrt axis of inertia (`1`) or not (`0`, default) |
| `gui:%d` | normal (default `1`) / headless (`0`) mode |
| `com:%s` | command sequence for `gui:0` |
| `exitcom:%s` | command sequence to run on exit (same as for `gui:0`) |

Keyboard reference

| | |
| ------------------------------ |---------------------------------------------------------- |
| `←`/`↑`/`→`/`↓`/`pgup`/`pgdn` | rotate (slower with `ctrl` or `shift`)
| `w`/`a`/`s`/`d` or `↑`/`←`/`↓`/`→` on numpad | move (slower with `ctrl` or `shift`)
| |
| `0` | go to the first point
| `=` | go to the last point
| `enter`/`backspace` | next/previous point
| `ins` | play forwards / stop (vibration mode: animate selected normal mode / stop)
| `del` | play backwards / stop
| |
| `home`/`end` | zoom in/out
| `1`/`2` | scale bond lengths
| `3`/`4` | scale atom sizes
| |
| `.` | show point group
| |
| `n` | show/hide atom numbers
| `t` | show/hide atom types
| `l` | show/hide bond lengths
| `b` | show/hide bonds
| |
| `tab` | read new points
| `r` | reread file
| `x` | print molecule (Priroda input + bonds)
| `z` | print molecule (`.xyz`)
| `p` | print molecule (input for an `.svg` generator)
| `u` | print current rotation matrix
| `m` | save the current frame ([`.xpm`](https://en.wikipedia.org/wiki/X_PixMap) format)
| `f` | save all frames (vibration mode: save all frames to animate the selected normal mode)
| |
| `j` | jump to a frame (will be prompted): `enter` to confirm, `esc` to cancel
| |
| `q` / `esc` | quit

Mouse (in development)
One can also use the mouse to rotate the molecule and zoom in/out.

Headless mode (in development)

If run in the headless mode with `gui:0`, the symbols from the standard input are processed
as if the corresponding keys were pressed in the normal mode.
Right now, only `p`, `x`, `z`, and `.` are available.
Command-line option `com:%s` overrides the standard input.
These examples are equivalent:
```
> echo . | ./v mol/mol0001.xyz gui:0
D*h

> ./v mol/mol0001.xyz gui:0 com:.
D*h

> cat mol/mol0001.xyz | ./v - gui:0 com:.
D*h
```

## Examples [↑](#contents)
* `mol/C3H6~mCPBA_01x11.qm.out` — geometries + vibrations
```
./v mol/C3H6~mCPBA_01x11.qm.out font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![Transition state mode animation](figures/C3H6~mCPBA_01x11.qm.out.gif)
```
./v mol/C3H6~mCPBA_01x11.qm.out vib:0 z:1,23,24,0,0
```
![Transition state optimization](figures/C3H6~mCPBA_01x11.qm.out_03.gif)
* `mol/S8.qm.out` — geometries
```
./v mol/S8.qm.out z:1,1,2,0,0 font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![S8 equilibrium structure](figures/S8.qm.out_69.gif)
* `mol/C10H16.qm.out` — vibrations
```
./v mol/C10H16.qm.out font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![Adamantane mode animation](figures/C10H16.qm.out.gif)
* `mol/1372_D02.340_1.out` — PBC simulation
```
./v mol/1372_D02.340_1.out bonds:0 cell:b10.7,10.7,1.07 font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![Atoms in cell with PBC](figures/1372_D02.340_1.out_1087.gif)
* `mol/mol0001.xyz`, `mol/mol0002.xyz` — `.xyz` files with atomic numbers and atomic symbols
```
./v mol/mol0001.xyz mol/mol0002.xyz symtol:1e-2 font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![Dimethyl ether structure](figures/mol0002.xyz_3.gif)

* `mol/MOL_3525.xyz` — organic crystal with non-orthogonal cell
```
./v mol/MOL_3525.xyz cell:8.929542,0.0,0.0,4.197206,8.892922,0.0,0.480945,2.324788,10.016044 font:-*-*-medium-*-*--15-*-*-*-*-*-*-1
```
![Organic crystal cell](figures/MOL_3525.xyz_1.gif)

---
![Periodic table of elements](figures/periodic.png)