```6.2.5.  LAYER RESTRUCTURE OPTION, [C]

[C]  This option allows you to restructure any set of layers of the lattice
section. It can thus be used to model layer reconstruction or relaxation
layers may be included in the structure with this option.

Each layer of the unmodified lattice section is characterized by its
origin vector o, two periodicity vectors (lattice vectors) R1', R2', and
n layer basis vector(s) rt pointing to inequivalent atoms of the layer
with appropriate nuclear charges and atom radii. With the present
option, a given layer p can be restructured as follows

a) origin shift    o  -->  o + s

this shifts layer p rigidly with respect to its original position
where the shift vector s is 3-dimensional.

b) periodicity transformation  R1'  -->  R1'' = m11 * R1' + m12 * R2'
R2'  -->  R2'' = m21 * R1' + m22 * R2'

this changes the periodicity of layer p. The original periodicity
vectors R1', R2' are transformed linearly using a 2x2 transformation
matrix M. For simple cases, M is readily available. As an example we
mention a p(a x b)Rx adsorbate layer ( = primitive a x b structure
rotated by x degrees) where M is given by a product of two matrices

(  a   0  )   ( cos(x)-A12*sin(x)   A11*sin(x)    )
M  =  T * R =  (         ) * (                                   )
(  0   b  )   ( -A22*sin(x)     cos(x)+A12*sin(x) )

with    Aij = Ri'*Rj' / |R1'xR2'|

For further details consult respective surface science textbooks as
e.g. the one by M. A. Van Hove, W. H. Weinberg and C. M. Chan cited
below.

c) rebuild layer basis    rt, i=1,k  -->  rt', i=1,k'

this redefines all layer basis vectors (and atoms with radii and
nuclear charges) of layer p by replacing the k original layer basis
vectors (and atom parameters) by k' new ones. The new layer basis
vectors are defined as 3-dimensional vectors by

rt' = p1 * R1'' + p2 * R2'' + pz * rz

where R1'', R2'' form the (transformed) layer periodicity basis and
rz is a layer normal vector of length D (D = distance between
symmetry equivalent lattice planes) pointing towards layer p+1. Note
that with this definition a restructured layer basis does not need to
be planar (as opposed to the strict definition of lattice planes).

The following table gives examples for any combination of the three
schemes.

-------------------------------------------------------------------
Scheme(s)    Application
-------------------------------------------------------------------
a           layer relaxation at surfaces.
b           simple planar layer reconstructions, e.g. missing
row.
c           layer buckling, commensurate 1x1 adsorbate layers.
a + b       combined layer reconstruction and relaxation in
simple cases.
a + c       may be described by c only.
b + c       general relaxation/reconstruction case,
incommensurate structures (buckling, warping, etc.),
a + b + c   may be described by b + c.
-------------------------------------------------------------------

Note that for non-primitive lattices with more than one inequivalent
atoms in a layer BALSAC will apply restructure schemes a and b to each
inequivalent atom separately starting from atom positions of the
unrestructured layer. This may require to rebuild layer bases (scheme c)
for non-primitive lattices even in simple restructure cases.

Selecting [C] from the main option menu of BALSAC/LATTICE shows in the

========== RESTRUCTURE OPTION ===================================
nrtot  layer(s) restructured

Layr Basis   Relax (S1, S2, S3)  |  Reconstruct (M11,M12,M21,M22)
nl   nb       s1    s2    s3    |   m11     m12     m21     m22
Xyz,R,Id(  1) :    p1      p2      pz ,      rad ,    nuc
.....
.....

Select   [C]hange layer   [U]ndo restructuring   [?,]esc
=========================================================== 87 ==

giving the present definition of all nrtot restructured layers and asks
for the index n of a layer which is to be restructured from scratch or
whose restructure parameters are to be changed, see option [L] of the

In the above listing of nrtot restructured layers each layer is
described by its layer index nl within the range [1,n3] where n3 is the
number of layers defined in the section option, see Sec. 6.2.4. Then,
the number nb of separate atoms assigned to this layer is shown (see
building scheme c) above) where nb = 0 denotes the original basis of the
bulk lattice. In addition, vector s = (s1, s2, s3) defines the layer
shift vector (see building scheme a) above) given in multiples of the
(unmodified) layer periodicity vectors R1', R2' and of a layer normal
vector Rn, see below. Further, the 2x2 transformation matrix with
components (m11, m12, m21, m22) defines the changed layer periodicity
(see building scheme b) above). The following nb lines list the
redefined layer basis set where rt' = (p1, p2, pz) are layer basis
vectors given in multiples of the (modified) layer periodicity vectors
(R1'', R2'') and of the layer normal vector Rn, see below. Further, rad
and nuc are respective atom radii and nuclear charges.

>   [C]  selected from submenu C' allows you to set the index of a layer
which is to be restructured from scratch or whose restructure
parameters are to be changed. The prompt

Select restructure layer  N (1 - n3, 0=esc) :

asks for the index nl of a layer to be restructured where nl must
lie inside the range [1,n3] with n3 being the number of layers
defined in the section option, see Sec. 6.2.4. Here nl = 1 will
define the bottom and nl = n3 the top layer of the section (or vice
versa depending on the view angles THETA, ROT, see Sec. 6.2.6.).
If a layer number n within the range [1,n3] is given this layer
will be added to the list of restructured layers (if needed) and
BALSAC moves to the restructure menu C where the layer can be
further modified, see below. Dummy input n=0 returns immediately to
the BALSAC/LATTICE main option menu keeping all restructuring
information.

>   [U]  selected from submenu C' allows you to undo (cancel) restructuring
of all or selected layers of the lattice section. The undo menu CU

=============================================================
nrtot  layers restructured:   nl1   nl2   ...

Undo  [S]elected  [A]ll   [?,]esc
======================================================= 54 ==

where the indices nl1 ... of all nrtot restructured layers are
listed.

>    >   [S]  selected from submenu CU allows you to delete restructuring
of one layer of the listing shown in the above menu. The
prompt

Select layer no. (0=esc) :

asks you to choose a layer number nd from the list after which
the restructuring definition of this layer will be deleted and
the layer will be described by its original (bulk) definition.
Then BALSAC returns to submenu C' if any restructured layer(s)
remain or to the BALSAC/LATTICE main option menu. Dummy input
nd = 0 in the prompt will keep all layer definitions
unchanged.

>    >   [A]  selected from submenu CU allows you to delete restructuring
of all layers in one step resulting in the original lattice
section without restructuring. This has to be confirmed in the
prompt

Confirm undo   [A]ll    [?,]esc

where selecting [A] deletes all restructuring and returns to
the BALSAC/LATTICE main option menu while selecting [,] keeps
all layer definitions unchanged returning to submenu C'.

>    >   [,]  selected from submenu CU returns immediately to the

>   [,]  selected from submenu C' returns immediately to the BALSAC/LATTICE

After a layer has been selected for restructuring BALSAC moves to the

========== RESTRUCTURE OPTION =====================================
nrtot  layer(s) restructured

Layr Basis   Relax (S1, S2, S3)  |  Reconstruct (M11,M12,M21,M22)
nl   nb       s1    s2    s3    |   m11     m12     m21     m22
Xyz,R,Id(  1) :    p1      p2      pz ,      rad ,    nuc
.....
.....

Layer  n: [L]ayrdef  [R]ebuild  [B]asis [U]ndo [F]rmlayr [S]hftlayr
[X]plot    [D]ispla   [I]nfo  [?,]esc
============================================================= 52 ==

giving the above listing of all restructured layers and the prompt line
starting with "Layer  n: [L]ayrdef ..." indicates that layer no. n has
been chosen for input of reconstruction definitions.

>   [L]  selected from submenu C allows you to reset the index of a layer
which is to be restructured from scratch or whose restructure
parameters are to be changed. This option is identical to option
[C] of the restructure entry menu C' discussed above and allows you
to move between layers and thus to restructure more than one layer
inside the restructure option.

>   [R]  selected from submenu C allows you to redefine the origin and

=================================================================
Layer  nl     abs. shift(XS,YS,ZS)=     xs       ys       zs
rel. shift(S1,S2,S3)=     s1       s2       s3
Mat(M11,M12,M21,M22)=         m11      m12      m21      m22

Select [A]ll [S]hift(abs) s[H]ift(rel) [M]atrix [R]otate  [?,]esc
=========================================================== 70 ==

where the layer shift vector s is shown by absolute cartesian
coordinates s = (xs, ys, zs) (x-axis along the (unmodified) layer
periodicity vector R1', z-axis along layer normal vector) as well
as in relative units s = (s1, s2, s3) with

s = s1 * R1' + s2 * R2' + s3 * Rn

where R1', R2' are the (unmodified) layer periodicity vectors and
Rn points along the layer normal vector En and is of length D equal
to the distance between equivalent layers of the (unmodified) bulk
pointing towards layer nl+1. Further, the 2x2 matrix M = (m11,
m12, m21, m22) which transforms the layer periodicity basis of the
original layer (R1', R2') into the restructured basis (R1'', R2''),
see above, by

R1'' = m11 * R1' + m12 * R2'
R2'' = m21 * R1' + m22 * R2'

is shown with its components.

>    >   [A]  selected from submenu CR allows you to redefine both the layer
shift and 2-dimensional periodicity of layer nl in one step.
The prompt

Input rel. shift + (2x2) matrix
S1,S2,S3, M11,M12,M21,M22 ("/"=esc) :

asks for three numbers, s1, s2, s3, defining the layer shift
vector (in relative units) and four numbers, m11, m12, m21,
m22, defining the periodicity transformation matrix. Dummy
input "/" leaves the present parameter values unchanged. After
complete input BALSAC returns to submenu C.

>    >   [S]  selected from submenu CR allows you to redefine the layer
shift of layer nl by giving absolute cartesian coordinates,
see above. The prompt

Input abs. shift  XS,YS,ZS ("/"=esc) :

asks for three numbers, xs, ys, zs, defining the cartesian
components of the layer shift vector (x-axis along the
(unmodified) layer periodicity vector R1', z-axis along layer
normal vector). Dummy input "/" leaves the present shift
vector unchanged. After complete input BALSAC returns to

>    >   [H]  selected from submenu CR allows you to redefine the layer
shift of layer nl in relative units, see above. The prompt

Input rel. shift  S1,S2,S3 ("/"=esc) :

asks for three numbers, s1, s2, s3, defining the shift
components with respect to vectors R1', R2', Rn, see above.
Dummy input "/" leaves the present shift vector unchanged.
After complete input BALSAC returns to submenu CR.

>    >   [M]  selected from submenu CR allows you to redefine the
periodicity transformation matrix of layer nl, see above. The
prompt

Input (2x2) matrix  M11,M12,M21,M22 ("/"=esc) :

asks for four numbers, m11, m12, m21, m22, defining all matrix
components. Dummy input "/" leaves the present matrix
components unchanged. After complete input BALSAC returns to

>    >   [R]  selected from submenu CR allows you to rotate the restructured
layer no. nl about its layer plane normal by applying an
additional rotation transformation on the present periodicity
transformation matrix. The prompt

Input matrix rotation angle :

asks for an angle (in degrees) defining the rotation after
which BALSAC returns to submenu CR.

>    >   [,]  selected from submenu CR returns immediately to the

>   [B]  selected from submenu C allows you to redefine the atom basis

============================================================
Layer  nl :  rebuilt basis (  nb atom(s))
Xyz,R,Id(  1) :    p1      p2      pz ,    rad ,   nuc
...
Xyz,R,Id( nb) :    p1      p2      pz ,    rad ,   nuc

Basis:  [N]ew  [M]od  [A]dd  [D]el    [?,]esc
====================================================== 69 ==

if a separate atom basis was defined before. Here layer basis
vectors rt' = (p1, p2, pz) are given for each of the nb atoms
assigned to the layer where rt' are described by multiples of the
periodicity vectors R1'', R2'' of the restructured layer, and a
layer normal vector Rn, see above, as

rt' = p1 * R1'' + p2 * R2'' + pz * Rn

If layer nl has no separate atoms assigned to it so far (indicated
by nb = 0 in the layer listing of the restructure menu C, see
above) the listing in the basis menu starts with

Layer  nl :  original basis
Xyz,R,Id(  1) :    p1      p2      pz ,    rad ,   nuc
...

giving the atom definition of the original layer without
restructuring.

>    >   [N]  selected from submenu CB allows you to redefine the layer
basis from scratch deleting the previous definition. The
prompt

New basis size  NBSR (0 -  50) :

asks for the size nb of the layer basis set to be used for
layer nl. (At present, up to 50 layers can be restructured.)
Choosing nb = 0 sets the layer basis identical to that of the
unrestructured layer and returns to submenu C. For nb > 0,
the prompts

Input atom(s)  1 - nb :
...

ask for nb sets of 5 numbers defining the components of each
layer basis vector rt' = (p1 ,p2 ,pz ) together with the
vectors rt' are described by multiples of the periodicity
vectors R1'', R2'' of the restructured layer, and a layer
normal vector Rn, see above. After complete input BALSAC

Note that layer basis vectors depend on the transformation
matrix M. As an example we mention a c(2x2) CO adsorbate
layer on top of an fcc(001) surface which may be described by
a transformation matrix

( 2.0   0.0 )
M  =  (           )
( 0.0   2.0 )

and a separate layer basis set  (nb = 4)

C:  (p1, p2, pz), rad, nuc =  (0.0, 0.0, 2.0), 0.5, 6
O:  (p1, p2, pz), rad, nuc =  (0.0, 0.0, 4.0), 0.7, 8
C:  (p1, p2, pz), rad, nuc =  (0.5, 0.5, 2.0), 0.5, 6
O:  (p1, p2, pz), rad, nuc =  (0.5, 0.5, 4.0), 0.7, 8

while an alternative description would use a transformation
matrix

( 1.0   1.0 )
M  =  (           )
(-1.0   1.0 )

and a separate layer basis set  (nb = 2)

C:  (p1, p2, pz), rad, nuc =  (0.0, 0.0, 2.0), 0.5, 6
O:  (p1, p2, pz), rad, nuc =  (0.0, 0.0, 4.0), 0.7, 8

>    >   [M]  selected from submenu CB allows you to modify a selected atom
definition of the basis of layer nl. If for this layer no
separate basis was defined so far (nb = 0) a message

WARNING: layer basis not rebuilt
** Press [C], L-click to continue **

reminds you that you can modify basis atoms only after they
have been defined (option [N] above) and BALSAC returns to
submenu C. For nb > 0 the prompt

Modify atom no. (1 - nb) :

asks you to choose an atom na of the basis set where na lies
inside the range [1,nb] after which the prompt

asks for 5 numbers defining the new components of the layer
basis vector rt' = (p1 ,p2 ,pz ) together with a new atom
Here rt' is described by multiples of the periodicity vectors
R1'', R2'' of the restructured layer, and a layer normal
vector Rn, see above. After complete input BALSAC returns to

>    >   [A]  selected from submenu CB allows you to add another atom to the
basis of layer nl. If for this layer no separate basis was
defined so far (nb = 0) a message

WARNING: layer basis not rebuilt
** Press [C], L-click to continue **

reminds you that you can add basis atoms only after a separate
basis has been defined (option [N] above) and BALSAC returns
to submenu C. For nb > 0 the prompt

asks for 5 numbers defining components of a layer basis vector
rt' = (p1 ,p2 ,pz ) together with an atom radius rad and
nuclear charge nuc assigned to atom no. nb+1 increasing the
basis size by 1. Here rt' is described by multiples of the
periodicity vectors R1'', R2'' of the restructured layer, and
a layer normal vector Rn, see above. After complete input

>    >   [D]  selected from submenu CB allows you to delete an atom of the
basis of layer nl. If for this layer no separate basis was
defined so far (nb = 0) a message

WARNING: layer basis not rebuilt
** Press [C], L-click to continue **

reminds you that you can remove basis atoms only after a
separate basis has been defined (option [N] above) and BALSAC
returns to submenu C. For nb > 0 the prompt

Delete atom no. (0, 1 - nb) :

asks you to choose an atom na of the basis set where na lies
inside the range [1,nb] after which atom no. na is removed
from the layer basis set and BALSAC returns to submenu C.

>    >   [,]  selected from submenu CB returns immediately to the

>   [U]  selected from submenu C allows you to undo (cancel) restructuring
of all or selected layers of the lattice section. This option is
identical to option [U] of the restructure entry menu C' discussed
above.

>   [F]  selected from submenu C allows you to copy the complete
restructuring definition of a different layer to the present layer
nl replacing its previous definition. This makes the construction
of layers with identical restructuring very efficient. The prompt

Get restructure info from layer  N (1 -  n3) :

asks you to choose a layer number nf from which the restructuring
definition will be taken and applied to the present layer no. nl
after which BALSAC returns to submenu C. If layer no. nf was not
restructured a warning

WARNING: layer no. nf  not restructured no action

will be issued and layer no. nf will keep its present restructuring
definition.

>   [S]  selected from submenu C allows you to shift the layer indices of
all restructuring definitions by a fixed amount. This shifts the
complete restructuring scheme of a lattice section up or down by
one or more layers. It becomes particularly useful if the number of
layers of a given lattice section is changed and restructuring is
to be kept fixed at the bottom or top of the section. The prompt

nrtot  layers restructured:   nl1   nl2   ...

Shift indices by  dN ( ns1 - ns2 ) :

shows the indices nl1 ... of all nrtot restructured layers and asks
for a number n within the range [ns1,ns2] used to transfer
restructuring information for all layers k to layers k + n after
which BALSAC returns to submenu C.

>   [X]  selected from submenu C plots the lattice section (switching to
graphics mode (DOS) or opening a graphics window (Unix)) or lists
its atom coordinates depending on the plot/list mode defined in the
graphics option, see Sec. 6.2.7.

>   [D]  selected from submenu C shows up to 10 lines of the most recent
output generated by the graphic analysis option, see Sec. 6.2.14.2,
by

============ Latest Graphics Output ==================

1: Xyz,R,Id( n1)=    x    y    z    rad     nuc
...
======================================================

This allows you to look up and use numerical output from the
analysis for input within submenu C. After the listing BALSAC

>   [I]  selected from submenu C lists all relevant data of the present
lattice definition identical to the Miller adapted basis listing,
option [M] of the analysis menu, see Sec. 6.2.14. Selecting [C]
(or L-click (DOS)) returns to submenu R.

>   [,]  selected from submenu C returns to the BALSAC/LATTICE main option