倒易空间mapping导入与绘制

目前只涉及日本理学的XRD数据。

1
import xrayutilities as xu

数据导入

1
2
[om, tt], MAP = xu.io.getras_scan('RSM-%05d.ras',2,'Omega','TwoTheta')
psd = MAP['int']

上述%05d表示文件命名规则为XXX00001.......后面的数字2则表示XXX00002。

新建晶体结构

1
2
3
4
5
6
7
8
9
10
11
# 首先如果晶体结构不包含在预定义的材料内的话,需要自己先定义
# 在 predefined_materials.py中添加如下代码:

LaSrAlO4 = Crystal("LaSrAlO4", SGLattice(139, 3.7544, 12.6494,
atoms=[e.La, e.Sr, e.Al, e.O, e.O],
pos=[('4e', 0.3589) ,
('4e', 0.35890),
'2a',
('4e', 0.16270),
'4c'],
occ=[0.5,0.5,1,1,1]) )

上述代码中,pos,要根据Space group number在wyckpos.py中查找对应数字。比如上述例子中的139,然后看其对应的site。如果site后都是数字,如(0,0.5,0)这样的,则不需要额外添加数字。如果是(0, 0, z) 这样的,则需要输入z值。具体格式可参见上述的例子。 为了验证建立的晶体结构是否正确,可计算衍射峰并与标准PDF卡片的值进行对比。

1
2
3
4
5
6
7
import numpy as np
from xrayutilities.materials import predefined_materials

LaSrAlO4 = predefined_materials.LaSrAlO4
energy = 'CuKa12'
xup = xu.PowderExperiment(en=energy)
print(xu.simpack.PowderDiffraction(LaSrAlO4))

输出如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Powder diffraction object 
-------------------------
Powder-LaSrAlO4 (a: 3.7544, c: 12.649, at0_La_4e_0_pos: 0.3589, at1_Sr_4e_0_pos: 0.3589, at3_O_4e_0_pos: 0.1627, at0_La_4e_occupation: 0.5, at1_Sr_4e_occupation: 0.5, at2_Al_2a_occupation: 1, at3_O_4e_occupation: 1, at4_O_4c_occupation: 1, at0_La_4e_biso: 0, at1_Sr_4e_biso: 0, at2_Al_2a_biso: 0, at3_O_4e_biso: 0, at4_O_4c_biso: 0, volume: 1, )
Lattice:
139 tetragonal I4/mmm: a = 3.7544, b = 3.7544 c= 12.6494
alpha = 90.000, beta = 90.000, gamma = 90.000
Lattice base:
0: La (57) 4e 0.3589 occ=0.500 b=0.000
1: Sr (38) 4e 0.3589 occ=0.500 b=0.000
2: Al (13) 2a occ=1.000 b=0.000
3: O ( 8) 4e 0.1627 occ=1.000 b=0.000
4: O ( 8) 4c occ=1.000 b=0.000
Reflection conditions:
general: hkl: h+k+l=2n, hk0: h+k=2n, 0kl: k+l=2n, hhl: l=2n, 00l: l=2n, h00: h=2n
4e: None
4c: hkl: l=2n
2a: None

Reflections:
--------------
h k l | tth | |Q| |Int | Int (%)
---------------------------------------------------------------
(0, 0, 2) 13.9910 0.993 0.18 0.28
(1, 0, 1) 24.7158 1.746 23.56 36.28
(0, 0, 4) 28.1963 1.987 12.72 19.59
(1, 0, 3) 31.8905 2.241 51.49 79.31
(1, 1, 0) 33.7347 2.367 38.28 58.96
(1, 1, 2) 36.6831 2.567 4.18 6.43
(0, 0, 6) 42.8614 2.980 7.41 11.42
(1, 0, 5) 43.0806 2.995 6.34 9.77
(1, 1, -4) 44.5244 3.090 28.58 44.02
(2, 0, 0) 48.4528 3.347 20.97 32.29
(2, 0, 2) 50.6860 3.491 0.02 0.02
(2, 1, 1) 55.1361 3.775 5.69 8.77
(1, 1, -6) 55.6241 3.806 6.81 10.49
....

数据处理与绘图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import matplotlib.pyplot as plt

hxrd = xu.HXRD(LaSrAlO4.Q(1,1,0),LaSrAlO4.Q(0,0,1)) #暂时不确定这个选择规则,

qx, qy, qz = hxrd.Ang2Q(om, tt)


gridder = xu.Gridder2D(75, 225) #根据实际数据来调节这个

psd = MAP['int']

gridder(qy, qz, psd)

INT = xu.maplog(gridder.data.transpose(), 6, 0)

# plot the intensity as contour plot
plt.figure()
cf = plt.contourf(gridder.xaxis, gridder.yaxis, INT, 100, extend='min')
plt.xlabel(r'$Q_{[110]}$ ($\mathrm{\AA^{-1}}$)')
plt.ylabel(r'$Q_{[001]}$ ($\mathrm{\AA^{-1}}$)')
cb = plt.colorbar(cf)
cb.set_label(r"$\log($Int$)$ (cps)")
plt.tight_layout()

布拉格峰的可视化