# Theory Behind the Crystallographic Calculator

This app was build to translate between Miller and Miller-Bravais indices, to calculate the angle between given directions and calculate the normal to a given plane for both cubic and hexagonal crystal structures.

The hexagonal system is more conveniently described by 4 basis vectors, 3 of which are co-planar and therefore, not linearly independent. Hence, the tendency to describe planes in hexagonal crystal using the Miller-Bravais system* (hkil) *where \( i=-(h+k)\) and can be omitted in writting *(hk.l)* .

However, when attempting crystallographic computations this system proves cumbersome and transforming to Miller independent indices becomes more convenient. For instance, a crystallographic direction described in Miller-Bravais indices as *[UVTW]* where \( T \equiv -(U+V)\)* *is a vector \(U\mathbf{a_1} + V\mathbf{a_2} + T\mathbf{a_3} + W\mathbf{c}\) in a system in which \(\mathbf{a_3} = -(\mathbf{a_1} + \mathbf{a_2})\). The same vector can be described in a frame defined by independent basis vectors \(\mathbf{a_1}, \mathbf{a_2}, \mathbf{c} \) as *[uvw]*:

\(U\mathbf{a_1} + V\mathbf{a_2} + T\mathbf{a_3} + W\mathbf{c} = u\mathbf{a_1} + v\mathbf{a_2} + w\mathbf{c} \)

- The 1
^{st}block**[uvw]⇔[UVTW]**converts direction vectors written in Miller indices to Miller-Bravais indices and back through the following formulas:

Miller \([uvw]\) ⇒ Miller-Bravais \( [UVTW]:\)

\( U=\frac{1}{3}(2u-v) \hspace{0.5cm}\)

\( V=\frac{1}{3}(2v-u)\hspace{0.5cm}\)

\( T=-(U+V) \hspace{0.5cm}\)

\( W=w \hspace{0.5cm}\)

Miller-Bravais \( [UVTW]\) ⇒ Miller \( [uvw]:\)

\( u = 2U+V \hspace{0.5cm}\)

\( v = 2V+W \hspace{0.5cm}\)

\( w=W\hspace{0.5cm}\)

- The 2
^{nd}block,**(hkl)⇔(hkil)**converts Miller indices describing a set of planes to the equivalent Miller-Bravais indices through the following relationship:

\( i=-(h+k) \quad h=h \quad k=k \quad l=l. \)

- The 3
^{rd}block,**[u**, uses the dot product formula to calculate the cosine between two vectors \(\mathbf{V1}=u_1\mathbf{a} +v_1\mathbf{b} + w_1\mathbf{c} \) and \(\mathbf{V_2}=u_2\mathbf{a} +v_2\mathbf{b} + w_2\mathbf{c} \). The resulting angle is shown in both degrees and rads:_{1}v_{1}w_{1}] ∠ [u_{2}v_{2}w_{2}]

\( cos(\theta)=\displaystyle\frac{u_{1}u_{2}+v_{1}v_{2}+w_{1}w_{2}}{\sqrt{(u_1^2+v_1^2+w_1^2)(u_2^2+v_2^2+w_2^2)}}\)

- The 4
^{th}block,**[U**, uses the metric tensor_{1}V_{1}T_{1}W_{1}] ∠ [U_{2}V_{2}T_{1}W_{2}]**g**to calculate the general dot product in a hexagonal crystal. For more information behind tensors and reciprocal space check this pdf.

- The 5
^{th}block,**[uvw] ⊥ (hkl)**, uses the fact that the reciprocal lattice vector**g**with components (*h, k, l*) is perpendicular to the plane with Miller indices (hkl). Conveniently, for a cubic crystal the real and reciprocal basis vector are along the same direction which means the direction of the vector**g**can be described in real space by (*h, k, l*) . Note the difference with the hexagonal frame for the final block.

- The 6
^{th}block,**[UVW] ⊥ (hkl)**, uses the same identity as before, with the added complication of having to translate the reciprocal space vector**g**to real space coordinates. This is done with the aid of the reciprocal metric tensor. For more information check the pdf above on the 4^{th}block. Please note that while obtaining the vector coordinates is a somewhat easy task, expressing these coordinates as Miller indices can be rather tedious. Here we go from fractional values to smallest possible integers by multiplying all values by 100 and rounding up to nearest integers,*approximating therefore to two decimal places*. Next we find the greatest common divisor of all three indices and reduce the values.