Any errors let me know

General Comments

In this example will consider generating two low index surfaces of SrTiO3.

This gives the steps, but if you want a more detailed run through look at this teaching exercise on alumina

exercise

Another general point about METADISE, it is built from a series of scripts (like modules) and that to process the data in one script or module there is a keyword: start. The new module name is then specified on the next line, and after typing in the list of commands for the new module it will complete when given the keyword: start. The main input is entered in the metadise module, so that you could start all input.txt files with: metadise, but this is not necessary as it is an assumed first line. However, this is mentioned as you can develop a sequence of calculations by adding the keyword metadise after a start, and that will return the code back to the beginning, although some of the variables will have been changed e.g. cell coordinates.

Generate Bulk Structure

The first step is to obtain the bulk crystallographic data

bulk

and a force field/potential model (here is one by DM Teter)

pot

If both structure called: input.txt and the potential file: poten.txt are in the same folder and Metadise is run, then will minimise the structure and the relaxed structure will be called fin_o0001no_res.out. If you did not want constant pressure minimisation then conp could be replaced by:
check # only produces output files
force # calculates energy and forces and produces output files
conv # minimises to constant volume and produces output files
cons # minimises to constant pressure, but maintains the shape (good if orthorhombic cell is needed) and produces output files

Other regular keywords are: grow and print
For example:
grow 3 3 3 # will create a supercell that is 3 times the first, second and third lattice vectors
print vasp 1 # will print a VASP POSCAR file
print dlmonte 1 # similarly for dlmonte, others include dlpoly, lammps, gulp and castep
print pov 1 # will print a POVRAY file for generating ray-traced images

If you want to look at other notes, see section 2 in blog by JPA

Orientate and Cut Bulk Structure

The approach is take your bulk crystal, let it know whether you intend to generate a slab or surface, specify the Miller index and generate the surface. This is achieved by sending it to the stackgen module.

i.e. replace:
conp
stop
start
stop

by

Surface
Miller 1 1 0
start
stackgen systematic
start

stackgen input

Stackgen generates a rotated unit cell from the data supplied be the Metadise Input Controller. If unsure which are non-dipolar terminations this will return a code for each of the non-dipolar cuts. If you want to look at other keywords, see Stacken

On running this, look at summo0001_0001.out pldro0001_0001.out staco0001_0001.out files

Summ file:
#Miller 1 1 0
d spacing = 2.74677567225536 lattice energy = -62.8618204215402 eV, area = 21.3398507677539
list code dipole slice energy attachment energy/atom surf en
code 3 = 0.00000000 -53.60899 -0.92528 3.47330
code 5 = 0.00000000 -54.34590 -0.85159 3.19668 mirror

Shows that there are 2 cuts, the symmetric one, labelled mirror looks to be slightly more stable. However, this is an unrelaxed single slice.

pldr file:
PLDRAW: Code ( 3 ) with dipole = 0.000000000000000E+000
height charge atom arrangement
0.0 1.2 SR--
0.2 0.0
0.4 0.0
0.6 0.0
0.8 0.0
1.0 0.0
1.2 0.0
1.4 -2.4 O--O--
1.6 0.0
1.8 0.0
2.0 0.0
2.2 0.0
2.4 0.0
2.6 0.0
2.8 1.2 TI--O--

PLDRAW: Code ( 5 ) with dipole = 0.000000000000000E+000
height charge atom arrangement
0.0 -1.2 O--
0.2 0.0
0.4 0.0
0.6 0.0
0.8 0.0
1.0 0.0
1.2 0.0
1.4 2.4 TI--O--SR--
1.6 0.0
1.8 0.0
2.0 0.0
2.2 0.0
2.4 0.0
2.6 0.0
2.8 -1.2 O--

Gives a schematic representation of the surface unit, which when repeated generates the surface or slab. Again code 5 can be seen to have a mirror plane in the centre of the slice.

