Tutorial 1

Preparation of atomic structure and electron density dataset.

From the LRZ Summer of Simulation 2017 project Photocatalytic water-splitting with carbon nitride materials: Combining the condensed matter and molecular approaches (Johannes Ehrmaier)

Data preparation

We begin with a cube file:


The cube file contains information about heptazine in a water box as a periodic system and the charge response of the bright pipi^* state of heptazine.


We will start by visualizing the atoms in the system to obtain a spatial view of the atomic distribution.


atomscaling 1
repetitions 2 2 2
cubefile drho-of-eign-3.cube

background 0 0 0

Isosurface extraction

We open drho-of-eign-3.cube in Paraview

We select "Gridded data"

We extract an isosurface at 0.004 using the "Contour filter"

We save the isosurface using "File -> Export scene" and save as "VRML files (*.vrml).

The procedure can be scripted if required.

Isosurface conversion

We process the isosurface in meshlab.

-Rename the isosurface to 1-04.wrl (Paraview saves VRML2 files by default which meshlab expects as *.wrl)

-Optional: Mesh simplification using Filters -> Remeshing, Simplification and Reconstruction -> "Quadric Edge Collapse Decimation" with "Percentage Reduction" set to 0.5 (50% reduction), then Apply

-Export as 1-04.ply using File -> Export Mesh as -> Stanford Polygon File Format (*.ply). Select Vert->Normals and "Binary encoding".

The procedure can be scripted if required (Filters -> Show Current Filter Script -> Save Script).

Optional: extraction of other isosurfaces

The procedure in the previous two sections can be repeated using the isovalue -0.004 and filenames 1--04.wrl and 1--04.ply.

To prepare the new isosurfaces, change the value in the contour filter, click apply, then save.

Optional: simplification of the cube file

Since we now have the isosurface, we do not need the volumetric data in the cube file.

We open the cube file in an editor such as notepad++, and delete the volumetric data (discard lines 383 to the end of the file).

Final cube and ply



Final ncfg


atomscaling 1
repetitions 1 1 1
cubefile drho-of-eign-3-header.cube

isos 1
values "04"
colours 0.186 0.806 0.286 0.5

background 0 0 0

2-isosurface ncfg

Replace these lines from the ncfg above:

isos 2
values "04" "-04"
colours 1 0.5 0 0.5      0 0.25 0.4 0.5

Visualization in VR tools


Using only one isovalue at +0.004

HTC Vive

Using only one isovalue at +0.004

Google Cardboard

Using only one isovalue at +0.004

Using two isovalues at +0.004 and -0.004

Desktop tool

VMD visualization using two isovalues at +0.004 and -0.004:


Dataset provided by Johannes Ehrmaier.