Skip to content

Commit d709730

Browse files
committed
Updates the multiphase tutorial
1 parent bba7405 commit d709730

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

docs/tutorials/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ The tutorials are organized into the following categories.
4848
time-of-flight neutron powder diffraction data from SEPD at Argonne.
4949
- [NCAF `pd-neut-tof`](cryst-struct_pd-neut-tof_NCAF-WISH.ipynb)
5050
Demonstrates a Rietveld refinement of the Na2Ca3Al2F14 crystal structure
51-
using time-of-flight neutron powder diffraction data from WISH at ISIS.
51+
using time-of-flight neutron powder diffraction data from two detector banks
52+
of the WISH instrument at ISIS.
53+
- [LBCO+Si McStas](cryst-struct_pd-neut-tof_NCAF-WISH.ipynb)
54+
Demonstrates a Rietveld refinement of the La0.5Ba0.5CoO3 crystal structure
55+
with a small amount of Si impurity as a secondary phase using time-of-flight
56+
neutron powder diffraction data simulated with McStas.
5257

5358
## Pair Distribution Function (PDF)
5459

tutorials/cryst-struct_pd-neut-tof_multphase-LBCO-Si_McStas.py

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# %% [markdown]
2-
# # Structure Refinement: LBCO + Si, NPD McStas
2+
# # Structure Refinement: LBCO+Si, McStas
33
#
44
# This example demonstrates a Rietveld refinement of La0.5Ba0.5CoO3 crystal
55
# structure with a small amount of Si phase using time-of-flight neutron powder
@@ -27,47 +27,48 @@
2727
model_1 = SampleModel('lbco')
2828

2929
# %% [markdown]
30-
# ### Set Space Group
30+
# #### Set Space Group
3131

3232
# %%
3333
model_1.space_group.name_h_m = 'P m -3 m'
3434
model_1.space_group.it_coordinate_system_code = '1'
3535

3636
# %% [markdown]
37-
# ### Set Unit Cell
37+
# #### Set Unit Cell
3838

3939
# %%
4040
model_1.cell.length_a = 3.8909
4141

4242
# %% [markdown]
43-
# ### Set Atom Sites
43+
# #### Set Atom Sites
4444

4545
# %%
4646
model_1.atom_sites.add('La', 'La', 0, 0, 0, wyckoff_letter='a', b_iso=0.2, occupancy=0.5)
4747
model_1.atom_sites.add('Ba', 'Ba', 0, 0, 0, wyckoff_letter='a', b_iso=0.2, occupancy=0.5)
4848
model_1.atom_sites.add('Co', 'Co', 0.5, 0.5, 0.5, wyckoff_letter='b', b_iso=0.2567)
4949
model_1.atom_sites.add('O', 'O', 0, 0.5, 0.5, wyckoff_letter='c', b_iso=1.4041)
5050

51+
# %% [markdown]
5152
# ### Create Sample Model 2: Si
5253

5354
# %%
5455
model_2 = SampleModel('si')
5556

5657
# %% [markdown]
57-
# ### Set Space Group
58+
# #### Set Space Group
5859

5960
# %%
6061
model_2.space_group.name_h_m = 'F d -3 m'
6162
model_2.space_group.it_coordinate_system_code = '2'
6263

6364
# %% [markdown]
64-
# ### Set Unit Cell
65+
# #### Set Unit Cell
6566

6667
# %%
6768
model_2.cell.length_a = 5.43146
6869

6970
# %% [markdown]
70-
# ### Set Atom Sites
71+
# #### Set Atom Sites
7172

7273
# %%
7374
model_2.atom_sites.add('Si', 'Si', 0.0, 0.0, 0.0, wyckoff_letter='a', b_iso=0.0)
@@ -201,8 +202,8 @@
201202
# Add excluded regions
202203

203204
# %%
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)
206207

207208
# %% [markdown]
208209
# Show measured data after adding excluded regions
@@ -219,7 +220,8 @@
219220
# %% [markdown]
220221
# ## Analysis
221222
#
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.
223225
#
224226
# ### Set Calculator
225227

@@ -239,13 +241,10 @@
239241

240242
# %%
241243
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
244244
model_1.atom_sites['Co'].b_iso.free = True
245245
model_1.atom_sites['O'].b_iso.free = True
246246

247247
model_2.cell.length_a.free = True
248-
model_2.atom_sites['Si'].b_iso.free = True
249248

250249
# %% [markdown]
251250
# Set experiment parameters to be optimized.
@@ -265,24 +264,6 @@
265264
for point in experiment.background:
266265
point.y.free = True
267266

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-
)
286267

287268
# %%
288269
project.analysis.apply_constraints()
@@ -297,4 +278,4 @@
297278
# ### Plot Measured vs Calculated
298279

299280
# %%
300-
project.plot_meas_vs_calc(expt_name='mcstas', show_residual=False)
281+
project.plot_meas_vs_calc(expt_name='mcstas')

0 commit comments

Comments
 (0)