Difference between revisions of "Talk:Unit cell"
(Created page with "====TBD: Reciprocal vector components==== :<math> \begin{alignat}{2} \mathbf{u} & = ... \\ \mathbf{v} & = ... \\ \mathbf{w} & = \frac{\mathbf{a}\times\mathbf{b}}{\mathbf{a}\...") |
KevinYager (talk | contribs) (→Vectors) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ====Extra math expressions==== | ||
+ | A given real-space cubic lattice will have dimensions: | ||
+ | :<math>\left(a,b,c\right)</math> | ||
+ | Such that the position of any particular cell within the infinite lattice is: | ||
+ | :<math>\mathbf{r}_{hkl} = \left\langle ah,bk,cl\right\rangle </math> | ||
+ | Where ''h'', ''k'', and ''l'' are indices. | ||
+ | The corresponding inverse-space lattice would be: | ||
+ | :<math> | ||
+ | \mathbf{q}_{hkl} = 2\pi \left\langle \frac{h}{a} , \frac{k}{b} , \frac{l}{c} \right\rangle | ||
+ | </math> | ||
+ | :<math> | ||
+ | q_{hkl} = 2\pi \sqrt{ \left( \frac{h}{a} \right)^2 + \left( \frac{k}{b} \right)^2 + \left( \frac{l}{c} \right)^2 } | ||
+ | </math> | ||
+ | In the case where <math>a=b=c</math>: | ||
+ | :<math> | ||
+ | \begin{alignat}{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{alignat} | ||
+ | </math> | ||
+ | |||
+ | ====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: | ||
+ | :<math>\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} | ||
+ | </math> | ||
+ | |||
+ | According to [https://www.ocf.berkeley.edu/~rfu/notes/vect_unit_cells.pdf this], the vectors can be written as: | ||
+ | :<math>\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} | ||
+ | </math> | ||
+ | which is mathematically equivalent. | ||
+ | |||
+ | According to: | ||
+ | * K. N. Trueblood, H.-B. Bürgi, H. Burzlaff, J. D. Dunitz, C. M. Gramaccioli, H. H. Schulz, U. Shmueli and S. C. Abrahams [https://scripts.iucr.org/cgi-bin/paper?S0108767396005697 Atomic Dispacement Parameter Nomenclature. Report of a Subcommittee on Atomic Displacement Parameter Nomenclature] ''Acta Cryst'' '''1996''', A52, 770-781. [https://doi.org/10.1107/S0108767396005697 doi: 10.1107/S0108767396005697] | ||
+ | The vectors are written as: | ||
+ | :<math>\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} \\ | ||
+ | c \frac{\cos\alpha -\cos\beta \cos\gamma }{\sin\gamma} \\ | ||
+ | \frac{c}{\sin\gamma} \sqrt{1 + 2 \cos\alpha\cos\beta\cos\gamma - \cos^2 \alpha - \cos^2\beta -\cos^2\gamma}\\ | ||
+ | \end{bmatrix} | ||
+ | \end{array} | ||
+ | </math> | ||
+ | This is, again, an equivalent expression. The equivalence can be show by: | ||
+ | :<math>\begin{alignat}{2} | ||
+ | c_z &= 1/c^{*} \\ | ||
+ | &= \frac{c}{\sin\gamma} \sqrt{1 + 2 \cos\alpha\cos\beta\cos\gamma - \cos^2 \alpha - \cos^2\beta -\cos^2\gamma}\\ | ||
+ | &= c \sqrt{\frac{1 + 2 \cos\alpha\cos\beta\cos\gamma - \cos^2 \alpha - \cos^2\beta -\cos^2\gamma}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{\frac{1}{\sin^2\gamma} + \frac{2 \cos\alpha\cos\beta\cos\gamma}{\sin^2\gamma} - \frac{\cos^2 \alpha}{\sin^2\gamma} - \frac{\cos^2\beta}{\sin^2\gamma} - \frac{\cos^2\gamma}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{\frac{1-\cos^2\gamma}{\sin^2\gamma} + \frac{2 \cos\alpha\cos\beta\cos\gamma}{\sin^2\gamma} - \frac{\cos^2 \alpha}{\sin^2\gamma} - \frac{\cos^2\beta}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{\frac{\sin^2\gamma}{\sin^2\gamma} + \frac{2 \cos\alpha\cos\beta\cos\gamma}{\sin^2\gamma} - \frac{\cos^2 \alpha}{\sin^2\gamma} - \frac{\cos^2\beta(\sin^2\gamma+\cos^2\gamma)}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{1 + \frac{2 \cos\alpha\cos\beta\cos\gamma}{\sin^2\gamma} - \frac{\cos^2 \alpha}{\sin^2\gamma} - \frac{\cos^2\beta\sin^2\gamma}{\sin^2\gamma} -\frac{\cos^2\beta\cos^2\gamma}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{1 - \cos^2\beta \frac{\sin^2\gamma}{\sin^2\gamma} - \frac{\cos^2 \alpha}{\sin^2\gamma} + \frac{2 \cos\alpha\cos\beta\cos\gamma}{\sin^2\gamma} -\frac{\cos^2\beta\cos^2\gamma}{\sin^2\gamma} }\\ | ||
+ | &= c \sqrt{1 - \cos^2\beta - \frac{1}{\sin^2\gamma}\left( \cos^2 \alpha - 2 \cos\alpha\cos\beta\cos\gamma + \cos^2\beta\cos^2\gamma \right)}\\ | ||
+ | &= c \sqrt{1 - \cos^2\beta - \frac{1}{\sin^2\gamma}\left( \cos\alpha - \cos\beta\cos\gamma\right)\left( \cos\alpha - \cos\beta\cos\gamma\right)}\\ | ||
+ | &= c \sqrt{1 - \cos^2\beta - \left(\frac{ \cos\alpha - \cos\beta\cos\gamma}{\sin\gamma}\right)^2 }\\ | ||
+ | |||
+ | \end{alignat} | ||
+ | </math> | ||
+ | |||
====TBD: Reciprocal vector components==== | ====TBD: Reciprocal vector components==== | ||
:<math> | :<math> | ||
Line 10: | Line 126: | ||
\end{alignat} | \end{alignat} | ||
</math> | </math> | ||
+ | |||
+ | ==Calculate q_hkl generally== | ||
+ | <source lang="python"> | ||
+ | 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 | ||
+ | </source> |
Latest revision as of 09:26, 14 November 2022
Contents
Extra math expressions
A given real-space cubic lattice will have dimensions:
Such that the position of any particular cell within the infinite lattice is:
Where h, k, and l are indices. The corresponding inverse-space lattice would be:
In the case where :
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:
According to this, the vectors can be written as:
which is mathematically equivalent.
According to:
- K. N. Trueblood, H.-B. Bürgi, H. Burzlaff, J. D. Dunitz, C. M. Gramaccioli, H. H. Schulz, U. Shmueli and S. C. Abrahams Atomic Dispacement Parameter Nomenclature. Report of a Subcommittee on Atomic Displacement Parameter Nomenclature Acta Cryst 1996, A52, 770-781. doi: 10.1107/S0108767396005697
The vectors are written as:
This is, again, an equivalent expression. The equivalence can be show by:
TBD: Reciprocal vector components
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