The other file, staco0001_0001.out is itself an input file for Metadise. The keyword: stack, tells Metadise that the structure has been rotated. It will perform 4 calculations in sequence. The bulk energy for cut 3 followed by a surface minimisation of cut 3, then a bulk energy for code 5 and finally its surface minimisation. Convert staco0001_0001.out to input.txt and run. For a straightforward surface like this, it should run immediately, but 2 things are worth a quick check, first, ensure poten.txt exists and has the potential parameters, and secondly that the numbers following the region are sensible. The first 2 are the number of unit cells in the relaxed region, close to the surface and the final two, are the total number of unit cells in the simulation cell. Metadise sets them based on ensuring convergence of the Coulomb energy, but they are normally well in excess needed and can be altered and energies checked for faster simulations.
Also note, if you decide you want to run it as a slab, without any fixed region II, then just replace the keyword: surf by: slab

Minimise Surface

There will be 2 sets of aft.... files for the 2 surfaces.

The completed summary file should look something like:

surf

Key points from summary file in relation to (110) code: 5
# check it has recorded correct Miller index and code:
Miller 1 1 0 code 5
# bulk energy calc (with 60 atoms and area in A^2. The energy of bulk = -762.490489 eV (or -572.443559 J/m2)
bulk nat1 60 area 21.339851
..
grad valid 0.000022 -762.490489 -762.490489 -572.443559 -572.443559
..
..
..
# Surface calculation, check that it is valid (number following is the sum of the squares of forces)
..
Miller 1 1 0 code 5
surf nat1 30 area 21.339851
...
newt valid 0.000013 -378.254938 -378.258406 -283.976792 -283.979396
...
...
Miller 1 1 0
Counter CODE unrel_S_en/Jm^-2 Suface_en/Jm^-2 degeneracy Surface_Excess/eV
0 3 3.60934 2.98122 1.00000 3.97097 valid
1 5 3.05897 2.24238 1.00000 2.98684 valid
# relaxed surface energy = [-378.258406 - (-762.490489/2)] * 16.021 / Area = 2.24238 J/m2

Create Supercells

Sometimes it is useful to generate a supercell, namely a simulation cell with a larger surface area. This can be generated by growing the bulk unit cell as shown in the alumina example above, by using the "grow" keyword, but equally, the surface unit cell can be grown.

This can be achieved by modifying the staco0001_0001.out file generated by Metadise.

The first 2 lines in the staco file after LATT correspond to the surface lattice vectors, using the (100) surface as an example
LATT (area = 15.090)
0.0000000000 3.8845274085 0.0000000000
0.0000000000 0.0000000000 3.8845274085
The surface lattice vectors can be scaled by creating new surface vectors by composed of linear combinations of the these 2.
For example if you wanted a 3x3 after "bulk" add:
# make interface unit cell 3x3 for bulk
vscale1
3.0 0.0 # new first surface vector is 3xfirst latt and 0xsecond latt
0.0 3.0 # new second surface vector is 0xfirst latt and 3xsecond latt
vscale2
3.0 0.0 # new first surface vector is 3xfirst latt and 0xsecond latt
0.0 3.0 # new second surface vector is 0xfirst latt and 3xsecond latt

This will give new surface vectors:
0.0000000000 11.6535822255 0.0000000000
0.0000000000 0.0000000000 11.6535822255

Alternatively,
# make interface unit cell root(2)x root(2) for bulk
vscale1
1.0 1.0 # new first surface vector is 1xfirst latt and -1xsecond latt
-1.0 1.0 # new second surface vector is 1xfirst latt and -1xsecond latt
vscale2
1.0 1.0 # new first surface vector is 1xfirst latt and -1xsecond latt
-1.0 1.0 # new second surface vector is 1xfirst latt and -1xsecond latt

Will give the 45 degree rotated cell:
0.0000000000 5.4935513445 0.0000000000
0.0000000000 0.0000000000 5.4935513445

SC Parker