Generate structure
Short description
Builds supercells, diagonal and non-diagonal. Also has the capability to find the optimal supercells for a given lattice, very handy when you have complicated structures.
Command line options:
Optional switches:
-
--dimensions value#1 value#2 value#3
,-d value#1 value#2 value#3
default value 5 5 5
Dimensions of supercell. -
--nondiagonal_dimensions value#1 value#2 value#3 value#4 value#5 value#6 value#7 value#8 value#9
,-nd value#1 value#2 value#3 value#4 value#5 value#6 value#7 value#8 value#9
default value 0 0 0 0 0 0 0 0 0
Non-diagonal dimensions of supercell. -
--output_format value
,-of value
, value in:1,2,4,5
default value 1
Output format. 1 is VASP, 2 Abinit, 4 FHI-Aims and 5 Siesta -
--desired_na value
,-na value
default value -1
Desired number of atoms in supercell. Will try to choose a cell as cubic as possible. -
--help
,-h
Print this help message -
--version
,-v
Print version
Examples
generate_structure -dim 4 3 5
generate_structure -na 200
Longer summary
This code builds a supercell with user-specified dimensions from the unit cell given in infile.ucposcar
. All positions are in fractional coordinates.
The code handles diagonal and non-diagonal cells. The diagonal cells are simple repetitions of the unit cell, making it \(N_1 \times N_2 \times N_3\) larger. The non-diagonal cells can be useful when the unit cell has an awkward shape. The supercell will have the lattice vectors
where \(\det( \mathbf{M} )\) is a positive integer. Some useful transformations are, for example, with -nd -n1 n1 n1 n2 -n2 n2 n3 n3 -n3
, from a primitive fcc lattice to the conventional cubic
Similarly, from a primitive bcc to conventional cubic:
There are some non-obvious ones as well, such as converting a hexagonal lattice to an orthorhombic:
or rhombohedral (lattice parameter \(a\), angle \(\alpha\)) to hexagonal:
There are too many ways to build supercells to list here. The examples are suggestions so that you can pick a supercell that is as cubic as possible. Converging results with respect to supercell size goes approximately as the size of the largest sphere you can fit in the cell.
Automatic generation
The option -na
will try to determine a non-diagonal supercell that is as cubic as possible, with the number of atoms close to the specified value. It does it by generating a massive amount of possible supercell transformation matrices, and comparing the ratio of the cell volume and the volume of the inscribed sphere. By optimizing with respect to this ratio, a reasonably cubic cell should be the result. Very useful when you have a unitcell with a tricky shape and it's non-trivial to figure out a meaningful transformation matrix.
To clarify, a cell defined by vectors \(\mathbf{a}\), \(\mathbf{b}\) and \(\mathbf{c}\) will have the volume
In the same cell, the radius of the largest sphere that can be inscribed is given by
I define the ratio
As the function to be maximized (it is the ratio of the filling ratio of a cell and the filling ratio of a cube with the same volume, a value of 1 indicates a perfect cube). The algorithm works by searching the space of non-diagonal supercell matrices that produce approximately the desired number of atoms and simultaneously maximize the filling ratio. This algorithm produces rather non-intuitive cells. Consider Bi2Te3 defined in the primitive rhombohedral cell:
Bi2Te3
10.314046162
0.243360208934 0.000000000000 0.969935981757
-0.121680104467 0.210756123207 0.969935981757
-0.121680104467 -0.210756123207 0.969935981757
Bi Te
2 3
direct coordinates
0.599898812406 0.599898812406 0.599898812406 site: 1
0.400101187594 0.400101187594 0.400101187594 site: 2
0.791308614612 0.791308614612 0.791308614612 site: 3
0.208691385388 0.208691385388 0.208691385388 site: 4
0.000000000000 0.000000000000 0.000000000000 site: 5
Using this algorithm I found the supercell matrix
that produce the lattice vectors
Bi2Te3 upercell
10.314046161996
0.97344083573636 1.26453673924247 0.96993598175736
1.58184135807159 -0.21075612320708 -0.96993598175736
-0.60840052233523 1.47529286244955 -0.96993598175736
Bi Te
86 129