The Swiss-army knife of atomic simulations

Tutorial: Unit Cells for Various Lattice Types

In this tutorial you will learn how to generate unit cells for various lattice types with Atomsk. You will also learn how to generate output files for various visualization softwares.

▶ For more information, refer to the corresponding documentation page.

Generating unit cells can be useful to make illustrations, e.g. to explain the basics of crystallography to students or to the public. In atomic-scale simulations, it is often the first step before constructing more complex systems. Atomsk can be used to generate unit cells, thanks to the mode "--create".

In addition to this tutorial, it is recommended to read the documentation page of the mode "--create".

1. The face-centered cubic (fcc) unit cell of aluminium and copper

Many metals, like aluminium, copper, or nickel, crystallize into the fcc lattice.

Let us start with aluminium (symbol Al). Aluminium is a fcc metal with a lattice constant a=4.046 Å at ambiant temperature. To generate a unit cell, Atomsk can be executed like this:

atomsk --create fcc 4.046 Al aluminium.xsf

ⓘ This lattice constant is given as an example, and must be adjusted depending on the type of simulation you want to perform (DFT, interatomic potential, etc.).

With this command, Atomsk will write the atom positions in the output file "aluminium.xsf". It is a text file, and if you open it in a text editor (like Notepad) it will look like this:


# Fcc Al oriented X=[100], Y=[010], Z=[001].
4.04600000 0.00000000 0.00000000
0.00000000 4.04600000 0.00000000
0.00000000 0.00000000 4.04600000
4.04600000 0.00000000 0.00000000
0.00000000 4.04600000 0.00000000
0.00000000 0.00000000 4.04600000
4 1
13 0.00000000 0.00000000 0.00000000
13 2.02300000 2.02300000 0.00000000
13 0.00000000 2.02300000 2.02300000
13 2.02300000 0.00000000 2.02300000

The vectors of the unit cell and the positions of atoms are written, respecting the XSF format. One can see that the cubic unit cell of the fcc lattice contains 4 atoms. The first line (starting with #) is a comment that is automatically generated by Atomsk. This file can be opened with XCrySDen or with VESTA, allowing to visualize the unit cell in 3-D:

Now, let us construct a unit cell of copper. Copper (symbol Cu) also has a fcc lattice, but with a different lattice parameter: a=3.597 Å. This unit cell can be generated with:

atomsk --create fcc 3.597 Cu copper.xsf cfg

Note the additional "cfg" at the end of the command line. This time, Atomsk will generate two output files: "copper.xsf" and "copper.cfg". The latter can be visualized with Atomeye, as illustrated below:

Note that because the unit cell is very small, Atomeye automatically duplicates it twice in each direction, and announces that there are "24 atoms" in the system. But opening the file "copper.cfg" in a text editor will convince you that there are really only 4 atoms in this system.

Alternatively, files in the CFG format may also be visualized with OVITO, which shows the correct number of atoms:

2. The body-centered cubic (bcc) unit cell of iron and tungsten

As a second example, let us turn to another lattice type: the body-centered cubic (bcc) lattice. This is the lattice of many transition metals, like iron (Fe) or tungsten (W).

Obviously, in the command-line the parameter "fcc" has to be replaced with "bcc". For example, bcc iron has a lattice parameter 2.856 Å, so one has to use:

atomsk --create bcc 2.856 Fe xsf cfg

Note that in this command-line, we did not specify an output file name. Only output file formats are specified: "xsf" and "cfg". In this situation, Atomsk will use the name of the element (here "Fe") to generate the file name. So, two files will be written by Atomsk: "Fe.cfg" that can be visualized with Atomeye, and "Fe.xsf" that can be opened with XCrySDen.

Similarly, to generate a unit cell of tungsten with lattice constant 3.155 Å:

atomsk --create bcc 3.155 W xsf

Likewise, Atomsk will use the element symbol ("W") to generate the output file name: "W.xsf". This file can be opened with XCrySDen, or with VESTA:

3. The rocksalt lattice with two atom types

The previous lattice types are quite simple and apply to only one type of atoms. Some lattices can host several chemical species, like the lattice of the table salt: natrium chloride (NaCl) with the rocksalt lattice.

Atomsk can generate this type of lattice with the keyword "rocksalt". After the lattice constant (5.64 Å for NaCl), two chemical symbols have to be provided:

atomsk --create rocksalt 5.64 Na Cl xsf

With these instructions Atomsk will construct a unit cell of rocksalt NaCl, and write it into the file "NaCl.xsf", which can be visualized with VESTA:

4. The hexagonal lattices

The mode "--create" is not limited to cubic lattices. One can also generate hexagonal lattices, namely hexagonal close-packed (hcp), wurtzite, or graphite.

Let us create a unit cell of hcp magnesium. Two lattices constants, a and c, must be provided:

atomsk --create hcp 3.21 5.213 Mg Mg.xsf

Visualization (here with VESTA) shows that indeed, a unit cell of hcp magnesium was created:

If you wish to obtain an equivalent orthogonal cell (but that still respects the hexagonal lattice), you may use the option "-orthogonal-cell". This option searches for linear combinations of the cell vectors, so as to obtain a rectangular box, and then it fills this new box with atoms. In the case of hcp magnesium, you can use the following command:

atomsk --create hcp 3.21 5.213 Mg -orthogonal-cell Mg.xsf

If you visualize this system, you will see that it is an orthogonal cell of hcp magnesium:

Similarly, Atomsk also allows you to generate a graphite lattice:

atomsk --create graphite 3.21 5.213 C graphite.xsf

Here, VESTA displays bonds, and displays carbon atoms that are outside of the box. But the text file actually contains just the four atoms of the graphite unit cell, as you can verify by opening it in a text editor.

6. Other structures

What if I want to create a unit cell that is not supported? Then, the best is to obtain a file describing the structure from another source. In particular, many structures are described in files in the CIF format, which can be obtained from online databases like Crystallography Open Database or the American Mineralogist database. You may also try to enter the name of your material followed by "CIF" in your favorite search engine. This tutorial explains how Atomsk can import CIF files.

Alternatively, if you know the space group and Wickoff positions of the compound, you can use a dedicated software to construct the unit cell. For example, VESTA has a built-in capability for constructing atomic structures (open VESTA, go to File → New structure).

7. Duplicate a unit cell to form a supercell

Often, one wants to duplicate the unit cell of the material to generate a larger crystal, called a "supercell". This can be achieved with the option "-duplicate". This option can be used in combination with the mode "--create", for instance the following will create a supercell of tungsten, containing 3 unit cells along X, 4 along Y, and 10 along Z:

atomsk --create bcc 3.155 W -duplicate 3 4 10 xsf

Or, if you already have a file containing a unit cell (or any atomic system), then you may duplicate it:

atomsk initial.xsf -duplicate 3 4 10 final.cfg

Duplication always uses the cell vectors as translation vectors, so as to maintain the periodicity of the crystal. So, if your box vectors are not orthogonal or not aligned with Cartesian axes, do not worry: Atomsk does not use Cartesian directions to duplicate, but the vectors of the initial cell, whatever they may be.

8. Further remarks

As you can see from the previous examples, it is very simple to generate files for visualization with Atomsk. If you have a favorite visualization software, then you may adapt the following tutorials to generate files in a suitable format. For instance if you are familiar with Atomeye or OVITO, then write your data files in the CFG format. If you are more familiar with VESTA or XCrySDen, then use the XSF format.

If you wish to orient the crystal differently, please proceed to the next tutorial.

Now use your imagination! You can change the chemical elements at will. You may also read the documentation of the mode --create and generate unit cells for other types of lattices, and even to create nanotubes.