From 265b627b8cb1256e5c9e782f68004ea8a97e48c5 Mon Sep 17 00:00:00 2001 From: Tobias WEBER Date: Tue, 26 Feb 2019 16:05:53 +0100 Subject: [PATCH] continued with formulas --- doc/formulas/formulas.tex | 5 ++++- tools/tascalc/tascalc.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/formulas/formulas.tex b/doc/formulas/formulas.tex index e26c002..721aa94 100644 --- a/doc/formulas/formulas.tex +++ b/doc/formulas/formulas.tex @@ -8,6 +8,8 @@ \documentclass{article} \usepackage{amsmath} +\usepackage{tensor} +\usepackage{bm} \usepackage{graphicx} \usepackage[a4paper]{geometry} @@ -51,7 +53,8 @@ Angle $\psi$ between $\left| k_i \right>$ and $\left| Q \right>$, in units of \A \subsubsection*{Angle $\xi$} -Angle $\xi$ between $\left| Q \right>$ and orientation vector $\left| a \right>$ (i.e. $ax$, $ay$, $az$), in units of rlu; $g_{ij} = \left| b_i \left> \right< b_j \right|$ is the covariant metric of the reciprocal lattice with basis $\left| b_i \right>$: +% $g_{ij} = \left< \bm{b}_i | \bm{b}_j \right> = \tensor{B}{_{ik}} \tensor{B}{^{k}_{j}}$ +Angle $\xi$ between $\left| Q \right>$ and orientation vector $\left| a \right>$ (i.e. $ax$, $ay$, $az$), in units of rlu; $g_{ij} = \left< \bm{b}_i | \bm{b}_j \right>$ is the covariant metric of the reciprocal lattice with basis vectors $\left| \bm{b}_i \right>$, which form the columns of the crystallographic $B$ matrix: $$\xi = \sigma_{\mathrm{side}} \cdot \arccos \left( \frac{ \left< Q | a \right> }{ \sqrt{\left< Q | Q \right>} \sqrt{\left< a | a \right>} } \right)$$ $$\boxed{ \xi = \sigma_{\mathrm{side}} \cdot \arccos \left( \frac{ Q^i g_{ij} a^j }{ \sqrt{Q^i g_{ij} Q^j} \sqrt{a^i g_{ij} a^j} } \right) }$$ diff --git a/tools/tascalc/tascalc.py b/tools/tascalc/tascalc.py index 1a93b4e..347afe0 100644 --- a/tools/tascalc/tascalc.py +++ b/tools/tascalc/tascalc.py @@ -36,6 +36,7 @@ def rotate(_axis, vec, phi): # get metric from crystal B matrix +# basis vectors are in the columns of B, i.e. the second index def get_metric(B): return np.einsum("ij,ik -> jk", B, B) @@ -130,10 +131,12 @@ def get_A(lattice, angles): (cs[0]-cs[1]*cs[2]) / s2, \ (np.sqrt(1. - np.dot(cs,cs) + 2.*cs[0]*cs[1]*cs[2])) / s2]) + # the real-space basis vectors form the columns of the A matrix return np.transpose(np.array([a, b, c])) # crystallographic B matrix converting rlu to 1/A +# the reciprocal-space basis vectors form the columns of the B matrix def get_B(lattice, angles): A = get_A(lattice, angles) B = 2.*np.pi * np.transpose(la.inv(A)) -- 2.18.1