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: 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

Visualization in VR tools


HTC Vive

Google Cardboard

Desktop tool


Dataset provided by Johannes Ehrmaier.