|
1 | 1 | # %% [markdown]
|
2 |
| -# # Structure Refinement: LBCO + Si, NPD McStas |
| 2 | +# # Structure Refinement: LBCO+Si, McStas |
3 | 3 | #
|
4 | 4 | # This example demonstrates a Rietveld refinement of La0.5Ba0.5CoO3 crystal
|
5 | 5 | # structure with a small amount of Si phase using time-of-flight neutron powder
|
|
27 | 27 | model_1 = SampleModel('lbco')
|
28 | 28 |
|
29 | 29 | # %% [markdown]
|
30 |
| -# ### Set Space Group |
| 30 | +# #### Set Space Group |
31 | 31 |
|
32 | 32 | # %%
|
33 | 33 | model_1.space_group.name_h_m = 'P m -3 m'
|
34 | 34 | model_1.space_group.it_coordinate_system_code = '1'
|
35 | 35 |
|
36 | 36 | # %% [markdown]
|
37 |
| -# ### Set Unit Cell |
| 37 | +# #### Set Unit Cell |
38 | 38 |
|
39 | 39 | # %%
|
40 | 40 | model_1.cell.length_a = 3.8909
|
41 | 41 |
|
42 | 42 | # %% [markdown]
|
43 |
| -# ### Set Atom Sites |
| 43 | +# #### Set Atom Sites |
44 | 44 |
|
45 | 45 | # %%
|
46 | 46 | model_1.atom_sites.add('La', 'La', 0, 0, 0, wyckoff_letter='a', b_iso=0.2, occupancy=0.5)
|
47 | 47 | model_1.atom_sites.add('Ba', 'Ba', 0, 0, 0, wyckoff_letter='a', b_iso=0.2, occupancy=0.5)
|
48 | 48 | model_1.atom_sites.add('Co', 'Co', 0.5, 0.5, 0.5, wyckoff_letter='b', b_iso=0.2567)
|
49 | 49 | model_1.atom_sites.add('O', 'O', 0, 0.5, 0.5, wyckoff_letter='c', b_iso=1.4041)
|
50 | 50 |
|
| 51 | +# %% [markdown] |
51 | 52 | # ### Create Sample Model 2: Si
|
52 | 53 |
|
53 | 54 | # %%
|
54 | 55 | model_2 = SampleModel('si')
|
55 | 56 |
|
56 | 57 | # %% [markdown]
|
57 |
| -# ### Set Space Group |
| 58 | +# #### Set Space Group |
58 | 59 |
|
59 | 60 | # %%
|
60 | 61 | model_2.space_group.name_h_m = 'F d -3 m'
|
61 | 62 | model_2.space_group.it_coordinate_system_code = '2'
|
62 | 63 |
|
63 | 64 | # %% [markdown]
|
64 |
| -# ### Set Unit Cell |
| 65 | +# #### Set Unit Cell |
65 | 66 |
|
66 | 67 | # %%
|
67 | 68 | model_2.cell.length_a = 5.43146
|
68 | 69 |
|
69 | 70 | # %% [markdown]
|
70 |
| -# ### Set Atom Sites |
| 71 | +# #### Set Atom Sites |
71 | 72 |
|
72 | 73 | # %%
|
73 | 74 | model_2.atom_sites.add('Si', 'Si', 0.0, 0.0, 0.0, wyckoff_letter='a', b_iso=0.0)
|
|
201 | 202 | # Add excluded regions
|
202 | 203 |
|
203 | 204 | # %%
|
204 |
| -project.experiments['mcstas'].excluded_regions.add(minimum=0, maximum=40000) |
205 |
| -project.experiments['mcstas'].excluded_regions.add(minimum=108000, maximum=200000) |
| 205 | +experiment.excluded_regions.add(minimum=0, maximum=40000) |
| 206 | +experiment.excluded_regions.add(minimum=108000, maximum=200000) |
206 | 207 |
|
207 | 208 | # %% [markdown]
|
208 | 209 | # Show measured data after adding excluded regions
|
|
219 | 220 | # %% [markdown]
|
220 | 221 | # ## Analysis
|
221 | 222 | #
|
222 |
| -# This section outlines the analysis process, including how to configure calculation and fitting engines. |
| 223 | +# This section outlines the analysis process, including how to configure |
| 224 | +# calculation and fitting engines. |
223 | 225 | #
|
224 | 226 | # ### Set Calculator
|
225 | 227 |
|
|
239 | 241 |
|
240 | 242 | # %%
|
241 | 243 | model_1.cell.length_a.free = True
|
242 |
| -model_1.atom_sites['La'].b_iso.free = True |
243 |
| -model_1.atom_sites['Ba'].b_iso.free = True |
244 | 244 | model_1.atom_sites['Co'].b_iso.free = True
|
245 | 245 | model_1.atom_sites['O'].b_iso.free = True
|
246 | 246 |
|
247 | 247 | model_2.cell.length_a.free = True
|
248 |
| -model_2.atom_sites['Si'].b_iso.free = True |
249 | 248 |
|
250 | 249 | # %% [markdown]
|
251 | 250 | # Set experiment parameters to be optimized.
|
|
265 | 264 | for point in experiment.background:
|
266 | 265 | point.y.free = True
|
267 | 266 |
|
268 |
| -# %% [markdown] |
269 |
| -# ### Set Constraints |
270 |
| - |
271 |
| -# %% |
272 |
| -project.analysis.aliases.add( |
273 |
| - label='biso_La', |
274 |
| - param_uid=project.sample_models['lbco'].atom_sites['La'].b_iso.uid |
275 |
| -) |
276 |
| -project.analysis.aliases.add( |
277 |
| - label='biso_Ba', |
278 |
| - param_uid=project.sample_models['lbco'].atom_sites['Ba'].b_iso.uid |
279 |
| -) |
280 |
| - |
281 |
| -# %% |
282 |
| -project.analysis.constraints.add( |
283 |
| - lhs_alias='biso_Ba', |
284 |
| - rhs_expr='biso_La' |
285 |
| -) |
286 | 267 |
|
287 | 268 | # %%
|
288 | 269 | project.analysis.apply_constraints()
|
|
297 | 278 | # ### Plot Measured vs Calculated
|
298 | 279 |
|
299 | 280 | # %%
|
300 |
| -project.plot_meas_vs_calc(expt_name='mcstas', show_residual=False) |
| 281 | +project.plot_meas_vs_calc(expt_name='mcstas') |
0 commit comments