# Atomsk

The Swiss-army knife of atomic simulations

### Tutorial: Stacking Fault

In this tutorial you will learn how to construct a generalized stacking fault with Atomsk.

#### 1. Crystallographic orientation of the system

For the purpose of this tutorial, let us assume that we want to study a stacking fault in aluminium (Al). Since the easiest glide plane in aluminium is of the type {111}, we will study stacking faults in such a plane, say the (111) plane. Let us use Atomsk to create a cell of aluminium with the orientation X=[110], Y=[111], Z=[112]:

atomsk --create fcc 4.046 Al orient [-110] [111] [11-2] -duplicate 1 8 1 Al_cell.xsf

In addition, the system is duplicated 8 times along the Y direction. With such a system, the plane of the stacking fault will be normal to the Y direction.

#### 2. Shift the top crystal

The option "-shift" can be used in two ways. If you use "`-shift τX τY τZ`", all atoms are shifted by the given vector τ=(τXYZ). However, shifting all atoms by the same vector does not introduce any defect and keeps the periodicity of the system.

To create a stacking fault, we need to shift one part of the crystal with respect to the other. Let us shift the upper part of the crystal:

atomsk Al_cell.xsf -shift above 0.5*box Y 1.0 0.0 0.0 Al_SF.xsf

Here, the option "-shift" is applied only to atoms that are above the half of the box ("0.5*box") along Y, and the shift vector is (1,0,0). In other words the top crystal is shifted by 1 Å along X, as shown in the figure below:

#### 3. Alternative way with option "-select"

While the method above works, it is possible to use another method. In a previous tutorial, we saw that when atoms are selected with the option "-select", the following options apply only to selected atoms. Here, it is possible to select atoms in the top half of the crystal, and then shift them:

atomsk Al_cell.xsf -select above 0.5*box Y -shift 1.0 0.0 0.0 Al_SF.xsf

The result is exactly the same as before. You may use one method or the other at your convenience.

#### 4. Atoms out of the box

Because some atoms were shifted, they may be outside of the box, as illustrated in the previous image. In order to apply periodic boundary conditions and bring all atoms back into the box, one can use the option "-wrap" after shifting the atoms:

atomsk Al_cell.xsf -shift above 0.5*box Y 1.0 0.0 0.0 -wrap Al_SF.xsf

#### 5. Generalized stacking faults

This tutorial demonstrated that it is quite easy to construct generalized stacking faults (GSF) with Atomsk. You may shift the top crystal by any arbitrary vector τ=(τX,0,τZ), and compute its energy with ab initio or classical force-field simulations. Naturally, a size of 8 unit cells along the Y direction may not be sufficient to achieve good convergence of the results: it is up to you to try different system sizes.

The construction of GSF can be automated e.g. with a bash script, that would loop on the X and Z components of the shift vector τ. You can find an example of such a script in the folder "examples/SrTiO3_gamma_surface". This script constructs a supercell of SrTiO3 perovskite, constructs GSF in the (110) plane, and compute their energy with LAMMPS (hence, you must have LAMMPS installed for this script to work).