Skip to content

build_alloy.py

Julien Steffen edited this page Jan 20, 2025 · 1 revision

This script builds a POSCAR file of a metal alloy system (or more general, of arbitrary distributed atoms). The atoms of the chosen elements are placed on a regular cubic grid, on the grid positions, the elements are assigned arbitrarily, keeping the desired total numbers of them.

Both bulk systems, surface slabs and isolated clusters can be generated by changing the widths of vacuum in the three directions.

To start the script, simply call it in the command line, together with at least the following four keywords, which are obligatory:

  • -elnum=[number] Number of elements in the alloy. Currently, one to four different elements can be chosen.
  • -unit_num=[number] Size of the grid in x and y directions. If, for example, 5 is chosen, the grid will be of size 5x5, with enough space for 25 atoms per layer. If more atoms are included, the next layer (incremented in z direction) is started be filled.
  • -el_symbols=[list] Which elements shall be included in the alloy. Example: el_symbols=Ga,In,Pt includes Ga, In and Pt atoms in the alloy.
  • -natoms=[list] Number of atoms of the respective elements given with the -el_symbols keyword. Example: -natoms=100,23,57, defines 100 atoms of the first element, 23 of the second and 57 of the third.

Further, a number of optional keywords with default values can be given to fine-tune the generation of the system:

  • -z_vac=[value] Size of the vacuum above the slab. Default: 20 Angstrom (i.e., a surface slab with enough separation to minimize interactions). If a bulk system shall be simulated, give 0 as value.
  • -x_vac=[value] Analog to -z_vac, but along the x-axis. Default: 0 Angstrom.
  • -x_vac=[value] Analog to -z_vac, but along the x-axis. Default: 0 Angstrom.
  • -z_shift=[value] Shift of the whole unit cell along the z axis. Default: 0 Angstrom. Give a value here if you want to have a slab in the center of the unit cell, with vacuum to both sides.
  • -x_shift=[value] Shift of the whole unit cell along the x axis. Default: 0 Angstrom. Give a value here and in the other shifts to generate an isolated particle.
  • -y_shift=[value] Shift of the whole unit cell along the y axis. Default: 0 Angstrom. Give a value here and in the other shifts to generate an isolated particle.
  • -unit_len=[value] The distance between two atoms (or grid points) in the cubic grid. Default: 2.54 Angstrom. The default fits well to alloys with Gallium as main element. If much larger or smaller atoms are chosen, the value might need to be changed accordingly.

In the following, some example cases for typical setups are given:

Case 1: bulk: If we want to generate a bulk cell, for example with Sn and Ni, we could give a command like this:

build_alloy.py -elnum=2 -unit_num=8 -el_symbols=Sn,Ni -natoms=450,62 -z_vac=0.0 

An alloy containing 512 atoms on a regular 8x8x8 grid is built. Note that only the x and y grid dimensions are predefined by the -unit_num argument. The dimension of the z grid needs to be defined indirectly by the total number of atoms. Here, 450+62=512, with 8x8=64 per layer, such that 8 layers are filled in the z-direction, leading to the symmetric cubic simulation cell.

Case 2: surface slab: A surface slab containing Ga, Cu and Ag is generated with the following command:

build_alloy.py -elnum=3 -unit_num=5 -el_symbols=Ga,Cu,Ag -natoms=200,30,20 -z_vac=25

The alloy contains 250 atoms in total, with 25 atoms per layer in z-direction (10 layers in total). A vacuum of 25 Angstrom is introduced in z-direction.

Case 3: isolated droplet: To generate an isolated alloy droplet containing Sn, Ag and Pt, use the following command:

build_alloy.py -elnum=3 -unit_num=10 -el_symbols=Sn,Ah,Pt -natoms=700,150,150 -z_vac=25 -x_vac=25 -y_vac=25

A droplet (initially a cube) containing 1000 atoms in total is built, with 25 Angstroms of vacuum around it. Add the keywords -z_shift etc. to move the droplet in the middle of the simulation cell.