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

\section{Description}
The modifications to the VASP code allow to rotate all atom coordinates individually in the particle position evaluation routine of VASP.
In that way constraints for every atom can be applied independently of the chosen basis.
A patch against version 4.6 of the 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{Usage}

Since this feature only makes sense in selective dynamics mode, it can be switched on by adding the word {\em Transformed} in front of the {\em selective dynamics} switch.
This feature only works in 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.
All these information is given in the POSCAR file as can be seen in the follwing example:
\begin{verbatim}
cubic diamond                           
   5.48000000000000     
     2.9909698580839312    0.0039546630279804   -0.0039658085666586
     0.0039548953566878    2.9909698596656376   -0.0039660323646892
    -0.0039680658132861   -0.0039674231313905    2.9909994291263242
 216   1
Transformed selective dynamics
Direct
 0.994174 0.994174 -0.000408732 T F T 45 36.5145
 0.182792 0.182792 0.981597 T F T -135 -5.95043
 ...
 0.119896 0.119896 0.0385525 T F T -135 21.8036
\end{verbatim}
In case of the first atom the basis is transformed by a rotation of $45^{\circ}$ and $36.5145^{\circ}$ about the $z$ and $x'$ axis.
Relaxation of this atom is constrained to the $y''$-axis.

