A given real-space cubic lattice will have dimensions:
![{\displaystyle \left(a,b,c\right)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/279335cf6a565c62a12ce1efe7d59f11a0e6f050)
Such that the position of any particular cell within the infinite lattice is:
![{\displaystyle \mathbf {r} _{hkl}=\left\langle ah,bk,cl\right\rangle }](https://wikimedia.org/api/rest_v1/media/math/render/svg/2c3b868cc4012d78be83d74bcbcc61d4bd139b78)
Where h, k, and l are indices.
The corresponding inverse-space lattice would be:
![{\displaystyle \mathbf {q} _{hkl}=2\pi \left\langle {\frac {h}{a}},{\frac {k}{b}},{\frac {l}{c}}\right\rangle }](https://wikimedia.org/api/rest_v1/media/math/render/svg/9f28d9e904d714ad9f2a16699b105416ed592222)
![{\displaystyle q_{hkl}=2\pi {\sqrt {\left({\frac {h}{a}}\right)^{2}+\left({\frac {k}{b}}\right)^{2}+\left({\frac {l}{c}}\right)^{2}}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ada387945a82a83319cfc369e5489694d87be104)
In the case where
:
![{\displaystyle {\begin{alignedat}{2}q_{hkl}&=2\pi {\sqrt {\left({\frac {h}{a}}\right)^{2}+\left({\frac {k}{a}}\right)^{2}+\left({\frac {l}{a}}\right)^{2}}}\\&={\frac {2\pi }{a}}{\sqrt {h^{2}+k^{2}+l^{2}}}\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/af7373cee4f88ad094ad401cb835fdb75af9a8c5)
Vectors
There are many equivalent ways to define/construct the Cartesian basis for the unit cell in real-space. The unit cell vectors can be written as:
![{\displaystyle {\begin{array}{l}\mathbf {a} ={\begin{bmatrix}a\\0\\0\end{bmatrix}}\\\mathbf {b} ={\begin{bmatrix}b\cos {\gamma }\\b\sin {\gamma }\\0\end{bmatrix}}\\\mathbf {c} ={\begin{bmatrix}c\sin {\theta _{c}}\cos {\phi _{c}}\\c\sin {\theta _{c}}\sin {\phi _{c}}\\c\cos {\theta _{c}}\end{bmatrix}}={\begin{bmatrix}c\cos {\beta }\\c{\frac {\cos {\alpha }-\cos {\beta }\cos {\gamma }}{\sin {\gamma }}}\\c{\sqrt {1-\cos ^{2}{\beta }-\left({\frac {\cos {\alpha }-\cos {\beta }\cos {\gamma }}{\sin {\gamma }}}\right)^{2}}}\end{bmatrix}}\end{array}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/67b1dcabbd3d21847468716cb6081ed386a90495)
According to this, the vectors can be written as:
![{\displaystyle {\begin{array}{l}\mathbf {a} ={\begin{bmatrix}a\\0\\0\end{bmatrix}}\\\mathbf {b} ={\begin{bmatrix}b\cos {\gamma }\\b\sin {\gamma }\\0\end{bmatrix}}\\\mathbf {c} ={\begin{bmatrix}c\cos {\beta }\\c_{y}\\c_{z}\\\end{bmatrix}}={\begin{bmatrix}c\cos {\beta }\\{\frac {c}{\sin \gamma }}\left(\cos \alpha -\cos \beta \cos \gamma \right)\\{\frac {c}{\sin \gamma }}{\sqrt {1-\cos ^{2}\alpha -\cos ^{2}\beta -\cos ^{2}\gamma +2\cos \alpha \cos \beta \cos \gamma }}\\\end{bmatrix}}\end{array}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/40cda96550a1c919f5f6cc968235b607f1be98f9)
which is mathematically equivalent.
According to:
![{\displaystyle {\begin{array}{l}\mathbf {a} ={\begin{bmatrix}a\\0\\0\end{bmatrix}}\\\mathbf {b} ={\begin{bmatrix}b\cos {\gamma }\\b\sin {\gamma }\\0\end{bmatrix}}\\\mathbf {c} ={\begin{bmatrix}c\cos {\beta }\\-c\sin \beta \cos \alpha ^{*}\\{\frac {1}{c^{*}}}\\\end{bmatrix}}={\begin{bmatrix}c\cos {\beta }\\{\frac {c}{\sin \gamma }}\left(\cos \alpha -\cos \beta \cos \gamma \right)\\{\frac {c}{\sin \gamma }}{\sqrt {1-\cos ^{2}\alpha -\cos ^{2}\beta -\cos ^{2}\gamma +2\cos \alpha \cos \beta \cos \gamma }}\\\end{bmatrix}}\end{array}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/28bbd9101affb82424c248290d0dd4da06cb1fef)
TBD: Reciprocal vector components
![{\displaystyle {\begin{alignedat}{2}\mathbf {u} &=...\\\mathbf {v} &=...\\\mathbf {w} &={\frac {\mathbf {a} \times \mathbf {b} }{\mathbf {a} \cdot (\mathbf {b} \times \mathbf {c} )}}\\&={\frac {1}{V}}\mathbf {a} \times \mathbf {b} \\&={\frac {1}{V}}{\begin{bmatrix}0\\0\\ab\sin {\gamma }\end{bmatrix}}\\\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fe622a6f1a962dec60fe4a9f4a5b41e218543588)
Calculate q_hkl generally
def q_hkl(self, h, k, l):
"""Determines the position in reciprocal space for the given reflection."""
# The 'unitcell' coordinate system assumes:
# a-axis lies along x-axis
# b-axis is in x-y plane
# c-axis is vertical (or at a tilt, depending on beta)
# Convert from (unitcell) Cartesian to (unitcell) fractional coordinates
reduced_volume = sqrt( 1 - (cos(self.alpha))**2 - (cos(self.beta))**2 - (cos(self.gamma))**2 + 2*cos(self.alpha)*cos(self.beta)*cos(self.gamma) )
#volume = reduced_volume*self.lattice_spacing_a*self.lattice_spacing_b*self.lattice_spacing_c
a = ( self.lattice_spacing_a , \
0.0 , \
0.0 )
b = ( self.lattice_spacing_b*cos(self.gamma) , \
self.lattice_spacing_b*sin(self.gamma) , \
0.0 )
c = ( self.lattice_spacing_c*cos(self.beta) , \
self.lattice_spacing_c*( cos(self.alpha) - cos(self.beta)*cos(self.gamma) )/( sin(self.gamma) ) , \
self.lattice_spacing_c*reduced_volume/( sin(self.gamma) ) )
# Compute (unitcell) reciprocal-space lattice vectors
volume = np.dot( a, np.cross(b,c) )
u = np.cross( b, c ) / volume # Along qx
v = np.cross( c, a ) / volume # Along qy
w = np.cross( a, b ) / volume # Along qz
qhkl_vector = 2*pi*( h*u + k*v + l*w )
qhkl = sqrt( qhkl_vector[0]**2 + qhkl_vector[1]**2 + qhkl_vector[2]**2 )
return (qhkl, qhkl_vector)
def q_hkl_length(self, h, k, l):
qhkl, qhkl_vector = self.q_hkl(h,k,l)
#qhkl = sqrt( qhkl_vector[0]**2 + qhkl_vector[1]**2 + qhkl_vector[2]**2 )
return qhkl