PbSO₄ on a laboratory diffractometer¶
Fit PbSO₄ to the Rietveld round robin's laboratory X-ray pattern, with the Cu Kα doublet and Bérar-Baldinozzi asymmetry.
The project is the catalogue case pd-xray-cwl_pbso4-lab, the one the command line and the
app's Examples open.
Fitting
Single pd xray cwl Bragg
Crystal structure
import easydiffraction as edi
Load the project¶
project_path = edi.download_data('pd-xray-cwl_pbso4-lab', destination='data')
project = edi.Project.load(project_path)
structure = project.structures['pbso4']
lab = project.experiments['lab']
Data 'pd-xray-cwl_pbso4-lab' is at data/pd-xray-cwl_pbso4-lab-a5c4b3ad01e7/pd-xray-cwl_pbso4-lab
The project marks what its fit frees. The fit below frees it in stages, so start with all of it fixed.
for parameter in project.free_parameters:
parameter.free = False
project.display.pattern('lab')
Perform the analysis¶
The fit goes in stages, freeing one group of parameters at a time.
Scale and 2θ zero¶
The 2θ zero first: freed together with the cell from the start, the two pull against each other and the fit cannot take a step.
lab.linked_structures['pbso4'].scale.free = True
lab.instrument.calib_twotheta_offset.free = True
project.display.parameters.free()
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 2 free
iter time (s) Rwp (%) reduced χ² change
114.69 551.55
1 0.022 58.28 142.41 74.2% ↓
2 0.041 56.65 134.57 5.5% ↓
3 0.059 54.94 126.54 6.0% ↓
4 0.078 53.17 118.53 6.3% ↓
5 0.097 51.27 110.21 7.0% ↓
6 0.115 49.26 101.76 7.7% ↓
7 0.132 47.28 93.73 7.9% ↓
8 0.151 45.50 86.81 7.4% ↓
9 0.169 44.08 81.48 6.1% ↓
10 0.188 43.08 77.81 4.5% ↓
11 0.207 42.43 75.49 3.0% ↓
12 0.226 42.04 74.09 1.9% ↓
13 0.244 41.80 73.27 1.1% ↓
14 0.262 41.67 72.80 0.6% ↓
15 0.281 41.59 72.54 0.4% ↓
16 0.299 41.55 72.39 0.2% ↓
17 0.317 41.53 72.31 0.1% ↓
18 0.338 41.52 72.27 0.1% ↓
19 0.357 41.51 72.25
20 0.375 41.51 72.23
21 0.394 41.50 72.23
22 0.412 41.50 72.22
23 0.430 41.50 72.22
24 0.449 41.50 72.22
25 0.467 41.50 72.22
26 0.487 41.50 72.22
27 0.517 41.50 72.22
done · converged · 27 iters · reduced χ² 72.22 · Rwp 41.50 % · 0.54 s
project.display.pattern('lab')
Cell¶
structure.cell.length_a.free = True
structure.cell.length_b.free = True
structure.cell.length_c.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 5 free
iter time (s) Rwp (%) reduced χ² change
41.50 72.26
1 0.026 39.32 64.85 10.3% ↓
2 0.049 36.89 57.10 11.9% ↓
3 0.074 34.51 49.96 12.5% ↓
4 0.097 32.61 44.61 10.7% ↓
5 0.120 31.42 41.42 7.1% ↓
6 0.144 30.72 39.60 4.4% ↓
7 0.212 30.68 39.48 0.3% ↓
8 0.235 30.48 38.97 1.3% ↓
9 0.259 30.45 38.90 0.2% ↓
10 0.282 30.42 38.81 0.2% ↓
11 0.307 30.38 38.72 0.2% ↓
12 0.330 30.35 38.64 0.2% ↓
13 0.352 30.32 38.57 0.2% ↓
14 0.376 30.30 38.51 0.2% ↓
15 0.399 30.27 38.45 0.2% ↓
16 0.422 30.25 38.38 0.2% ↓
17 0.445 30.22 38.32 0.2% ↓
18 0.467 30.21 38.28 0.1% ↓
19 0.492 30.20 38.25 0.1% ↓
20 0.514 30.19 38.23 0.1% ↓
21 0.536 30.18 38.20 0.1% ↓
22 0.560 30.16 38.16 0.1% ↓
23 0.585 30.14 38.11 0.1% ↓
24 0.608 30.12 38.05 0.1% ↓
25 0.632 30.10 38.01 0.1% ↓
26 0.656 30.09 37.98 0.1% ↓
27 0.680 30.08 37.97
28 0.704 30.08 37.96
29 0.726 30.08 37.96
30 0.750 30.08 37.96
31 0.773 30.08 37.95
32 0.797 30.08 37.95
33 0.832 30.08 37.95
done · converged · 33 iters · reduced χ² 37.95 · Rwp 30.08 % · 0.86 s
project.display.pattern('lab')
Background¶
The six Chebyshev terms.
for term in lab.background_terms:
term.coef.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 11 free
iter time (s) Rwp (%) reduced χ² change
30.08 37.99
1 0.037 29.27 35.97 5.3% ↓
2 0.059 29.27 35.97
3 0.081 29.27 35.97
4 0.110 29.26 35.97
5 0.140 29.26 35.97
6 0.170 29.26 35.97
7 0.195 29.26 35.96
8 0.229 29.26 35.96
9 0.257 29.26 35.96
10 0.278 29.26 35.96
11 0.306 29.26 35.95
12 0.329 29.25 35.93 0.1% ↓
13 0.351 29.21 35.82 0.3% ↓
14 0.375 29.16 35.71 0.3% ↓
15 0.398 29.15 35.69 0.1% ↓
16 0.421 29.15 35.68
17 0.445 29.15 35.68
18 0.468 29.15 35.68
19 0.490 29.15 35.68
20 0.528 29.15 35.68
done · converged · 20 iters · reduced χ² 35.68 · Rwp 29.15 % · 0.55 s
project.display.pattern('lab')
Peak widths¶
lab.peak.broad_gauss_u.free = True
lab.peak.broad_gauss_v.free = True
lab.peak.broad_gauss_w.free = True
lab.peak.mixing_eta_0.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 15 free
iter time (s) Rwp (%) reduced χ² change
29.15 35.71
1 0.044 17.53 12.92 63.8% ↓
2 0.078 14.02 8.26 36.1% ↓
3 0.121 13.51 7.67 7.2% ↓
4 0.168 13.46 7.62 0.6% ↓
5 0.219 13.46 7.62
6 0.268 13.46 7.62
7 0.316 13.46 7.62
8 0.381 13.46 7.62
done · converged · 8 iters · reduced χ² 7.62 · Rwp 13.46 % · 0.43 s
project.display.pattern('lab')
Peak asymmetry¶
lab.peak.asym_beba_a0.free = True
lab.peak.asym_beba_b0.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 17 free
iter time (s) Rwp (%) reduced χ² change
13.46 7.62
1 0.070 12.84 6.93 9.0% ↓
2 0.118 12.76 6.85 1.3% ↓
3 0.171 12.76 6.84 0.1% ↓
4 0.226 12.76 6.84
5 0.277 12.76 6.84
6 0.328 12.76 6.84
7 0.380 12.76 6.84
8 0.433 12.76 6.84
9 0.515 12.76 6.84
done · converged · 9 iters · reduced χ² 6.84 · Rwp 12.76 % · 0.58 s
project.display.pattern('lab')
Lead and sulphur positions¶
X-rays see the heavy atoms first, so their coordinates come before the oxygens'.
for site in structure.atom_sites:
if site.type_symbol != 'O':
for coordinate in (site.fract_x, site.fract_y, site.fract_z):
coordinate.free = not coordinate.symmetry_constrained
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 21 free
iter time (s) Rwp (%) reduced χ² change
12.76 6.85
1 0.098 11.94 6.00 12.3% ↓
2 0.171 11.93 5.99 0.2% ↓
3 0.246 11.93 5.99
4 0.341 11.93 5.99
done · converged · 4 iters · reduced χ² 5.99 · Rwp 11.93 % · 0.42 s
project.display.pattern('lab')
Oxygen positions¶
for site in structure.atom_sites:
if site.type_symbol == 'O':
for coordinate in (site.fract_x, site.fract_y, site.fract_z):
coordinate.free = not coordinate.symmetry_constrained
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 28 free
iter time (s) Rwp (%) reduced χ² change
11.93 6.00
1 0.123 11.83 5.90 1.7% ↓
2 0.206 11.83 5.90 0.1% ↓
3 0.284 11.83 5.90
4 0.363 11.83 5.90
5 0.464 11.83 5.90
done · converged · 5 iters · reduced χ² 5.90 · Rwp 11.83 % · 0.55 s
project.display.pattern('lab')
Displacements¶
The correlations after this stage show how far the oxygen displacements can be told apart; the case keeps them separate.
for site in structure.atom_sites:
site.adp_iso.free = True
project.analysis.fit()
project.display.fit.results()
edi fit: project pd-xray-cwl_pbso4-lab, 5799 pts fitted / 6001 loaded, 33 free
iter time (s) Rwp (%) reduced χ² change
11.83 5.90
1 0.080 8.96 3.38 42.6% ↓
2 0.123 8.41 2.98 12.0% ↓
3 0.166 8.40 2.98 0.1% ↓
4 0.208 8.40 2.98
5 0.273 8.40 2.98
done · converged · 5 iters · reduced χ² 2.98 · Rwp 8.40 % · 0.33 s
project.display.pattern('lab')
project.display.fit.correlations()
project.display.structure('pbso4')
Save the project¶
project.save_as('pd-xray-cwl_pbso4-lab')
project.report.save_html('pd-xray-cwl_pbso4-lab.html')
Saving project to 'pd-xray-cwl_pbso4-lab'
Saving report to 'pd-xray-cwl_pbso4-lab.html'