Structure Refinement: Tb2TiO7, HEiDi¶
Crystal structure refinement of Tb2TiO7 using single crystal neutron diffraction data from HEiDi at FRM II.
Import Library¶
In [2]:
Copied!
import easydiffraction as ed
import easydiffraction as ed
Step 1: Define Project¶
In [3]:
Copied!
# Create minimal project without name and description
project = ed.Project()
# Create minimal project without name and description
project = ed.Project()
Step 2: Define Structure¶
In [4]:
Copied!
# Download CIF file from repository
structure_path = ed.download_data(id=20, destination='data')
# Download CIF file from repository
structure_path = ed.download_data(id=20, destination='data')
Getting data...
Data #20: Tb2Ti2O7 (crystal structure)
✅ Data #20 downloaded to 'data/ed-20.cif'
In [5]:
Copied!
project.structures.add_from_cif_path(structure_path)
project.structures.add_from_cif_path(structure_path)
In [6]:
Copied!
project.structures.show_names()
project.structures.show_names()
Defined structures 🧩
['tbti']
In [7]:
Copied!
structure = project.structures['tbti']
structure = project.structures['tbti']
In [8]:
Copied!
structure.atom_sites['Tb'].b_iso = 0.0
structure.atom_sites['Ti'].b_iso = 0.0
structure.atom_sites['O1'].b_iso = 0.0
structure.atom_sites['O2'].b_iso = 0.0
structure.atom_sites['Tb'].b_iso = 0.0
structure.atom_sites['Ti'].b_iso = 0.0
structure.atom_sites['O1'].b_iso = 0.0
structure.atom_sites['O2'].b_iso = 0.0
In [9]:
Copied!
structure.show_as_cif()
structure.show_as_cif()
Structure 🧩 'tbti' as cif
| CIF | |
|---|---|
| 1 | data_tbti |
| 2 | |
| 3 | _cell.length_a 10.13000000 |
| 4 | _cell.length_b 10.13000000 |
| 5 | _cell.length_c 10.13000000 |
| 6 | _cell.angle_alpha 90.00000000 |
| 7 | _cell.angle_beta 90.00000000 |
| 8 | _cell.angle_gamma 90.00000000 |
| 9 | |
| 10 | _space_group.name_H-M_alt "F d -3 m" |
| 11 | _space_group.IT_coordinate_system_code 2 |
| 12 | |
| 13 | loop_ |
| 14 | _atom_site.label |
| 15 | _atom_site.type_symbol |
| 16 | _atom_site.fract_x |
| 17 | _atom_site.fract_y |
| 18 | _atom_site.fract_z |
| 19 | _atom_site.Wyckoff_letter |
| 20 | _atom_site.occupancy |
| 21 | _atom_site.B_iso_or_equiv |
| 22 | _atom_site.adp_type |
| 23 | Tb Tb 0.50000000 0.50000000 0.50000000 d 1.00000000 0.00000000 Biso |
| 24 | Ti Ti 0.00000000 0.00000000 0.00000000 c 1.00000000 0.00000000 Biso |
| 25 | O1 O 0.32804000 0.12500000 0.12500000 f 1.00000000 0.00000000 Biso |
| 26 | O2 O 0.37500000 0.37500000 0.37500000 b 0.97000000 0.00000000 Biso |
Step 3: Define Experiment¶
In [10]:
Copied!
data_path = ed.download_data(id=19, destination='data')
data_path = ed.download_data(id=19, destination='data')
Getting data...
Data #19: Tb2Ti2O7, HEiDi (MLZ)
✅ Data #19 downloaded to 'data/ed-19.xye'
In [11]:
Copied!
project.experiments.add_from_data_path(
name='heidi',
data_path=data_path,
sample_form='single crystal',
beam_mode='constant wavelength',
radiation_probe='neutron',
)
project.experiments.add_from_data_path(
name='heidi',
data_path=data_path,
sample_form='single crystal',
beam_mode='constant wavelength',
radiation_probe='neutron',
)
Data loaded successfully
Experiment 🔬 'heidi'. Number of data points: 220.
In [12]:
Copied!
experiment = project.experiments['heidi'] # TODO: <heidi (None)>
experiment = project.experiments['heidi'] # TODO: <heidi (None)>
In [13]:
Copied!
experiment.linked_crystal.id = 'tbti'
experiment.linked_crystal.scale = 1.0
experiment.linked_crystal.id = 'tbti'
experiment.linked_crystal.scale = 1.0
In [14]:
Copied!
experiment.instrument.setup_wavelength = 0.793
experiment.instrument.setup_wavelength = 0.793
In [15]:
Copied!
experiment.extinction.mosaicity = 29820
experiment.extinction.radius = 30
experiment.extinction.mosaicity = 29820
experiment.extinction.radius = 30
Step 4: Perform Analysis¶
In [16]:
Copied!
project.plot_meas_vs_calc(expt_name='heidi')
project.plot_meas_vs_calc(expt_name='heidi')
In [17]:
Copied!
experiment.linked_crystal.scale.free = True
experiment.extinction.radius.free = True
experiment.linked_crystal.scale.free = True
experiment.extinction.radius.free = True
In [18]:
Copied!
experiment.show_as_cif()
experiment.show_as_cif()
Experiment 🔬 'heidi' as cif
| CIF | |
|---|---|
| 1 | data_heidi |
| 2 | |
| 3 | _expt_type.sample_form "single crystal" |
| 4 | _expt_type.beam_mode "constant wavelength" |
| 5 | _expt_type.radiation_probe neutron |
| 6 | _expt_type.scattering_type bragg |
| 7 | |
| 8 | _diffrn.ambient_temperature None |
| 9 | _diffrn.ambient_pressure None |
| 10 | _diffrn.ambient_magnetic_field None |
| 11 | _diffrn.ambient_electric_field None |
| 12 | |
| 13 | _extinction.mosaicity 29820.00000000 |
| 14 | _extinction.radius 30.00000000 |
| 15 | |
| 16 | _sc_crystal_block.id tbti |
| 17 | _sc_crystal_block.scale 1.00000000 |
| 18 | |
| 19 | _instr.wavelength 0.79300000 |
| 20 | |
| 21 | loop_ |
| 22 | _refln.id |
| 23 | _refln.d_spacing |
| 24 | _refln.sin_theta_over_lambda |
| 25 | _refln.index_h |
| 26 | _refln.index_k |
| 27 | _refln.index_l |
| 28 | _refln.intensity_meas |
| 29 | _refln.intensity_meas_su |
| 30 | _refln.intensity_calc |
| 31 | _refln.wavelength |
| 32 | 1 5.84855823 0.08549116 1 1 1 194.56770000 2.32530000 70.70434347 0.00000000 |
| 33 | 2 3.58149585 0.13960647 2 2 0 22.63190000 1.12330000 5.36662412 0.00000000 |
| 34 | 3 3.05430992 0.16370310 3 1 1 99.29170000 2.56200000 34.58237047 0.00000000 |
| 35 | 4 2.92427911 0.17098231 2 2 2 219.28770000 3.25220000 75.59158819 0.00000000 |
| 36 | 5 2.53250000 0.19743337 4 0 0 1366.73770000 31.07660000 525.98535818 0.00000000 |
| 37 | 6 2.32398138 0.21514802 3 3 1 1381.24040000 24.41820000 524.34607512 0.00000000 |
| 38 | 7 2.06777759 0.24180550 4 2 2 272.46650000 4.23510000 102.47071749 0.00000000 |
| 39 | 8 1.94951941 0.25647347 5 1 1 991.50850000 19.20150000 382.60109139 0.00000000 |
| 40 | 9 1.94951941 0.25647347 3 3 3 504.58740000 7.25520000 171.41304211 0.00000000 |
| 41 | 10 1.79074792 0.27921294 4 4 0 2167.68580000 37.96090000 755.00629740 0.00000000 |
| 42 | ... |
| 43 | 211 0.52241486 0.95709375 18 6 4 59.66740000 9.11170000 42.29620112 0.00000000 |
| 44 | 212 0.52241486 0.95709375 14 12 6 43.38570000 9.20750000 16.56049760 0.00000000 |
| 45 | 213 0.52034315 0.96090436 19 3 3 23.80390000 9.18670000 0.67255365 0.00000000 |
| 46 | 214 0.52034315 0.96090436 17 9 3 48.75870000 7.73330000 15.66868414 0.00000000 |
| 47 | 215 0.51694440 0.96722201 16 8 8 29.30630000 12.65520000 10.49908682 0.00000000 |
| 48 | 216 0.51493684 0.97099287 17 7 7 1601.51540000 628.89150000 979.81259767 0.00000000 |
| 49 | 217 0.51493684 0.97099287 13 13 7 1176.08960000 414.60180000 837.22733156 0.00000000 |
| 50 | 218 0.51493684 0.97099287 19 5 1 0.83340000 20.42070000 1.03428818 0.00000000 |
| 51 | 219 0.51493684 0.97099287 15 9 9 10.98640000 8.06500000 0.70341088 0.00000000 |
| 52 | 220 0.51427283 0.97224657 12 12 10 14.40740000 11.38000000 0.00000000 0.00000000 |
In [19]:
Copied!
# Start refinement. All parameters, which have standard uncertainties
# in the input CIF files, are refined by default.
project.analysis.fit()
# Start refinement. All parameters, which have standard uncertainties
# in the input CIF files, are refined by default.
project.analysis.fit()
Using experiment 🔬 'heidi' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 512.08 | |
| 2 | 13 | 187.71 | 63.3% ↓ |
| 3 | 23 | 66.70 | 64.5% ↓ |
| 4 | 33 | 13.20 | 80.2% ↓ |
| 5 | 43 | 12.84 | 2.8% ↓ |
| 6 | 74 | 12.84 |
🏆 Best goodness-of-fit (reduced χ²) is 12.84 at iteration 73
✅ Fitting complete.
In [20]:
Copied!
# Show fit results summary
project.analysis.show_fit_results()
# Show fit results summary
project.analysis.show_fit_results()
Fit results
✅ Success: True
⏱️ Fitting time: 1.76 seconds
📏 Goodness-of-fit (reduced χ²): 12.84
📏 R-factor (Rf): 7.68%
📏 R-factor squared (Rf²): 8.14%
📏 Weighted R-factor (wR): 8.51%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | tbti | atom_site | Tb | b_iso | 0.0000 | 0.5303 | 0.0222 | Ų | N/A |
| 2 | tbti | atom_site | Ti | b_iso | 0.0000 | 0.4760 | 0.0327 | Ų | N/A |
| 3 | tbti | atom_site | O1 | fract_x | 0.3280 | 0.3280 | 0.0001 | 0.00 % ↓ | |
| 4 | tbti | atom_site | O1 | occupancy | 1.0000 | 1.0015 | 0.0103 | 0.15 % ↑ | |
| 5 | tbti | atom_site | O1 | b_iso | 0.0000 | 0.4516 | 0.0196 | Ų | N/A |
| 6 | tbti | atom_site | O2 | occupancy | 0.9700 | 0.9687 | 0.0183 | 0.13 % ↓ | |
| 7 | tbti | atom_site | O2 | b_iso | 0.0000 | 0.2333 | 0.0381 | Ų | N/A |
| 8 | heidi | extinction | radius | 30.0000 | 27.1471 | 1.0427 | µm | 9.51 % ↓ | |
| 9 | heidi | linked_crystal | scale | 1.0000 | 2.9210 | 0.0583 | 192.10 % ↑ |
In [21]:
Copied!
experiment.show_as_cif()
experiment.show_as_cif()
Experiment 🔬 'heidi' as cif
| CIF | |
|---|---|
| 1 | data_heidi |
| 2 | |
| 3 | _expt_type.sample_form "single crystal" |
| 4 | _expt_type.beam_mode "constant wavelength" |
| 5 | _expt_type.radiation_probe neutron |
| 6 | _expt_type.scattering_type bragg |
| 7 | |
| 8 | _diffrn.ambient_temperature None |
| 9 | _diffrn.ambient_pressure None |
| 10 | _diffrn.ambient_magnetic_field None |
| 11 | _diffrn.ambient_electric_field None |
| 12 | |
| 13 | _extinction.mosaicity 29820.00000000 |
| 14 | _extinction.radius 27.14714199 |
| 15 | |
| 16 | _sc_crystal_block.id tbti |
| 17 | _sc_crystal_block.scale 2.92102835 |
| 18 | |
| 19 | _instr.wavelength 0.79300000 |
| 20 | |
| 21 | loop_ |
| 22 | _refln.id |
| 23 | _refln.d_spacing |
| 24 | _refln.sin_theta_over_lambda |
| 25 | _refln.index_h |
| 26 | _refln.index_k |
| 27 | _refln.index_l |
| 28 | _refln.intensity_meas |
| 29 | _refln.intensity_meas_su |
| 30 | _refln.intensity_calc |
| 31 | _refln.wavelength |
| 32 | 1 5.84855823 0.08549116 1 1 1 194.56770000 2.32530000 206.33175510 0.00000000 |
| 33 | 2 3.58149585 0.13960647 2 2 0 22.63190000 1.12330000 15.33289341 0.00000000 |
| 34 | 3 3.05430992 0.16370310 3 1 1 99.29170000 2.56200000 97.60574185 0.00000000 |
| 35 | 4 2.92427911 0.17098231 2 2 2 219.28770000 3.25220000 215.52043827 0.00000000 |
| 36 | 5 2.53250000 0.19743337 4 0 0 1366.73770000 31.07660000 1608.99981288 0.00000000 |
| 37 | 6 2.32398138 0.21514802 3 3 1 1381.24040000 24.41820000 1583.81250618 0.00000000 |
| 38 | 7 2.06777759 0.24180550 4 2 2 272.46650000 4.23510000 285.13547112 0.00000000 |
| 39 | 8 1.94951941 0.25647347 5 1 1 991.50850000 19.20150000 1102.20798047 0.00000000 |
| 40 | 9 1.94951941 0.25647347 3 3 3 504.58740000 7.25520000 491.44427626 0.00000000 |
| 41 | 10 1.79074792 0.27921294 4 4 0 2167.68580000 37.96090000 2318.98900610 0.00000000 |
| 42 | ... |
| 43 | 211 0.52241486 0.95709375 18 6 4 59.66740000 9.11170000 80.13302726 0.00000000 |
| 44 | 212 0.52241486 0.95709375 14 12 6 43.38570000 9.20750000 38.16401987 0.00000000 |
| 45 | 213 0.52034315 0.96090436 19 3 3 23.80390000 9.18670000 7.97474738 0.00000000 |
| 46 | 214 0.52034315 0.96090436 17 9 3 48.75870000 7.73330000 40.45604773 0.00000000 |
| 47 | 215 0.51694440 0.96722201 16 8 8 29.30630000 12.65520000 10.19565915 0.00000000 |
| 48 | 216 0.51493684 0.97099287 17 7 7 1601.51540000 628.89150000 1719.43846073 0.00000000 |
| 49 | 217 0.51493684 0.97099287 13 13 7 1176.08960000 414.60180000 1398.33865452 0.00000000 |
| 50 | 218 0.51493684 0.97099287 19 5 1 0.83340000 20.42070000 0.61943652 0.00000000 |
| 51 | 219 0.51493684 0.97099287 15 9 9 10.98640000 8.06500000 0.34582844 0.00000000 |
| 52 | 220 0.51427283 0.97224657 12 12 10 14.40740000 11.38000000 0.00000000 0.00000000 |
In [22]:
Copied!
project.experiments.show_names()
project.experiments.show_names()
Defined experiments 🔬
['heidi']
In [23]:
Copied!
project.plot_meas_vs_calc(expt_name='heidi')
project.plot_meas_vs_calc(expt_name='heidi')
Step 5: Show Project Summary¶
In [24]:
Copied!
project.summary.show_report()
project.summary.show_report()
———————————— PROJECT INFO ————————————
Title
Untitled Project
————————————————————— CRYSTALLOGRAPHIC DATA —————————————————————
Phase datablock
🧩 tbti
Space group
F d -3 m
Cell parameters
| Parameter | Value | |
|---|---|---|
| 1 | a | 10.13000 |
| 2 | b | 10.13000 |
| 3 | c | 10.13000 |
| 4 | alpha | 90.00000 |
| 5 | beta | 90.00000 |
| 6 | gamma | 90.00000 |
Atom sites
| label | type | x | y | z | occ | Biso | |
|---|---|---|---|---|---|---|---|
| 1 | Tb | Tb | 0.50000 | 0.50000 | 0.50000 | 1.00000 | 0.53035 |
| 2 | Ti | Ti | 0.00000 | 0.00000 | 0.00000 | 1.00000 | 0.47604 |
| 3 | O1 | O | 0.32804 | 0.12500 | 0.12500 | 1.00155 | 0.45165 |
| 4 | O2 | O | 0.37500 | 0.37500 | 0.37500 | 0.96871 | 0.23334 |
——————————— EXPERIMENTS ———————————
Experiment datablock
🔬 heidi
Experiment type
single crystal, neutron, constant wavelength
Wavelength
0.79300
——————— FITTING ———————
Calculation engine
heidi: CalculatorEnum.CRYSPY
Minimization engine
lmfit
Fit quality
| metric | value | |
|---|---|---|
| 1 | Goodness-of-fit (reduced χ²) | 12.84 |