Atomsk

The Swiss-army knife of atomic simulations

Tutorial: Sphere of Silicon

This tutorial explains how to use Atomsk to create a sphere, using silicon as an example.

1. The supercell of silicon

To begin with, let us construct a supercell of silicon, as explained in a previous tutorial:

atomsk --create diamond 5.431 Si -duplicate 30 30 30 Si_supercell.xsf

The supercell is written in "Si_supercell.xsf".

2. Carving a sphere

Now, Atomsk offers the possibility to generate a unit cell with a different orientation. For instance, to generate the unit cell corresponding to the lattice orientation X=[-110], Y=[001], Z=[110], the syntax is the following:

atomsk Si_supercell.xsf -select out sphere 0.5*box 0.5*box 0.5*box 70 \
-rmatom select Si_sphere.cfg

Note that the instruction "orient" must be specified immediately after the atom species "Si". The unit cell then looks like the following:

You may play with the size of the box and the radius of the sphere.

3. Create a half-sphere

Now, imagine that we want to cut that sphere in half. For that we can use the option "-cut":

atomsk Si_sphere.cfg -cut below 0.5*box Y Si_halfsphere.cfg

4. The fast way: one-line command

The construction above was decomposed into several commands, for the purpose of clarity: (1) construct the supercell; (2) cut the sphere; and (3) cut the bottom half. Of course, the disadvantage is that at every step, Atomsk must read a file, a write a new file: "Si_supercell.xsf", then "Si_sphere.cfg", and finally "Si_halfsphere.cfg". The reading and writing of such intermediate files on the disk slows down the procedure.

If you wish to obtain the final result faster, you can use all the options together inside a single command-line:

atomsk --create diamond 5.431 Si \
-duplicate 30 30 30 \
-select out sphere 0.5*box 0.5*box 0.5*box 70 \
-rmatom select \
-cut below 0.5*box Y \
Si_final.cfg

This way, Atomsk will do everything into the memory (RAM): create the supercell, duplicate it, select and cut the sphere, and cut the bottom half. The options are applied one after the other, in the order indicated in this command. Only at the very end will Atomsk write the final result into a file: "Si_final.cfg". This system is identical to the previous one "Si_halfsphere.cfg", but it will be produced much faster because Atomsk is run only once, and does not have to read and write several intermediate files.