\chapter{Modifications to the VASP code}
\label{app:patch_vasp}

\section{Description}
In the \textsc{vasp} code, the {\em selective dynamics} mode provides a feature to allow or constrain the change of each of the three coordinates for every single atom.
By this, however, applied constraints are restricted to the chosen basis.
For the investigation of migration pathways utilizing the constrained relaxation technique as detailed in section~\ref{section:basics:migration}, the required constraint not necessarily corresponds to one of the coordinate axes as defined by the basis, which, in turn, is determined to enable a construction within the supercell approach.

Thus, the functionality of the {\em selective dynamics} mode had to be extended by modifications in the particle position evaluation routine of \textsc{vasp}.
These modifications allow for a rotation of all atom coordinates individually before respective constraints are applied and a following, final inverse transformation.
In that way, constraints for every single atom can be applied independently of the chosen basis.
A patch against version 4.6 of the \textsc{vasp} code containing these modifications is available for download\footnote{http://www.physik.uni-augsburg.de/\~{}zirkelfr/download/posic/sd\_rot\_all-atoms.patch}.

\section{Mode of operation}

The extended capabilities can only be used within the {\em selective dynamics} mode.
It is enabled by adding the word {\em transformed} in front of the {\em selective dynamics} switch.
This feature only works in {\em direct} mode.
Two values of angles need to be added after the extra flags of each atom.
The first angle corresponds to the rotation of the basis about the $z$-axis.
The second angle determines the rotation about the transformed $x$-axis, $x'$.
All values have to be supplied in degrees.
The entire information is given in the POSCAR file as can be seen in the example displayed in Fig.~\ref{fig:vasp_input}.
\begin{figure}[t]
\begin{Verbatim}[frame=single]
cubic diamond
 5.429
 1.00000 0.00000 0.00000
 0.00000 1.00000 0.00000
 0.00000 0.00000 1.00000
 8
transformed selective dynamics
direct
 0.00000 0.00000 0.00000 T F T 45.0 30.0
 0.50000 0.50000 0.00000 T T T 0.0 0.0
 0.50000 0.00000 0.50000 T T T 0.0 0.0
 0.00000 0.50000 0.50000 T T T 0.0 0.0
 0.25000 0.25000 0.25000 T F T 135.0 -10.0
 0.75000 0.75000 0.25000 T T T 0.0 0.0
 0.75000 0.25000 0.75000 T T T 0.0 0.0
 0.25000 0.75000 0.75000 T T T 0.0 0.0
\end{Verbatim}
\caption{Example \textsc{vasp} input file utilizing the {\em transformed selective dynamics} mode of operation.}
\label{fig:vasp_input}
\end{figure}
In case of the first atom, the basis is transformed by a rotation of $45^{\circ}$ and $30^{\circ}$ about the $z$ and $x'$ axis.
The basis of the fifth atom is likewise rotated by $135^{\circ}$ and $-10^{\circ}$ respectively.
Relaxation of both atoms is only allowed within the plane perpendicular to the $y''$-axis.

