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.

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.

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

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. Other lattice types

As you can see it is pretty easy to generate unit cells with Atomsk. 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.

If you wish to orient a unit cell differently, or duplicate a unit cell, please proceed to the next tutorial.

5. Visualization

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.