UoC crest

Check2xsf and Crystals

Some notes on visualising CASTEP results from periodic systems. This assumes that you have already read the page on visualising data for aperiodic systems.


Not all viewers can automatically tile unit cells. The one used for most of these examples, XCrysDen, can easily. However, there are complications, as will become apparent later.

The first example system is silicon, with an 8 atom cubic cell.

    5.46    0.00    0.00
    0.00    5.46    0.00
    0.00    0.00    5.46

    Si    0.00    0.00    0.00
    Si    0.00    0.50    0.50
    Si    0.50    0.00    0.50
    Si    0.50    0.50    0.00
    Si    0.75    0.25    0.75
    Si    0.25    0.25    0.25
    Si    0.25    0.75    0.75
    Si    0.75    0.75    0.25


kpoints_mp_grid 2 2 2
kpoints_mp_offset 0.125 0.125 0.125
cut_off_energy :   150
num_dump_cycles : 0

Without even running Castep, one can use check2xsf to extract the structure from the .cell file:

$ check2xsf si8.cell si8.xsf
$ xcrysden --xsf si8.xsf

Initial display of silicon

This is an unpromising start, partly because XCrysDen fails to find any bonds in bulk silicon! To solve this problem, choose Modify, Atomic Radius, and increase the "Chemical connectivity factor" from 1.05 to 1.1. Choose also Display, Crystal Cells, Display, Co-ordinate System, and rotate slightly.

Silicon with bonds

Finally one can choose Modify, Number of Units Drawn, and see a larger part of the crystal, with the new bonds being added automatically. Here a 2x1x3 slab is created.

A silicon supercell


The XSF file for the charge density is readily generated using the `-c' switch to check2xsf, and can be viewed as above. One can first follow the above steps to view the structure, and then load the 3D data via the tools menu in the usual fashion. The initial result should be something like the below.

A silicon supercell with isosurface

By default the 3D data (which require a lot of memory) are plotted in just one unit cell. However, one can expand the isosurface to the whole supercell, or to a smaller supercell.

A silicon supercell with expanded isosurface

Odd Unit Cells

One rarely wishes to use the above eight-atom cell for a Castep calculation, for a smaller, two-atom, primitive unit cell exists, and, even give the extra k-points one should use in such a cell, the gain in the parts of Castep which scale quadratically or cubically with system size more than offsets this. The cell file for the two-atom unit cell would be:

Si 0.0     0.0     0.0
Si 0.25    0.25    0.25

2.73  2.73 0.00
2.73  0.00 2.73
0.00  2.73 2.73

kpoints_mp_grid 3 3 3
kpoints_mp_offset 0 0 0

The resulting energy will not be precisely a quarter of the previous value: the k-point sampling is different, the basis set is (subtly) different, the choice of FFT grid may be very different, etc.

The resulting unit cell does not form conveniently-shaped supercells: any attempt results in something long and thin.

A silicon 2-atom supercell

Check2xsf can overcome this problem in many common cases. It has a `-x' option which will expand a rhombohedral cell back to a cubic/hexagonal one, interpolating any densities at the same time. This cell can then be used as above.