Structure Refinement: Co2SiO4, D20¶
This example demonstrates a Rietveld refinement of Co2SiO4 crystal structure using constant wavelength neutron powder diffraction data from D20 at ILL.
Import Library¶
In [2]:
Copied!
from easydiffraction import ExperimentFactory
from easydiffraction import Project
from easydiffraction import StructureFactory
from easydiffraction import download_data
from easydiffraction import ExperimentFactory
from easydiffraction import Project
from easydiffraction import StructureFactory
from easydiffraction import download_data
In [3]:
Copied!
structure = StructureFactory.from_scratch(name='cosio')
structure = StructureFactory.from_scratch(name='cosio')
Set Space Group¶
In [4]:
Copied!
structure.space_group.name_h_m = 'P n m a'
structure.space_group.it_coordinate_system_code = 'abc'
structure.space_group.name_h_m = 'P n m a'
structure.space_group.it_coordinate_system_code = 'abc'
Set Unit Cell¶
In [5]:
Copied!
structure.cell.length_a = 10.3
structure.cell.length_b = 6.0
structure.cell.length_c = 4.8
structure.cell.length_a = 10.3
structure.cell.length_b = 6.0
structure.cell.length_c = 4.8
Set Atom Sites¶
In [6]:
Copied!
structure.atom_sites.create(
label='Co1',
type_symbol='Co',
fract_x=0,
fract_y=0,
fract_z=0,
wyckoff_letter='a',
adp_iso=0.5,
)
structure.atom_sites.create(
label='Co2',
type_symbol='Co',
fract_x=0.279,
fract_y=0.25,
fract_z=0.985,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='Si',
type_symbol='Si',
fract_x=0.094,
fract_y=0.25,
fract_z=0.429,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O1',
type_symbol='O',
fract_x=0.091,
fract_y=0.25,
fract_z=0.771,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O2',
type_symbol='O',
fract_x=0.448,
fract_y=0.25,
fract_z=0.217,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O3',
type_symbol='O',
fract_x=0.164,
fract_y=0.032,
fract_z=0.28,
wyckoff_letter='d',
adp_iso=0.5,
)
structure.atom_sites.create(
label='Co1',
type_symbol='Co',
fract_x=0,
fract_y=0,
fract_z=0,
wyckoff_letter='a',
adp_iso=0.5,
)
structure.atom_sites.create(
label='Co2',
type_symbol='Co',
fract_x=0.279,
fract_y=0.25,
fract_z=0.985,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='Si',
type_symbol='Si',
fract_x=0.094,
fract_y=0.25,
fract_z=0.429,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O1',
type_symbol='O',
fract_x=0.091,
fract_y=0.25,
fract_z=0.771,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O2',
type_symbol='O',
fract_x=0.448,
fract_y=0.25,
fract_z=0.217,
wyckoff_letter='c',
adp_iso=0.5,
)
structure.atom_sites.create(
label='O3',
type_symbol='O',
fract_x=0.164,
fract_y=0.032,
fract_z=0.28,
wyckoff_letter='d',
adp_iso=0.5,
)
In [7]:
Copied!
data_path = download_data(id=12, destination='data')
data_path = download_data(id=12, destination='data')
Getting data...
Data #12: Co2SiO4, D20 (ILL)
✅ Data #12 downloaded to 'data/ed-12.xye'
Create Experiment¶
In [8]:
Copied!
expt = ExperimentFactory.from_data_path(name='d20', data_path=data_path)
expt = ExperimentFactory.from_data_path(name='d20', data_path=data_path)
Set Instrument¶
In [9]:
Copied!
expt.instrument.setup_wavelength = 1.87
expt.instrument.calib_twotheta_offset = 0.1
expt.instrument.setup_wavelength = 1.87
expt.instrument.calib_twotheta_offset = 0.1
Set Peak Profile¶
In [10]:
Copied!
expt.show_current_peak_profile_type()
expt.show_supported_peak_profile_types()
expt.peak_profile_type = 'pseudo-voigt + empirical asymmetry'
expt.peak.broad_gauss_u = 0.3
expt.peak.broad_gauss_v = -0.5
expt.peak.broad_gauss_w = 0.4
expt.show_current_peak_profile_type()
expt.show_supported_peak_profile_types()
expt.peak_profile_type = 'pseudo-voigt + empirical asymmetry'
expt.peak.broad_gauss_u = 0.3
expt.peak.broad_gauss_v = -0.5
expt.peak.broad_gauss_w = 0.4
Current peak profile type
pseudo-voigt
Supported types
| Type | Description | |
|---|---|---|
| 1 | pseudo-voigt | Pseudo-Voigt profile |
| 2 | pseudo-voigt + empirical asymmetry | Pseudo-Voigt with empirical asymmetry correction |
⚠️ Switching peak profile type discards existing peak parameters.
Peak profile type for experiment 'd20' changed to
pseudo-voigt + empirical asymmetry
Set Background¶
In [11]:
Copied!
expt.show_current_background_type()
expt.show_supported_background_types()
expt.background.create(id='1', x=8, y=500)
expt.background.create(id='2', x=9, y=500)
expt.background.create(id='3', x=10, y=500)
expt.background.create(id='4', x=11, y=500)
expt.background.create(id='5', x=12, y=500)
expt.background.create(id='6', x=15, y=500)
expt.background.create(id='7', x=25, y=500)
expt.background.create(id='8', x=30, y=500)
expt.background.create(id='9', x=50, y=500)
expt.background.create(id='10', x=70, y=500)
expt.background.create(id='11', x=90, y=500)
expt.background.create(id='12', x=110, y=500)
expt.background.create(id='13', x=130, y=500)
expt.background.create(id='14', x=150, y=500)
expt.show_current_background_type()
expt.show_supported_background_types()
expt.background.create(id='1', x=8, y=500)
expt.background.create(id='2', x=9, y=500)
expt.background.create(id='3', x=10, y=500)
expt.background.create(id='4', x=11, y=500)
expt.background.create(id='5', x=12, y=500)
expt.background.create(id='6', x=15, y=500)
expt.background.create(id='7', x=25, y=500)
expt.background.create(id='8', x=30, y=500)
expt.background.create(id='9', x=50, y=500)
expt.background.create(id='10', x=70, y=500)
expt.background.create(id='11', x=90, y=500)
expt.background.create(id='12', x=110, y=500)
expt.background.create(id='13', x=130, y=500)
expt.background.create(id='14', x=150, y=500)
Current background type
line-segment
Supported types
| Type | Description | |
|---|---|---|
| 1 | chebyshev | Chebyshev polynomial background |
| 2 | line-segment | Linear interpolation between points |
Set Linked Phases¶
In [12]:
Copied!
expt.linked_phases.create(id='cosio', scale=1.0)
expt.linked_phases.create(id='cosio', scale=1.0)
In [13]:
Copied!
project = Project()
project = Project()
Add Structure¶
In [14]:
Copied!
project.structures.add(structure)
project.structures.add(structure)
Add Experiment¶
In [15]:
Copied!
project.experiments.add(expt)
project.experiments.add(expt)
In [16]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
In [17]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=41, x_max=54, show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=41, x_max=54, show_residual=True)
Set Free Parameters¶
In [18]:
Copied!
structure.cell.length_a.free = True
structure.cell.length_b.free = True
structure.cell.length_c.free = True
structure.atom_sites['Co2'].fract_x.free = True
structure.atom_sites['Co2'].fract_z.free = True
structure.atom_sites['Si'].fract_x.free = True
structure.atom_sites['Si'].fract_z.free = True
structure.atom_sites['O1'].fract_x.free = True
structure.atom_sites['O1'].fract_z.free = True
structure.atom_sites['O2'].fract_x.free = True
structure.atom_sites['O2'].fract_z.free = True
structure.atom_sites['O3'].fract_x.free = True
structure.atom_sites['O3'].fract_y.free = True
structure.atom_sites['O3'].fract_z.free = True
structure.atom_sites['Co1'].adp_iso.free = True
structure.atom_sites['Co2'].adp_iso.free = True
structure.atom_sites['Si'].adp_iso.free = True
structure.atom_sites['O1'].adp_iso.free = True
structure.atom_sites['O2'].adp_iso.free = True
structure.atom_sites['O3'].adp_iso.free = True
structure.cell.length_a.free = True
structure.cell.length_b.free = True
structure.cell.length_c.free = True
structure.atom_sites['Co2'].fract_x.free = True
structure.atom_sites['Co2'].fract_z.free = True
structure.atom_sites['Si'].fract_x.free = True
structure.atom_sites['Si'].fract_z.free = True
structure.atom_sites['O1'].fract_x.free = True
structure.atom_sites['O1'].fract_z.free = True
structure.atom_sites['O2'].fract_x.free = True
structure.atom_sites['O2'].fract_z.free = True
structure.atom_sites['O3'].fract_x.free = True
structure.atom_sites['O3'].fract_y.free = True
structure.atom_sites['O3'].fract_z.free = True
structure.atom_sites['Co1'].adp_iso.free = True
structure.atom_sites['Co2'].adp_iso.free = True
structure.atom_sites['Si'].adp_iso.free = True
structure.atom_sites['O1'].adp_iso.free = True
structure.atom_sites['O2'].adp_iso.free = True
structure.atom_sites['O3'].adp_iso.free = True
In [19]:
Copied!
expt.linked_phases['cosio'].scale.free = True
expt.instrument.calib_twotheta_offset.free = True
expt.peak.broad_gauss_u.free = True
expt.peak.broad_gauss_v.free = True
expt.peak.broad_gauss_w.free = True
expt.peak.broad_lorentz_y.free = True
expt.peak.asym_empir_2.free = True
for point in expt.background:
point.y.free = True
expt.linked_phases['cosio'].scale.free = True
expt.instrument.calib_twotheta_offset.free = True
expt.peak.broad_gauss_u.free = True
expt.peak.broad_gauss_v.free = True
expt.peak.broad_gauss_w.free = True
expt.peak.broad_lorentz_y.free = True
expt.peak.asym_empir_2.free = True
for point in expt.background:
point.y.free = True
Set Constraints¶
Set aliases for parameters.
In [20]:
Copied!
project.analysis.aliases.create(
label='biso_Co1',
param=project.structures['cosio'].atom_sites['Co1'].adp_iso,
)
project.analysis.aliases.create(
label='biso_Co2',
param=project.structures['cosio'].atom_sites['Co2'].adp_iso,
)
project.analysis.aliases.create(
label='biso_Co1',
param=project.structures['cosio'].atom_sites['Co1'].adp_iso,
)
project.analysis.aliases.create(
label='biso_Co2',
param=project.structures['cosio'].atom_sites['Co2'].adp_iso,
)
Set constraints.
In [21]:
Copied!
project.analysis.constraints.create(expression='biso_Co2 = biso_Co1')
project.analysis.constraints.create(expression='biso_Co2 = biso_Co1')
Run Fitting¶
In [22]:
Copied!
project.analysis.fit()
project.analysis.fit()
Standard fitting
📋 Using experiment 🔬 'd20' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 423.51 | |
| 2 | 44 | 73.62 | 82.6% ↓ |
| 3 | 85 | 38.63 | 47.5% ↓ |
| 4 | 127 | 18.79 | 51.4% ↓ |
| 5 | 168 | 15.79 | 16.0% ↓ |
| 6 | 209 | 10.43 | 34.0% ↓ |
| 7 | 250 | 7.95 | 23.8% ↓ |
| 8 | 291 | 4.82 | 39.4% ↓ |
| 9 | 332 | 4.50 | 6.6% ↓ |
| 10 | 538 | 4.50 |
🏆 Best goodness-of-fit (reduced χ²) is 4.50 at iteration 521
✅ Fitting complete.
In [23]:
Copied!
project.analysis.display.fit_results()
project.analysis.display.fit_results()
Fit results
✅ Success: True
⏱️ Fitting time: 30.19 seconds
📏 Goodness-of-fit (reduced χ²): 4.50
📏 R-factor (Rf): 3.02%
📏 R-factor squared (Rf²): 4.50%
📏 Weighted R-factor (wR): 4.82%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | cosio | cell | length_a | 10.3000 | 10.3084 | 0.0003 | Å | 0.08 % ↑ | |
| 2 | cosio | cell | length_b | 6.0000 | 6.0036 | 0.0002 | Å | 0.06 % ↑ | |
| 3 | cosio | cell | length_c | 4.8000 | 4.7865 | 0.0001 | Å | 0.28 % ↓ | |
| 4 | cosio | atom_site | Co1 | adp_iso | 0.5000 | 0.2832 | 0.0795 | Ų | 43.37 % ↓ |
| 5 | cosio | atom_site | Co2 | fract_x | 0.2790 | 0.2793 | 0.0007 | 0.11 % ↑ | |
| 6 | cosio | atom_site | Co2 | fract_z | 0.9850 | 0.9851 | 0.0014 | 0.01 % ↑ | |
| 7 | cosio | atom_site | Si | fract_x | 0.0940 | 0.0936 | 0.0004 | 0.43 % ↓ | |
| 8 | cosio | atom_site | Si | fract_z | 0.4290 | 0.4289 | 0.0008 | 0.01 % ↓ | |
| 9 | cosio | atom_site | Si | adp_iso | 0.5000 | 0.3653 | 0.0622 | Ų | 26.93 % ↓ |
| 10 | cosio | atom_site | O1 | fract_x | 0.0910 | 0.0911 | 0.0003 | 0.13 % ↑ | |
| 11 | cosio | atom_site | O1 | fract_z | 0.7710 | 0.7714 | 0.0006 | 0.05 % ↑ | |
| 12 | cosio | atom_site | O1 | adp_iso | 0.5000 | 0.6564 | 0.0577 | Ų | 31.29 % ↑ |
| 13 | cosio | atom_site | O2 | fract_x | 0.4480 | 0.4482 | 0.0003 | 0.05 % ↑ | |
| 14 | cosio | atom_site | O2 | fract_z | 0.2170 | 0.2168 | 0.0007 | 0.08 % ↓ | |
| 15 | cosio | atom_site | O2 | adp_iso | 0.5000 | 0.5898 | 0.0578 | Ų | 17.96 % ↑ |
| 16 | cosio | atom_site | O3 | fract_x | 0.1640 | 0.1636 | 0.0002 | 0.25 % ↓ | |
| 17 | cosio | atom_site | O3 | fract_y | 0.0320 | 0.0317 | 0.0003 | 1.09 % ↓ | |
| 18 | cosio | atom_site | O3 | fract_z | 0.2800 | 0.2801 | 0.0005 | 0.05 % ↑ | |
| 19 | cosio | atom_site | O3 | adp_iso | 0.5000 | 0.8357 | 0.0481 | Ų | 67.14 % ↑ |
| 20 | d20 | linked_phases | cosio | scale | 1.0000 | 1.1971 | 0.0106 | 19.71 % ↑ | |
| 21 | d20 | peak | asym_empir_2 | 0.0000 | -0.0088 | 0.0019 | N/A | ||
| 22 | d20 | peak | broad_gauss_u | 0.3000 | 0.2434 | 0.0067 | deg² | 18.85 % ↓ | |
| 23 | d20 | peak | broad_gauss_v | -0.5000 | -0.5316 | 0.0145 | deg² | 6.32 % ↑ | |
| 24 | d20 | peak | broad_gauss_w | 0.4000 | 0.3863 | 0.0090 | deg² | 3.43 % ↓ | |
| 25 | d20 | peak | broad_lorentz_y | 0.0000 | 0.0151 | 0.0044 | deg | N/A | |
| 26 | d20 | instrument | twotheta_offset | 0.1000 | 0.2766 | 0.0033 | deg | 176.58 % ↑ | |
| 27 | d20 | background | 1 | y | 500.0000 | 608.6687 | 14.4339 | 21.73 % ↑ | |
| 28 | d20 | background | 2 | y | 500.0000 | 580.6521 | 9.6559 | 16.13 % ↑ | |
| 29 | d20 | background | 3 | y | 500.0000 | 562.9262 | 9.1738 | 12.59 % ↑ | |
| 30 | d20 | background | 4 | y | 500.0000 | 540.3070 | 8.7047 | 8.06 % ↑ | |
| 31 | d20 | background | 5 | y | 500.0000 | 519.8761 | 6.0048 | 3.98 % ↑ | |
| 32 | d20 | background | 6 | y | 500.0000 | 507.3630 | 3.4588 | 1.47 % ↑ | |
| 33 | d20 | background | 7 | y | 500.0000 | 463.2907 | 3.1664 | 7.34 % ↓ | |
| 34 | d20 | background | 8 | y | 500.0000 | 434.2065 | 2.3727 | 13.16 % ↓ | |
| 35 | d20 | background | 9 | y | 500.0000 | 450.8811 | 2.2342 | 9.82 % ↓ | |
| 36 | d20 | background | 10 | y | 500.0000 | 430.4276 | 2.0102 | 13.91 % ↓ | |
| 37 | d20 | background | 11 | y | 500.0000 | 413.9130 | 2.2431 | 17.22 % ↓ | |
| 38 | d20 | background | 12 | y | 500.0000 | 361.4064 | 2.0763 | 27.72 % ↓ | |
| 39 | d20 | background | 13 | y | 500.0000 | 291.1902 | 1.9518 | 41.76 % ↓ | |
| 40 | d20 | background | 14 | y | 500.0000 | 238.9220 | 2.9516 | 52.22 % ↓ |
In [24]:
Copied!
project.plotter.plot_param_correlations()
project.plotter.plot_param_correlations()
Plot Measured vs Calculated¶
In [25]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
In [26]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=42, x_max=52, show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=42, x_max=52, show_residual=True)
Perform Analysis (ADP aniso)¶
In [27]:
Copied!
for label in ('O1', 'O2', 'O3'):
atom_site = structure.atom_sites[label]
atom_site.occupancy.free = True
for label in ('O1', 'O2', 'O3'):
atom_site = structure.atom_sites[label]
atom_site.occupancy.free = True
In [28]:
Copied!
for label in ('O1', 'O2', 'O3'):
atom_site = structure.atom_sites[label]
atom_site.adp_type = 'Uani'
atom_site_aniso = structure.atom_site_aniso[label]
for component in ('adp_11', 'adp_22', 'adp_33', 'adp_12', 'adp_13', 'adp_23'):
getattr(atom_site_aniso, component).free = True
for label in ('O1', 'O2', 'O3'):
atom_site = structure.atom_sites[label]
atom_site.adp_type = 'Uani'
atom_site_aniso = structure.atom_site_aniso[label]
for component in ('adp_11', 'adp_22', 'adp_33', 'adp_12', 'adp_13', 'adp_23'):
getattr(atom_site_aniso, component).free = True
In [29]:
Copied!
structure.show_as_cif()
structure.show_as_cif()
Structure 🧩 'cosio' as cif
| CIF | |
|---|---|
| 1 | data_cosio |
| 2 | |
| 3 | _cell.length_a 10.30842232(28061) |
| 4 | _cell.length_b 6.00362684(16423) |
| 5 | _cell.length_c 4.78645786(13344) |
| 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 "P n m a" |
| 11 | _space_group.IT_coordinate_system_code abc |
| 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.U_iso_or_equiv |
| 22 | _atom_site.adp_type |
| 23 | Co1 Co 0.00000000 0.00000000 0.00000000 a 1.00000000 0.00358633(7951018) Uiso |
| 24 | Co2 Co 0.27930486(68947) 0.25000000 0.98507511(144478) c 1.00000000 0.00358633 Uiso |
| 25 | Si Si 0.09359828(38646) 0.25000000 0.42894964(82698) c 1.00000000 0.00462694(6224821) Uiso |
| 26 | O1 O 0.09112237(29571) 0.25000000 0.77140447(64155) c 1.00000000() 0.00831378 Uani |
| 27 | O2 O 0.44824292(25137) 0.25000000 0.21682903(67726) c 1.00000000() 0.00747013 Uani |
| 28 | O3 O 0.16358488(22865) 0.03165250(32597) 0.28012709(48825) d 1.00000000() 0.01058419 Uani |
| 29 | |
| 30 | loop_ |
| 31 | _atom_site_aniso.label |
| 32 | _atom_site_aniso.U_11 |
| 33 | _atom_site_aniso.U_22 |
| 34 | _atom_site_aniso.U_33 |
| 35 | _atom_site_aniso.U_12 |
| 36 | _atom_site_aniso.U_13 |
| 37 | _atom_site_aniso.U_23 |
| 38 | Co1 ? ? ? ? ? ? |
| 39 | Co2 ? ? ? ? ? ? |
| 40 | Si ? ? ? ? ? ? |
| 41 | O1 0.00831378() 0.00831378() 0.00831378() 0.00000000 0.00000000() 0.00000000 |
| 42 | O2 0.00747013() 0.00747013() 0.00747013() 0.00000000 0.00000000() 0.00000000 |
| 43 | O3 0.01058419() 0.01058419() 0.01058419() 0.00000000() 0.00000000() 0.00000000() |
In [30]:
Copied!
project.analysis.display.free_params()
project.analysis.display.free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | cosio | cell | length_a | 10.30842 | 0.00028 | -inf | inf | Å | |
| 2 | cosio | cell | length_b | 6.00363 | 0.00016 | -inf | inf | Å | |
| 3 | cosio | cell | length_c | 4.78646 | 0.00013 | -inf | inf | Å | |
| 4 | cosio | atom_site | Co1 | adp_iso | 0.00359 | 0.07951 | -inf | inf | Ų |
| 5 | cosio | atom_site | Co2 | fract_x | 0.27930 | 0.00069 | -inf | inf | |
| 6 | cosio | atom_site | Co2 | fract_z | 0.98508 | 0.00144 | -inf | inf | |
| 7 | cosio | atom_site | Si | fract_x | 0.09360 | 0.00039 | -inf | inf | |
| 8 | cosio | atom_site | Si | fract_z | 0.42895 | 0.00083 | -inf | inf | |
| 9 | cosio | atom_site | Si | adp_iso | 0.00463 | 0.06225 | -inf | inf | Ų |
| 10 | cosio | atom_site | O1 | fract_x | 0.09112 | 0.00030 | -inf | inf | |
| 11 | cosio | atom_site | O1 | fract_z | 0.77140 | 0.00064 | -inf | inf | |
| 12 | cosio | atom_site | O1 | occupancy | 1.00000 | -inf | inf | ||
| 13 | cosio | atom_site | O2 | fract_x | 0.44824 | 0.00025 | -inf | inf | |
| 14 | cosio | atom_site | O2 | fract_z | 0.21683 | 0.00068 | -inf | inf | |
| 15 | cosio | atom_site | O2 | occupancy | 1.00000 | -inf | inf | ||
| 16 | cosio | atom_site | O3 | fract_x | 0.16358 | 0.00023 | -inf | inf | |
| 17 | cosio | atom_site | O3 | fract_y | 0.03165 | 0.00033 | -inf | inf | |
| 18 | cosio | atom_site | O3 | fract_z | 0.28013 | 0.00049 | -inf | inf | |
| 19 | cosio | atom_site | O3 | occupancy | 1.00000 | -inf | inf | ||
| 20 | cosio | atom_site_aniso | O1 | adp_11 | 0.00831 | -inf | inf | Ų | |
| 21 | cosio | atom_site_aniso | O1 | adp_22 | 0.00831 | -inf | inf | Ų | |
| 22 | cosio | atom_site_aniso | O1 | adp_33 | 0.00831 | -inf | inf | Ų | |
| 23 | cosio | atom_site_aniso | O1 | adp_13 | 0.00000 | -inf | inf | Ų | |
| 24 | cosio | atom_site_aniso | O2 | adp_11 | 0.00747 | -inf | inf | Ų | |
| 25 | cosio | atom_site_aniso | O2 | adp_22 | 0.00747 | -inf | inf | Ų | |
| 26 | cosio | atom_site_aniso | O2 | adp_33 | 0.00747 | -inf | inf | Ų | |
| 27 | cosio | atom_site_aniso | O2 | adp_13 | 0.00000 | -inf | inf | Ų | |
| 28 | cosio | atom_site_aniso | O3 | adp_11 | 0.01058 | -inf | inf | Ų | |
| 29 | cosio | atom_site_aniso | O3 | adp_22 | 0.01058 | -inf | inf | Ų | |
| 30 | cosio | atom_site_aniso | O3 | adp_33 | 0.01058 | -inf | inf | Ų | |
| 31 | cosio | atom_site_aniso | O3 | adp_12 | 0.00000 | -inf | inf | Ų | |
| 32 | cosio | atom_site_aniso | O3 | adp_13 | 0.00000 | -inf | inf | Ų | |
| 33 | cosio | atom_site_aniso | O3 | adp_23 | 0.00000 | -inf | inf | Ų | |
| 34 | d20 | linked_phases | cosio | scale | 1.19706 | 0.01058 | -inf | inf | |
| 35 | d20 | peak | asym_empir_2 | -0.00882 | 0.00193 | -inf | inf | ||
| 36 | d20 | peak | broad_gauss_u | 0.24345 | 0.00675 | -inf | inf | deg² | |
| 37 | d20 | peak | broad_gauss_v | -0.53160 | 0.01450 | -inf | inf | deg² | |
| 38 | d20 | peak | broad_gauss_w | 0.38630 | 0.00904 | -inf | inf | deg² | |
| 39 | d20 | peak | broad_lorentz_y | 0.01507 | 0.00443 | -inf | inf | deg | |
| 40 | d20 | instrument | twotheta_offset | 0.27658 | 0.00330 | -inf | inf | deg | |
| 41 | d20 | background | 1 | y | 608.66872 | 14.43393 | -inf | inf | |
| 42 | d20 | background | 2 | y | 580.65214 | 9.65593 | -inf | inf | |
| 43 | d20 | background | 3 | y | 562.92616 | 9.17384 | -inf | inf | |
| 44 | d20 | background | 4 | y | 540.30697 | 8.70473 | -inf | inf | |
| 45 | d20 | background | 5 | y | 519.87613 | 6.00484 | -inf | inf | |
| 46 | d20 | background | 6 | y | 507.36298 | 3.45877 | -inf | inf | |
| 47 | d20 | background | 7 | y | 463.29072 | 3.16643 | -inf | inf | |
| 48 | d20 | background | 8 | y | 434.20649 | 2.37275 | -inf | inf | |
| 49 | d20 | background | 9 | y | 450.88113 | 2.23420 | -inf | inf | |
| 50 | d20 | background | 10 | y | 430.42758 | 2.01023 | -inf | inf | |
| 51 | d20 | background | 11 | y | 413.91300 | 2.24310 | -inf | inf | |
| 52 | d20 | background | 12 | y | 361.40638 | 2.07632 | -inf | inf | |
| 53 | d20 | background | 13 | y | 291.19017 | 1.95181 | -inf | inf | |
| 54 | d20 | background | 14 | y | 238.92197 | 2.95161 | -inf | inf |
In [31]:
Copied!
project.analysis.fit()
project.analysis.fit()
Standard fitting
📋 Using experiment 🔬 'd20' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 4.54 | |
| 2 | 58 | 4.15 | 8.7% ↓ |
| 3 | 444 | 4.11 |
🏆 Best goodness-of-fit (reduced χ²) is 4.11 at iteration 443
✅ Fitting complete.
⚠️ Parameter 'cosio.atom_site_aniso.O1.adp_33' (-0.00334835) is below its physical lower limit (0.0).
In [32]:
Copied!
project.analysis.display.fit_results()
project.analysis.display.fit_results()
Fit results
✅ Success: True
⏱️ Fitting time: 32.39 seconds
📏 Goodness-of-fit (reduced χ²): 4.11
📏 R-factor (Rf): 2.91%
📏 R-factor squared (Rf²): 4.19%
📏 Weighted R-factor (wR): 4.42%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | cosio | cell | length_a | 10.3084 | 10.3082 | 0.0003 | Å | 0.00 % ↓ | |
| 2 | cosio | cell | length_b | 6.0036 | 6.0037 | 0.0002 | Å | 0.00 % ↑ | |
| 3 | cosio | cell | length_c | 4.7865 | 4.7864 | 0.0001 | Å | 0.00 % ↓ | |
| 4 | cosio | atom_site | Co1 | adp_iso | 0.0036 | 0.0091 | 0.0014 | Ų | 154.56 % ↑ |
| 5 | cosio | atom_site | Co2 | fract_x | 0.2793 | 0.2787 | 0.0007 | 0.21 % ↓ | |
| 6 | cosio | atom_site | Co2 | fract_z | 0.9851 | 0.9881 | 0.0015 | 0.30 % ↑ | |
| 7 | cosio | atom_site | Si | fract_x | 0.0936 | 0.0945 | 0.0004 | 0.94 % ↑ | |
| 8 | cosio | atom_site | Si | fract_z | 0.4289 | 0.4294 | 0.0008 | 0.11 % ↑ | |
| 9 | cosio | atom_site | Si | adp_iso | 0.0046 | 0.0077 | 0.0012 | Ų | 65.59 % ↑ |
| 10 | cosio | atom_site | O1 | fract_x | 0.0911 | 0.0905 | 0.0003 | 0.65 % ↓ | |
| 11 | cosio | atom_site | O1 | fract_z | 0.7714 | 0.7713 | 0.0006 | 0.02 % ↓ | |
| 12 | cosio | atom_site | O1 | occupancy | 1.0000 | 0.9142 | 0.0136 | 8.58 % ↓ | |
| 13 | cosio | atom_site | O2 | fract_x | 0.4482 | 0.4475 | 0.0003 | 0.17 % ↓ | |
| 14 | cosio | atom_site | O2 | fract_z | 0.2168 | 0.2170 | 0.0007 | 0.09 % ↑ | |
| 15 | cosio | atom_site | O2 | occupancy | 1.0000 | 0.9597 | 0.0133 | 4.03 % ↓ | |
| 16 | cosio | atom_site | O3 | fract_x | 0.1636 | 0.1631 | 0.0002 | 0.33 % ↓ | |
| 17 | cosio | atom_site | O3 | fract_y | 0.0317 | 0.0312 | 0.0003 | 1.57 % ↓ | |
| 18 | cosio | atom_site | O3 | fract_z | 0.2801 | 0.2816 | 0.0005 | 0.52 % ↑ | |
| 19 | cosio | atom_site | O3 | occupancy | 1.0000 | 0.9505 | 0.0116 | 4.95 % ↓ | |
| 20 | cosio | atom_site_aniso | O1 | adp_11 | 0.0083 | 0.0088 | 0.0017 | Ų | 6.18 % ↑ |
| 21 | cosio | atom_site_aniso | O1 | adp_22 | 0.0083 | 0.0070 | 0.0016 | Ų | 15.30 % ↓ |
| 22 | cosio | atom_site_aniso | O1 | adp_33 | 0.0083 | -0.0033 | 0.0021 | Ų | 140.27 % ↓ |
| 23 | cosio | atom_site_aniso | O1 | adp_13 | 0.0000 | 0.0053 | 0.0017 | Ų | N/A |
| 24 | cosio | atom_site_aniso | O2 | adp_11 | 0.0075 | 0.0053 | 0.0016 | Ų | 28.91 % ↓ |
| 25 | cosio | atom_site_aniso | O2 | adp_22 | 0.0075 | 0.0144 | 0.0016 | Ų | 93.17 % ↑ |
| 26 | cosio | atom_site_aniso | O2 | adp_33 | 0.0075 | 0.0028 | 0.0020 | Ų | 63.03 % ↓ |
| 27 | cosio | atom_site_aniso | O2 | adp_13 | 0.0000 | 0.0030 | 0.0013 | Ų | N/A |
| 28 | cosio | atom_site_aniso | O3 | adp_11 | 0.0106 | 0.0123 | 0.0013 | Ų | 16.63 % ↑ |
| 29 | cosio | atom_site_aniso | O3 | adp_22 | 0.0106 | 0.0068 | 0.0012 | Ų | 36.07 % ↓ |
| 30 | cosio | atom_site_aniso | O3 | adp_33 | 0.0106 | 0.0106 | 0.0014 | Ų | 0.43 % ↑ |
| 31 | cosio | atom_site_aniso | O3 | adp_12 | 0.0000 | 0.0008 | 0.0010 | Ų | N/A |
| 32 | cosio | atom_site_aniso | O3 | adp_13 | 0.0000 | 0.0014 | 0.0010 | Ų | N/A |
| 33 | cosio | atom_site_aniso | O3 | adp_23 | 0.0000 | -0.0041 | 0.0012 | Ų | N/A |
| 34 | d20 | linked_phases | cosio | scale | 1.1971 | 1.3271 | 0.0284 | 10.86 % ↑ | |
| 35 | d20 | peak | asym_empir_2 | -0.0088 | -0.0093 | 0.0019 | 5.16 % ↑ | ||
| 36 | d20 | peak | broad_gauss_u | 0.2434 | 0.2342 | 0.0065 | deg² | 3.78 % ↓ | |
| 37 | d20 | peak | broad_gauss_v | -0.5316 | -0.5110 | 0.0140 | deg² | 3.87 % ↓ | |
| 38 | d20 | peak | broad_gauss_w | 0.3863 | 0.3743 | 0.0087 | deg² | 3.11 % ↓ | |
| 39 | d20 | peak | broad_lorentz_y | 0.0151 | 0.0192 | 0.0043 | deg | 27.09 % ↑ | |
| 40 | d20 | instrument | twotheta_offset | 0.2766 | 0.2754 | 0.0032 | deg | 0.41 % ↓ | |
| 41 | d20 | background | 1 | y | 608.6687 | 608.4816 | 13.8046 | 0.03 % ↓ | |
| 42 | d20 | background | 2 | y | 580.6521 | 580.4996 | 9.2349 | 0.03 % ↓ | |
| 43 | d20 | background | 3 | y | 562.9262 | 562.7937 | 8.7739 | 0.02 % ↓ | |
| 44 | d20 | background | 4 | y | 540.3070 | 540.2054 | 8.3252 | 0.02 % ↓ | |
| 45 | d20 | background | 5 | y | 519.8761 | 519.7378 | 5.7433 | 0.03 % ↓ | |
| 46 | d20 | background | 6 | y | 507.3630 | 507.3920 | 3.3119 | 0.01 % ↑ | |
| 47 | d20 | background | 7 | y | 463.2907 | 462.3284 | 3.0496 | 0.21 % ↓ | |
| 48 | d20 | background | 8 | y | 434.2065 | 432.0829 | 2.3596 | 0.49 % ↓ | |
| 49 | d20 | background | 9 | y | 450.8811 | 451.2529 | 2.1642 | 0.08 % ↑ | |
| 50 | d20 | background | 10 | y | 430.4276 | 428.4964 | 1.9493 | 0.45 % ↓ | |
| 51 | d20 | background | 11 | y | 413.9130 | 410.1342 | 2.2316 | 0.91 % ↓ | |
| 52 | d20 | background | 12 | y | 361.4064 | 355.9475 | 2.1734 | 1.51 % ↓ | |
| 53 | d20 | background | 13 | y | 291.1902 | 292.3257 | 1.9417 | 0.39 % ↑ | |
| 54 | d20 | background | 14 | y | 238.9220 | 249.3180 | 3.0347 | 4.35 % ↑ |
⚠️ Red fitted value: outside expected physical limits (consider adding constraints)
⚠️ Red uncertainty: exceeds the fitted value (consider adding constraints)
In [33]:
Copied!
project.plotter.plot_param_correlations()
project.plotter.plot_param_correlations()
In [34]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', show_residual=True)
In [35]:
Copied!
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=42, x_max=52, show_residual=True)
project.plotter.plot_meas_vs_calc(expt_name='d20', x_min=42, x_max=52, show_residual=True)
In [36]:
Copied!
structure.show_as_cif()
structure.show_as_cif()
Structure 🧩 'cosio' as cif
| CIF | |
|---|---|
| 1 | data_cosio |
| 2 | |
| 3 | _cell.length_a 10.30818445(28090) |
| 4 | _cell.length_b 6.00366390(16124) |
| 5 | _cell.length_c 4.78642176(12809) |
| 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 "P n m a" |
| 11 | _space_group.IT_coordinate_system_code abc |
| 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.U_iso_or_equiv |
| 22 | _atom_site.adp_type |
| 23 | Co1 Co 0.00000000 0.00000000 0.00000000 a 1.00000000 0.00912929(141124) Uiso |
| 24 | Co2 Co 0.27871933(71268) 0.25000000 0.98807812(151327) c 1.00000000 0.00912929 Uiso |
| 25 | Si Si 0.09447953(39330) 0.25000000 0.42943797(80938) c 1.00000000 0.00766171(117633) Uiso |
| 26 | O1 O 0.09052637(30161) 0.25000000 0.77125812(61367) c 0.91421444(1359209) 0.00417369 Uani |
| 27 | O2 O 0.44746798(26342) 0.25000000 0.21702885(66468) c 0.95968887(1325764) 0.00750094 Uani |
| 28 | O3 O 0.16305125(22544) 0.03115682(33663) 0.28159153(48958) d 0.95053728(1161225) 0.00991363 Uani |
| 29 | |
| 30 | loop_ |
| 31 | _atom_site_aniso.label |
| 32 | _atom_site_aniso.U_11 |
| 33 | _atom_site_aniso.U_22 |
| 34 | _atom_site_aniso.U_33 |
| 35 | _atom_site_aniso.U_12 |
| 36 | _atom_site_aniso.U_13 |
| 37 | _atom_site_aniso.U_23 |
| 38 | Co1 ? ? ? ? ? ? |
| 39 | Co2 ? ? ? ? ? ? |
| 40 | Si ? ? ? ? ? ? |
| 41 | O1 0.00882757(166530) 0.00704186(160366) -0.00334835(207383) 0.00000000 0.00528321(173289) 0.00000000 |
| 42 | O2 0.00531076(158344) 0.01443034(163140) 0.00276172(195302) 0.00000000 0.00296717(130017) 0.00000000 |
| 43 | O3 0.01234440(131286) 0.00676666(115951) 0.01062983(136916) 0.00082005(95937) 0.00137755(104719) -0.00410052(122531) |
Summary¶
This final section shows how to review the results of the analysis.
Show Project Summary¶
In [37]:
Copied!
project.summary.show_report()
project.summary.show_report()
———————————— PROJECT INFO ————————————
Title
Untitled Project
————————————————————— CRYSTALLOGRAPHIC DATA —————————————————————
Phase datablock
🧩 cosio
Space group
P n m a
| Parameter | Value | Uncertainty | |
|---|---|---|---|
| 1 | a | 10.30818445 | 0.00028090 |
| 2 | b | 10.30818445 | 0.00028090 |
| 3 | c | 10.30818445 | 0.00028090 |
| 4 | α | 90.00000000 | |
| 5 | β | 90.00000000 | |
| 6 | γ | 90.00000000 |
Atom sites
| label | type | x | y | z | occ | Biso | |
|---|---|---|---|---|---|---|---|
| 1 | Co1 | Co | 0.00000000 | 0.00000000 | 0.00000000 | 1.00000000 | 0.00912929 |
| 2 | Co2 | Co | 0.27871933 | 0.25000000 | 0.98807812 | 1.00000000 | 0.00912929 |
| 3 | Si | Si | 0.09447953 | 0.25000000 | 0.42943797 | 1.00000000 | 0.00766171 |
| 4 | O1 | O | 0.09052637 | 0.25000000 | 0.77125812 | 0.91421444 | 0.00417369 |
| 5 | O2 | O | 0.44746798 | 0.25000000 | 0.21702885 | 0.95968887 | 0.00750094 |
| 6 | O3 | O | 0.16305125 | 0.03115682 | 0.28159153 | 0.95053728 | 0.00991363 |
——————————— EXPERIMENTS ———————————
Experiment datablock
🔬 d20
Experiment type
powder, neutron, constant wavelength bragg
Calculation engine
cryspy
Wavelength
1.87000
2θ offset
0.27544
Profile type
pseudo-voigt + empirical asymmetry
Peak broadening (Gaussian)
| Parameter | Value | Uncertainty | |
|---|---|---|---|
| 1 | U | 0.23424314 | 0.00646947 |
| 2 | V | -0.51103015 | 0.01397355 |
| 3 | W | 0.37428983 | 0.00872317 |
Peak broadening (Lorentzian)
| Parameter | Value | Uncertainty | |
|---|---|---|---|
| 1 | X | 0.00000000 | |
| 2 | Y | 0.01915666 | 0.00431367 |
Asymmetry (Empirical)
| Parameter | Value | Uncertainty | |
|---|---|---|---|
| 1 | p1 | 0.00000000 | |
| 2 | p2 | -0.00927290 | 0.00187080 |
| 3 | p3 | 0.00000000 | |
| 4 | p4 | 0.00000000 |
——————— FITTING ———————
Minimization engine
lmfit (leastsq)
Fit quality
| metric | value | |
|---|---|---|
| 1 | Goodness-of-fit (reduced χ²) | 4.11 |