## Part 3: Generating the lattice input file

The lattice input file starts with the keyword lattice followed by one of: default, periodic_cell or explicit. We have already seen the use of a default lattice in tutorial Ziff-Gulari-Barshad Model in Zacros. Here we will focus on the second type of lattice defined as a periodic tiling of a unit cell. So in our input file the first line will be:

`lattice periodic_cell`

The next few lines of the input file define the two unit cell vectors, **a** and **b**. The keyword cell_vectors is used followed by two lines, each of which contains the x and y components of each vector. In our case the unit cell vectors are the cartesian unit vectors times a lattice constant. For the case of Pd, the lattice constant of the cubit unit cell of the crystal is 3.8907 Å and the unit cell for the surface lattice will have a lattice constant of 3.8907×√2/2.

cell_vectors

2.751140353562500 0.000000000000000 # x and y components of a

0.000000000000000 2.751140353562500 # x and y components of b

We will also have to define how big the KMC simulation lattice will be. We will therefore have to tell *Zacros* how many times do we want to tile the unit cell along the directions of the vectors **a** and **b**. Let's say we want a 50×50 lattice; then we have to use the expression:

repeat_cell 50 50

Next, we will have to define the different site types that can appear in the unit cell, which in our case are atop and hollow. We therefore need to first tell *Zacros* that there are two different site types and then define the names we will use to refer to them:

n_site_types 2

site_type_names top hol

These site type names (top, hol) can subsequently be used in the definition of energetic interaction or elementary reaction patterns, enabling us for instance to define different adsorption energies on different sites, or different activation energies for the same elementary step when it occurs on different site types (or combinations or site types for multi-site events).

We are now ready to define the lattice structure, which involves three things: (1) defining the type of each of the two sites contained in the unit cell, (2) defining the coordinates of each site, and (3) specifying the neighboring structure of the lattice. Let us bring back the drawing we made in the previous section of the tutorial to make it apparent how it helps us with these tasks:

The definition of the site types and the coordinates is easy: focus on the central cell, and for each of the sites that we have therein numbered as 1, 2, ... (here we have only two), list the corresponding site type. In our case we have top hol, since the first type is atop and the second hollow. In *Zacros* parlance:

n_cell_sites 2

site_types top hol

Equally well we could have written site_types 1 2 in the second line (i.e. use the site type index instead of the corresponding name).

The coordinates of each site are defined as fractional (rather than Cartesian) coordinates, using the keyword site_coordinates followed by as many lines as the number of sites in the unit cell. Each line gives the **a** and **b** fractions coordinates of the corresponding site, such that if λ and μ are the fractional coordinates, the cartesian coordinates of the site (in the central unit cell) are (x,y) = λ **a** + μ **b**.

site_coordinates

0.250000000000000 0.250000000000000 # a, b frac. coords of 1st site

0.750000000000000 0.750000000000000 # a, b frac. coords of 2nd site

The final thing we need to define is the links between neighbouring sites, which is done within a neighboring_structure ... end_neighboring_structure block. To this end, we look at the drawing above, which highlights the links between any site in the central cell with any site either in the central cell or any of the four neighboring cells. Thus, links between sites that both belong to neighboring cells are excluded. For each of the highlighted links we write one line in the neighboring_structure ... end_neighboring_structure block containing the indices of the two neighboring sites separated by a dash and followed by one of the following keywords: self if both sites are in the central cell, north,northeast,east,southeast if the second site is in the north, northeast, east or southeast neighboring cells, respectively. Note that in the latter four cases the second index **must** correspond to the site in the neighbouring cell. In the first case, the order of the indexes of the cells does not matter. The eight links of the drawing above are thus translated in the following *Zacros* instructions:

neighboring_structure

1-2 self

1-1 north

1-1 east

2-1 north

2-1 northeast

2-1 east

2-2 north

2-2 east

end_neighboring_structure

Note that the order in which the neighbouring instructions appear within the block does not matter.