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, let us remove atoms, so that only a sphere remains. We place the center of the sphere at the center of the box, and choose a radius of 70 Å. Atoms that are outside of that sphere are selected, and then removed:

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

The final system ("Si_sphere.cfg") looks like the following:

You may play with the size of the box and the radius of the sphere. You may notice that, if you place the center of the sphere very near to a box boundary, then the sphere is truncated. This is because the option "-select" does not take any periodic condition into account. If you place the center of the sphere at the origin (0,0,0), then you will obtain an eigth of a 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.