Created
June 27, 2020 19:12
-
-
Save sriharijayaram5/ae184fec4aed03b14c8c20eb914d49e0 to your computer and use it in GitHub Desktop.
Laue miller indices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
# function to calculate LCM | |
def lcm(a): | |
lcm = a[0] | |
for i in range(1,len(a)): | |
lcm = lcm*a[i]//math.gcd(lcm, a[i]) | |
return lcm | |
def laue(xp, yp): | |
theta = np.arctan(((xp**2 + yp**2)**0.5)/15)/2 | |
z = np.tan(theta)*((xp**2 + yp**2)**0.5) | |
zq = (xp**2 + yp**2 + 15**2)**0.5 - 15 | |
a = np.array([xp, yp, zq]) | |
b = np.round(a,0) | |
b = b/max(b) | |
print(b) | |
print([b.as_integer_ratio() for b in b]) | |
print(b*lcm([b.as_integer_ratio()[1] for b in b])) | |
# laue(0.000452*1000, -0.01144*1000) | |
# laue(-0.008721*1000, 0.008272*1000) | |
laue(-0.011106*1000, 0.000494*1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment