• Back
• Visualisation
• Cell Manipulation
• Code Support
• Notes

# Cell Manipulation and check2xsf

On the basis that examples might be easier to follow than a description, herewith a slightly indirect way of turning 2-atom cubic Si into something suitable for a (111) surface calculation.

We start with a two atom cubic Si cell:

```%BLOCK LATTICE_CART
2.73  2.73 0.00
2.73  0.00 2.73
0.00  2.73 2.73
%ENDBLOCK  LATTICE_CART

%block POSITIONS_FRAC
Si 0.0     0.0     0.0
Si 0.25    0.25    0.25
%endblock POSITIONS_FRAC
```

As this is awkward, we immediately transform into the conventional 8 atom cubic cell:

```check2xsf -x --cell si2.cell si8.cell
```

From version 2 of check2xsf, these standard transformations are no longer recognised, and the above has to be specified explicitly as

```check2xsf -x='(1,1,-1)(1,-1,1)(-1,1,1)' --cell si2.cell si8.cell
```

yielding

```%block LATTICE_CART
ang
5.460000 0.000000 0.000000
0.000000 5.460000 0.000000
0.000000 0.000000 5.460000
%endblock LATTICE_CART

%block POSITIONS_FRAC
Si 0.000000 0.000000 0.000000
Si 0.500000 0.500000 0.000000
Si 0.250000 0.250000 0.250000
Si 0.750000 0.750000 0.250000
Si 0.500000 0.000000 0.500000
Si 0.000000 0.500000 0.500000
Si 0.750000 0.250000 0.750000
Si 0.250000 0.750000 0.750000
%endblock POSITIONS_FRAC
```

For a (111) surface, it will be easier to use the six-atom hexagonal cell. I could not spot that one from the original two atom cell, but now I can see that I want c to be (111) and a and b to be orthogonal to c, of equal length, to be lattice vectors, but not necessarily orthogonal to each other, so (0.5,-0.5,0) and (0.5,0,-0.5) look reasonable.

```check2xsf -x='(.5,-.5,0)(.5,0,-.5)(1,1,1)' -vv --cell si8.cell si6.cell
```

resulting in

```%block LATTICE_CART
ang
2.730000 -2.730000 0.000000
2.730000 0.000000 -2.730000
5.460000 5.460000 5.460000
%endblock LATTICE_CART

%block POSITIONS_FRAC
Si 0.000000 0.000000 0.000000
Si 0.000000 0.000000 0.250000
Si 0.666667 0.666667 0.333333
Si 0.666667 0.666667 0.583333
Si 0.333333 0.333333 0.666667
Si 0.333333 0.333333 0.916667
%endblock POSITIONS_FRAC
```

It would be nicer if the c axis were actually in the z direction of the cartesian set, and a the x direction, and one can use two rotations to achieve this:

```check2xsf -T='(1,1,1)(0,0,1)' -vv --cell si6.cell si6r.cell
check2xsf -T='(1,-1,0)(1,0,0)' -vv --cell si6r.cell si6rr.cell
```

However, the lazy may discover that

```check2xsf -a --cell si6.cell si6rr.cell
```

also results in

```%block LATTICE_CART
ang
3.860803 -0.000000 0.000000
1.930402 3.343553 0.000000
0.000000 0.000000 9.456997
%endblock LATTICE_CART

%block POSITIONS_FRAC
Si 0.000000 0.000000 0.000000
Si 0.000000 0.000000 0.250000
Si 0.666667 0.666667 0.333333
Si 0.666667 0.666667 0.583333
Si 0.333333 0.333333 0.666667
Si 0.333333 0.333333 0.916667
%endblock POSITIONS_FRAC
```

To make a surface, one can simply stack a lot of these into a supercell: perhaps four:

```check2xsf -x='(1,0,0)(0,1,0)(0,0,4)' --cell si6rr.cell si24rr.cell
```

The output, which now has 24 atoms, has them ordered by c coordinate, so one can easily take one's favourite editor and remove a few layers. I deleted c<=0.25 and c>0.75 to leave just 12 atoms and a rather generous amount of vacuum. To check this looks sane one can convert to pdb (or xsf) and then look at it with one's favourite viewer.

```check2xsf --xsf si12rr.cell surface.xsf
```

Here four of the above unit cells are shown tiled.

If one wishes to remove (or add) vacuum, simply convert into a cell file using absolute coordinates for the atoms (--cell_abs), and then edit the length of the c axis by hand, whilst ensuring that it still encloses all the atoms.