User Interface

Operational modes

Den2Obj has three operational modes

  1. Isosurface generation

  2. Filetype conversion

  3. Dataset generation

Isosurface generation is the default mode and is used to generate isosurfaces from scalar fields. Filetype conversion is mainly used to convert relatively large storage formats such as CHGCAR or Gaussian cube files to the compressed .d2o file format. Finally, dataset generation is mainly used for testing or educational purposes.

Isosurface generation

To perform an isosurface creation, one simply runs:

./den2obj -i <path-to-scalarfield> -o <mesh-file> -v <isovalue> [-c] [-d] [-a <algo>]

wherein path-to-scalarfield is a scalar field file format of either of the following types

mesh-file is any of the following supported formats

and isovalue the isovalue for the isosurface.


For visualizing wave functions, two isosurfaces are needed. One for the positive part and one for the negative part of the wave function. Simply run Den2Obj with the -d directive to generate an isosurface for both signs (+/-) of the isovalue.

  • The argument -c is optional. If used, the isosurface will be rendered such that the center of the unit cell is located at the origin.

  • The argument -d is optional. If used, both signs of the isosurface will be rendered. This is useful when rendering wave functions rather than densities.

  • The argument --algo is optional. It can be set to either marching-cubes or to marching-tetrahedra. The default option is marching-cubes.

Marching tetrahedra versus marching cubes

Marching tetrahedra (left) versus marching cubes (right). Edges are explicitly visualized. Observe that whilst using the same resolution of the dataset, when using marching tetrahedra more facets are created and thus a higher resolution isosurface.

Filetype conversion

Den2Obj offers the conversion to two different file types.

To perform the conversion, one executes:

./den2obj -i <path-to-scalarfield> -o <mesh-file> -t [-a <algo>]


Creating OpenVDB files requires the OpenVDB module to be compiled. See the installation section for more details.

With the optional -a <algo> tag, the compression algorithm can be selected. <algo> can be anything of the following values.

  • auto

  • lzma

  • bzip2

  • gzip

When auto is selected or when no -a directive is provided, automatically the best compression algorithm is taken by checking all possible compressions.

Dataset generation

For testing and learning purposes, Den2Obj can generate a number of datasets. This is done via the -g <dataset name> directive, which takes a valid dataset name as input.

For example, to build the genus2 dataset, one runs:

./den2obj -g genus2 -o genus2.d2o [-a <algo>]

It is possible to overrule the preferred compression algorithm using the -a <algo> directive. For example, to force BZIP2 type of compression, one runs:

./den2obj -g genus2 -o genus2.d2o -a bzip2

When no -a is provided, automatically the best compression algorithm is used by checking the inflation ratio of all possible compression algorithms.

The following datasets are available: * genus2 * benzene_homo * benzene_lumo