Structure Refinement: LBCO, HRPT¶
This example demonstrates how to use the EasyDiffraction API in a simplified, user-friendly manner that closely follows the GUI workflow for a Rietveld refinement of La0.5Ba0.5CoO3 crystal structure using constant wavelength neutron powder diffraction data from HRPT at PSI.
It is intended for users with minimal programming experience who want to learn how to perform standard crystal structure fitting using diffraction data. This script covers creating a project, adding crystal structures and experiments, performing analysis, and refining parameters.
Only a single import of easydiffraction is required, and all
operations are performed through high-level components of the
project object, such as project.structures,
project.experiments, and project.analysis. The project object is
the main container for all information.
Import Library¶
import easydiffraction as ed
Step 1: Create a Project¶
This section explains how to create a project and define its metadata.
Create Project¶
project = ed.Project(name='lbco_hrpt')
Set Project Metadata¶
project.info.title = 'La0.5Ba0.5CoO3 at HRPT@PSI'
project.info.description = """This project demonstrates a standard
refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type
structure, using neutron powder diffraction data collected in constant
wavelength mode at the HRPT diffractometer (PSI)."""
Show Project Metadata as CIF¶
project.info.show_as_cif()
Project 📦 'lbco_hrpt' info as CIF
| CIF | |
|---|---|
| 1 | _project.id lbco_hrpt |
| 2 | _project.title 'La0.5Ba0.5CoO3 at HRPT@PSI' |
| 3 | _project.description |
| 4 | ; |
| 5 | This project demonstrates a standard refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type structure, using neutron powder diffraction data collected in constant wavelength mode at the HRPT diffractometer (PSI). |
| 6 | ; |
| 7 | _project.created '31 Mar 2026 21:25:54' |
| 8 | _project.last_modified '31 Mar 2026 21:25:54' |
Save Project¶
When saving the project for the first time, you need to specify the directory path. In the example below, the project is saved to a temporary location defined by the system.
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
├── 📁 experiments/
├── 📄 analysis.cif
└── 📄 summary.cif
Set Up Data Plotter¶
Show supported plotting engines.
project.plotter.show_supported_engines()
Supported engines
| Engine | Description | |
|---|---|---|
| 1 | asciichartpy | Console ASCII line charts |
| 2 | plotly | Interactive browser-based graphing library |
Show current plotting configuration.
project.plotter.show_config()
Current plotter configuration
| Parameter | Value | |
|---|---|---|
| 1 | Plotting engine | plotly |
| 2 | x-axis limits | [-inf, inf] |
| 3 | Chart height | 25 |
Set plotting engine.
# Keep the auto-selected engine. Alternatively, you can uncomment the
# line below to explicitly set the engine to the required one.
# project.plotter.engine = 'plotly'
Step 2: Define Structure¶
This section shows how to add structures and modify their parameters.
Add Structure¶
project.structures.create(name='lbco')
Show Defined Structures¶
Show the names of the crystal structures added. These names are used
to access the structure using the syntax:
project.structures[name]. All structure parameters can be accessed
via the project object.
project.structures.show_names()
Defined structures 🧩
['lbco']
Set Space Group¶
Modify the default space group parameters.
project.structures['lbco'].space_group.name_h_m = 'P m -3 m'
project.structures['lbco'].space_group.it_coordinate_system_code = '1'
Set Unit Cell¶
Modify the default unit cell parameters.
project.structures['lbco'].cell.length_a = 3.88
Set Atom Sites¶
Add atom sites to the structure.
project.structures['lbco'].atom_sites.create(
label='La',
type_symbol='La',
fract_x=0,
fract_y=0,
fract_z=0,
wyckoff_letter='a',
b_iso=0.5,
occupancy=0.5,
)
project.structures['lbco'].atom_sites.create(
label='Ba',
type_symbol='Ba',
fract_x=0,
fract_y=0,
fract_z=0,
wyckoff_letter='a',
b_iso=0.5,
occupancy=0.5,
)
project.structures['lbco'].atom_sites.create(
label='Co',
type_symbol='Co',
fract_x=0.5,
fract_y=0.5,
fract_z=0.5,
wyckoff_letter='b',
b_iso=0.5,
)
project.structures['lbco'].atom_sites.create(
label='O',
type_symbol='O',
fract_x=0,
fract_y=0.5,
fract_z=0.5,
wyckoff_letter='c',
b_iso=0.5,
)
Show Structure as CIF¶
project.structures['lbco'].show_as_cif()
Structure 🧩 'lbco' as cif
| CIF | |
|---|---|
| 1 | data_lbco |
| 2 | |
| 3 | _cell.length_a 3.88000000 |
| 4 | _cell.length_b 3.88000000 |
| 5 | _cell.length_c 3.88000000 |
| 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 m -3 m" |
| 11 | _space_group.IT_coordinate_system_code 1 |
| 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 | La La 0.00000000 0.00000000 0.00000000 a 0.50000000 0.50000000 Biso |
| 24 | Ba Ba 0.00000000 0.00000000 0.00000000 a 0.50000000 0.50000000 Biso |
| 25 | Co Co 0.50000000 0.50000000 0.50000000 b 1.00000000 0.50000000 Biso |
| 26 | O O 0.00000000 0.50000000 0.50000000 c 1.00000000 0.50000000 Biso |
Show Structure Structure¶
project.structures['lbco'].show()
Structure 🧩 'lbco'
Not implemented yet.
Save Project State¶
Save the project state after adding the structure. This ensures that all changes are stored and can be accessed later. The project state is saved in the directory specified during project creation.
project.save()
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
├── 📄 analysis.cif
└── 📄 summary.cif
Step 3: Define Experiment¶
This section shows how to add experiments, configure their parameters, and link the structures defined in the previous step.
Download Measured Data¶
Download the data file from the EasyDiffraction repository on GitHub.
data_path = ed.download_data(id=3, destination='data')
Getting data...
Data #3: La0.5Ba0.5CoO3, HRPT (PSI), 300 K
✅ Data #3 already present at 'data/ed-3.xye'. Keeping existing file.
Add Diffraction Experiment¶
project.experiments.add_from_data_path(
name='hrpt',
data_path=data_path,
sample_form='powder',
beam_mode='constant wavelength',
radiation_probe='neutron',
)
Data loaded successfully
Experiment 🔬 'hrpt'. Number of data points: 3098.
Show Defined Experiments¶
project.experiments.show_names()
Defined experiments 🔬
['hrpt']
Show Measured Data¶
project.plot_meas(expt_name='hrpt')
Warning: No linked phases defined. Returning empty pattern.
Set Instrument¶
Modify the default instrument parameters.
project.experiments['hrpt'].instrument.setup_wavelength = 1.494
project.experiments['hrpt'].instrument.calib_twotheta_offset = 0.6
Set Peak Profile¶
Show supported peak profile types.
project.experiments['hrpt'].show_supported_peak_profile_types()
Supported types
| Type | Description | |
|---|---|---|
| 1 | pseudo-voigt | Pseudo-Voigt profile |
| 2 | split pseudo-voigt | Split pseudo-Voigt with empirical asymmetry correction |
| 3 | thompson-cox-hastings | Thompson-Cox-Hastings with FCJ asymmetry correction |
Show the current peak profile type.
project.experiments['hrpt'].show_current_peak_profile_type()
Current peak profile type
PeakProfileTypeEnum.PSEUDO_VOIGT
Select the desired peak profile type.
project.experiments['hrpt'].peak_profile_type = 'pseudo-voigt'
⚠️ Switching peak profile type discards existing peak parameters.
Peak profile type for experiment 'hrpt' changed to
pseudo-voigt
Modify default peak profile parameters.
project.experiments['hrpt'].peak.broad_gauss_u = 0.1
project.experiments['hrpt'].peak.broad_gauss_v = -0.1
project.experiments['hrpt'].peak.broad_gauss_w = 0.1
project.experiments['hrpt'].peak.broad_lorentz_x = 0
project.experiments['hrpt'].peak.broad_lorentz_y = 0.1
Set Background¶
Show supported background types.
project.experiments['hrpt'].show_supported_background_types()
Supported types
| Type | Description | |
|---|---|---|
| 1 | chebyshev | Chebyshev polynomial background |
| 2 | line-segment | Linear interpolation between points |
Show current background type.
project.experiments['hrpt'].show_current_background_type()
Current background type
BackgroundTypeEnum.LINE_SEGMENT
Select the desired background type.
project.experiments['hrpt'].background_type = 'line-segment'
Background type for experiment 'hrpt' already set to
line-segment
Add background points.
project.experiments['hrpt'].background.create(id='10', x=10, y=170)
project.experiments['hrpt'].background.create(id='30', x=30, y=170)
project.experiments['hrpt'].background.create(id='50', x=50, y=170)
project.experiments['hrpt'].background.create(id='110', x=110, y=170)
project.experiments['hrpt'].background.create(id='165', x=165, y=170)
Show current background points.
project.experiments['hrpt'].background.show()
Line-segment background points
| X | Intensity | |
|---|---|---|
| 1 | 10 | 170 |
| 2 | 30 | 170 |
| 3 | 50 | 170 |
| 4 | 110 | 170 |
| 5 | 165 | 170 |
Set Linked Phases¶
Link the structure defined in the previous step to the experiment.
project.experiments['hrpt'].linked_phases.create(id='lbco', scale=10.0)
Show Experiment as CIF¶
project.experiments['hrpt'].show_as_cif()
Experiment 🔬 'hrpt' as cif
| CIF | |
|---|---|
| 1 | data_hrpt |
| 2 | |
| 3 | _expt_type.sample_form powder |
| 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 | _peak.broad_gauss_u 0.10000000 |
| 14 | _peak.broad_gauss_v -0.10000000 |
| 15 | _peak.broad_gauss_w 0.10000000 |
| 16 | _peak.broad_lorentz_x 0.00000000 |
| 17 | _peak.broad_lorentz_y 0.10000000 |
| 18 | |
| 19 | _instr.wavelength 1.49400000 |
| 20 | _instr.2theta_offset 0.60000000 |
| 21 | |
| 22 | loop_ |
| 23 | _pd_phase_block.id |
| 24 | _pd_phase_block.scale |
| 25 | lbco 10.00000000 |
| 26 | |
| 27 | |
| 28 | |
| 29 | loop_ |
| 30 | _pd_proc.2theta_scan |
| 31 | _pd_data.point_id |
| 32 | _pd_proc.d_spacing |
| 33 | _pd_meas.intensity_total |
| 34 | _pd_meas.intensity_total_su |
| 35 | _pd_calc.intensity_total |
| 36 | _pd_calc.intensity_bkg |
| 37 | _pd_data.refinement_status |
| 38 | 10.00000000 1 8.57086379 167.00000000 12.60000000 172.32780248 170.00000000 incl |
| 39 | 10.05000000 2 8.52833125 157.00000000 12.50000000 172.30859914 170.00000000 incl |
| 40 | 10.10000000 3 8.48622036 187.00000000 13.30000000 172.28969336 170.00000000 incl |
| 41 | 10.15000000 4 8.44452490 197.00000000 14.00000000 172.27107915 170.00000000 incl |
| 42 | 10.20000000 5 8.40323875 164.00000000 12.50000000 172.25275064 170.00000000 incl |
| 43 | 10.25000000 6 8.36235592 171.00000000 13.00000000 172.23470212 170.00000000 incl |
| 44 | 10.30000000 7 8.32187055 190.00000000 13.40000000 172.21692803 170.00000000 incl |
| 45 | 10.35000000 8 8.28177687 182.00000000 13.50000000 172.19942295 170.00000000 incl |
| 46 | 10.40000000 9 8.24206922 166.00000000 12.60000000 172.18218159 170.00000000 incl |
| 47 | 10.45000000 10 8.20274208 203.00000000 14.30000000 172.16519880 170.00000000 incl |
| 48 | ... |
| 49 | 164.40000000 3089 0.75397591 202.00000000 18.50000000 172.60037118 170.00000000 incl |
| 50 | 164.45000000 3090 0.75393091 178.00000000 20.40000000 172.59695823 170.00000000 incl |
| 51 | 164.50000000 3091 0.75388607 153.00000000 18.00000000 172.59381336 170.00000000 incl |
| 52 | 164.55000000 3092 0.75384138 197.00000000 25.30000000 172.59093099 170.00000000 incl |
| 53 | 164.60000000 3093 0.75379684 153.00000000 20.70000000 172.58830579 170.00000000 incl |
| 54 | 164.65000000 3094 0.75375244 173.00000000 30.10000000 172.58593268 170.00000000 incl |
| 55 | 164.70000000 3095 0.75370819 187.00000000 27.90000000 172.58380680 170.00000000 incl |
| 56 | 164.75000000 3096 0.75366410 175.00000000 38.20000000 172.58192354 170.00000000 incl |
| 57 | 164.80000000 3097 0.75362015 168.00000000 30.90000000 172.58027848 170.00000000 incl |
| 58 | 164.85000000 3098 0.75357634 109.00000000 41.20000000 172.57886743 170.00000000 incl |
| 59 | |
| 60 | loop_ |
| 61 | _pd_background.id |
| 62 | _pd_background.line_segment_X |
| 63 | _pd_background.line_segment_intensity |
| 64 | 10 10.00000000 170.00000000 |
| 65 | 30 30.00000000 170.00000000 |
| 66 | 50 50.00000000 170.00000000 |
| 67 | 110 110.00000000 170.00000000 |
| 68 | 165 165.00000000 170.00000000 |
Save Project State¶
project.save()
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
project.experiments['hrpt'].show_supported_calculator_types()
Supported calculator types
| Type | Description | |
|---|---|---|
| 1 | cryspy | CrysPy library for crystallographic calculations |
Show current calculation engine for this experiment.
project.experiments['hrpt'].show_current_calculator_type()
Current calculator type
CalculatorEnum.CRYSPY
Select the desired calculation engine.
project.experiments['hrpt'].calculator_type = 'cryspy'
Calculator for experiment 'hrpt' changed to
cryspy
Show Calculated Data¶
project.plot_calc(expt_name='hrpt')
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Show Parameters¶
Show all parameters of the project.
# project.analysis.show_all_params()
Show all fittable parameters.
project.analysis.show_fittable_params()
Fittable parameters for all structures (🧩 data blocks)
| datablock | category | entry | parameter | value | uncertainty | units | free | |
|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.88000 | Å | False | ||
| 2 | lbco | cell | length_b | 3.88000 | Å | False | ||
| 3 | lbco | cell | length_c | 3.88000 | Å | False | ||
| 4 | lbco | cell | angle_alpha | 90.00000 | deg | False | ||
| 5 | lbco | cell | angle_beta | 90.00000 | deg | False | ||
| 6 | lbco | cell | angle_gamma | 90.00000 | deg | False | ||
| 7 | lbco | atom_site | La | fract_x | 0.00000 | False | ||
| 8 | lbco | atom_site | La | fract_y | 0.00000 | False | ||
| 9 | lbco | atom_site | La | fract_z | 0.00000 | False | ||
| 10 | lbco | atom_site | La | occupancy | 0.50000 | False | ||
| 11 | lbco | atom_site | La | b_iso | 0.50000 | Ų | False | |
| 12 | lbco | atom_site | Ba | fract_x | 0.00000 | False | ||
| 13 | lbco | atom_site | Ba | fract_y | 0.00000 | False | ||
| 14 | lbco | atom_site | Ba | fract_z | 0.00000 | False | ||
| 15 | lbco | atom_site | Ba | occupancy | 0.50000 | False | ||
| 16 | lbco | atom_site | Ba | b_iso | 0.50000 | Ų | False | |
| 17 | lbco | atom_site | Co | fract_x | 0.50000 | False | ||
| 18 | lbco | atom_site | Co | fract_y | 0.50000 | False | ||
| 19 | lbco | atom_site | Co | fract_z | 0.50000 | False | ||
| 20 | lbco | atom_site | Co | occupancy | 1.00000 | False | ||
| 21 | lbco | atom_site | Co | b_iso | 0.50000 | Ų | False | |
| 22 | lbco | atom_site | O | fract_x | 0.00000 | False | ||
| 23 | lbco | atom_site | O | fract_y | 0.50000 | False | ||
| 24 | lbco | atom_site | O | fract_z | 0.50000 | False | ||
| 25 | lbco | atom_site | O | occupancy | 1.00000 | False | ||
| 26 | lbco | atom_site | O | b_iso | 0.50000 | Ų | False |
Fittable parameters for all experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | units | free | |
|---|---|---|---|---|---|---|---|---|
| 1 | hrpt | linked_phases | lbco | scale | 10.00000 | False | ||
| 2 | hrpt | peak | broad_gauss_u | 0.10000 | deg² | False | ||
| 3 | hrpt | peak | broad_gauss_v | -0.10000 | deg² | False | ||
| 4 | hrpt | peak | broad_gauss_w | 0.10000 | deg² | False | ||
| 5 | hrpt | peak | broad_lorentz_x | 0.00000 | deg | False | ||
| 6 | hrpt | peak | broad_lorentz_y | 0.10000 | deg | False | ||
| 7 | hrpt | instrument | wavelength | 1.49400 | Å | False | ||
| 8 | hrpt | instrument | twotheta_offset | 0.60000 | deg | False | ||
| 9 | hrpt | background | 10 | y | 170.00000 | False | ||
| 10 | hrpt | background | 30 | y | 170.00000 | False | ||
| 11 | hrpt | background | 50 | y | 170.00000 | False | ||
| 12 | hrpt | background | 110 | y | 170.00000 | False | ||
| 13 | hrpt | background | 165 | y | 170.00000 | False |
Show only free parameters.
project.analysis.show_free_params()
⚠️ No free parameters found.
Show how to access parameters in the code.
# project.analysis.how_to_access_parameters()
Set Fit Mode¶
Show supported fit modes.
project.analysis.show_supported_fit_mode_types()
Supported types
| Type | Description | |
|---|---|---|
| 1 | default | Fit-mode category |
Show current fit mode.
project.analysis.show_current_fit_mode_type()
Current fit-mode type
default
Select desired fit mode.
project.analysis.fit_mode.mode = 'single'
Set Minimizer¶
Show supported fitting engines.
project.analysis.show_available_minimizers()
Supported types
| Type | Description | |
|---|---|---|
| 1 | dfols | DFO-LS derivative-free least-squares optimization |
| 2 | lmfit | LMFIT with Levenberg-Marquardt least squares |
Show current fitting engine.
project.analysis.show_current_minimizer()
Current minimizer
lmfit
Select desired fitting engine.
project.analysis.current_minimizer = 'lmfit'
Current minimizer changed to
lmfit
Perform Fit 1/5¶
Set structure parameters to be refined.
project.structures['lbco'].cell.length_a.free = True
Set experiment parameters to be refined.
project.experiments['hrpt'].linked_phases['lbco'].scale.free = True
project.experiments['hrpt'].instrument.calib_twotheta_offset.free = True
project.experiments['hrpt'].background['10'].y.free = True
project.experiments['hrpt'].background['30'].y.free = True
project.experiments['hrpt'].background['50'].y.free = True
project.experiments['hrpt'].background['110'].y.free = True
project.experiments['hrpt'].background['165'].y.free = True
Show free parameters after selection.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.88000 | -inf | inf | Å | ||
| 2 | hrpt | linked_phases | lbco | scale | 10.00000 | -inf | inf | ||
| 3 | hrpt | instrument | twotheta_offset | 0.60000 | -inf | inf | deg | ||
| 4 | hrpt | background | 10 | y | 170.00000 | -inf | inf | ||
| 5 | hrpt | background | 30 | y | 170.00000 | -inf | inf | ||
| 6 | hrpt | background | 50 | y | 170.00000 | -inf | inf | ||
| 7 | hrpt | background | 110 | y | 170.00000 | -inf | inf | ||
| 8 | hrpt | background | 165 | y | 170.00000 | -inf | inf |
Run Fitting¶
project.analysis.fit()
project.analysis.show_fit_results()
Using experiment 🔬 'hrpt' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 164.59 | |
| 2 | 12 | 33.43 | 79.7% ↓ |
| 3 | 21 | 13.22 | 60.4% ↓ |
| 4 | 30 | 5.78 | 56.3% ↓ |
| 5 | 39 | 3.15 | 45.6% ↓ |
| 6 | 77 | 3.14 |
🏆 Best goodness-of-fit (reduced χ²) is 3.14 at iteration 69
✅ Fitting complete.
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Fit results
✅ Success: True
⏱️ Fitting time: 4.12 seconds
📏 Goodness-of-fit (reduced χ²): 3.14
📏 R-factor (Rf): 8.42%
📏 R-factor squared (Rf²): 11.79%
📏 Weighted R-factor (wR): 11.62%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.8800 | 3.8910 | 0.0001 | Å | 0.28 % ↑ | |
| 2 | hrpt | linked_phases | lbco | scale | 10.0000 | 7.3409 | 0.0350 | 26.59 % ↓ | |
| 3 | hrpt | instrument | twotheta_offset | 0.6000 | 0.6243 | 0.0018 | deg | 4.05 % ↑ | |
| 4 | hrpt | background | 10 | y | 170.0000 | 167.7066 | 2.1300 | 1.35 % ↓ | |
| 5 | hrpt | background | 30 | y | 170.0000 | 166.0338 | 1.5404 | 2.33 % ↓ | |
| 6 | hrpt | background | 50 | y | 170.0000 | 169.9495 | 1.1025 | 0.03 % ↓ | |
| 7 | hrpt | background | 110 | y | 170.0000 | 170.0802 | 0.9788 | 0.05 % ↑ | |
| 8 | hrpt | background | 165 | y | 170.0000 | 179.6656 | 1.3289 | 5.69 % ↑ |
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Save Project State¶
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Perform Fit 2/5¶
Set more parameters to be refined.
project.experiments['hrpt'].peak.broad_gauss_u.free = True
project.experiments['hrpt'].peak.broad_gauss_v.free = True
project.experiments['hrpt'].peak.broad_gauss_w.free = True
project.experiments['hrpt'].peak.broad_lorentz_y.free = True
Show free parameters after selection.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.89099 | 0.00006 | -inf | inf | Å | |
| 2 | hrpt | linked_phases | lbco | scale | 7.34088 | 0.03496 | -inf | inf | |
| 3 | hrpt | peak | broad_gauss_u | 0.10000 | -inf | inf | deg² | ||
| 4 | hrpt | peak | broad_gauss_v | -0.10000 | -inf | inf | deg² | ||
| 5 | hrpt | peak | broad_gauss_w | 0.10000 | -inf | inf | deg² | ||
| 6 | hrpt | peak | broad_lorentz_y | 0.10000 | -inf | inf | deg | ||
| 7 | hrpt | instrument | twotheta_offset | 0.62432 | 0.00181 | -inf | inf | deg | |
| 8 | hrpt | background | 10 | y | 167.70662 | 2.13004 | -inf | inf | |
| 9 | hrpt | background | 30 | y | 166.03383 | 1.54041 | -inf | inf | |
| 10 | hrpt | background | 50 | y | 169.94949 | 1.10249 | -inf | inf | |
| 11 | hrpt | background | 110 | y | 170.08023 | 0.97879 | -inf | inf | |
| 12 | hrpt | background | 165 | y | 179.66557 | 1.32895 | -inf | inf |
Run Fitting¶
project.analysis.fit()
project.analysis.show_fit_results()
Using experiment 🔬 'hrpt' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 3.14 | |
| 2 | 16 | 2.85 | 9.1% ↓ |
| 3 | 69 | 2.85 |
🏆 Best goodness-of-fit (reduced χ²) is 2.85 at iteration 68
✅ Fitting complete.
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Fit results
✅ Success: True
⏱️ Fitting time: 2.96 seconds
📏 Goodness-of-fit (reduced χ²): 2.85
📏 R-factor (Rf): 8.30%
📏 R-factor squared (Rf²): 11.85%
📏 Weighted R-factor (wR): 11.91%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.8910 | 3.8909 | 0.0001 | Å | 0.00 % ↓ | |
| 2 | hrpt | linked_phases | lbco | scale | 7.3409 | 7.2120 | 0.0406 | 1.76 % ↓ | |
| 3 | hrpt | peak | broad_gauss_u | 0.1000 | 0.0803 | 0.0047 | deg² | 19.74 % ↓ | |
| 4 | hrpt | peak | broad_gauss_v | -0.1000 | -0.1029 | 0.0104 | deg² | 2.93 % ↑ | |
| 5 | hrpt | peak | broad_gauss_w | 0.1000 | 0.1077 | 0.0051 | deg² | 7.66 % ↑ | |
| 6 | hrpt | peak | broad_lorentz_y | 0.1000 | 0.0893 | 0.0032 | deg | 10.67 % ↓ | |
| 7 | hrpt | instrument | twotheta_offset | 0.6243 | 0.6231 | 0.0017 | deg | 0.19 % ↓ | |
| 8 | hrpt | background | 10 | y | 167.7066 | 167.5167 | 2.0311 | 0.11 % ↓ | |
| 9 | hrpt | background | 30 | y | 166.0338 | 166.7627 | 1.4794 | 0.44 % ↑ | |
| 10 | hrpt | background | 50 | y | 169.9495 | 170.8330 | 1.0808 | 0.52 % ↑ | |
| 11 | hrpt | background | 110 | y | 170.0802 | 172.2546 | 0.9660 | 1.28 % ↑ | |
| 12 | hrpt | background | 165 | y | 179.6656 | 180.6405 | 1.2737 | 0.54 % ↑ |
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Save Project State¶
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Perform Fit 3/5¶
Set more parameters to be refined.
project.structures['lbco'].atom_sites['La'].b_iso.free = True
project.structures['lbco'].atom_sites['Ba'].b_iso.free = True
project.structures['lbco'].atom_sites['Co'].b_iso.free = True
project.structures['lbco'].atom_sites['O'].b_iso.free = True
Show free parameters after selection.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.89091 | 0.00005 | -inf | inf | Å | |
| 2 | lbco | atom_site | La | b_iso | 0.50000 | -inf | inf | Ų | |
| 3 | lbco | atom_site | Ba | b_iso | 0.50000 | -inf | inf | Ų | |
| 4 | lbco | atom_site | Co | b_iso | 0.50000 | -inf | inf | Ų | |
| 5 | lbco | atom_site | O | b_iso | 0.50000 | -inf | inf | Ų | |
| 6 | hrpt | linked_phases | lbco | scale | 7.21199 | 0.04057 | -inf | inf | |
| 7 | hrpt | peak | broad_gauss_u | 0.08026 | 0.00472 | -inf | inf | deg² | |
| 8 | hrpt | peak | broad_gauss_v | -0.10293 | 0.01036 | -inf | inf | deg² | |
| 9 | hrpt | peak | broad_gauss_w | 0.10766 | 0.00515 | -inf | inf | deg² | |
| 10 | hrpt | peak | broad_lorentz_y | 0.08933 | 0.00320 | -inf | inf | deg | |
| 11 | hrpt | instrument | twotheta_offset | 0.62314 | 0.00167 | -inf | inf | deg | |
| 12 | hrpt | background | 10 | y | 167.51669 | 2.03112 | -inf | inf | |
| 13 | hrpt | background | 30 | y | 166.76268 | 1.47937 | -inf | inf | |
| 14 | hrpt | background | 50 | y | 170.83305 | 1.08080 | -inf | inf | |
| 15 | hrpt | background | 110 | y | 172.25458 | 0.96599 | -inf | inf | |
| 16 | hrpt | background | 165 | y | 180.64054 | 1.27368 | -inf | inf |
Run Fitting¶
project.analysis.fit()
project.analysis.show_fit_results()
Using experiment 🔬 'hrpt' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 2.85 | |
| 2 | 28 | 2.28 | 19.9% ↓ |
| 3 | 45 | 1.62 | 28.9% ↓ |
| 4 | 62 | 1.47 | 9.6% ↓ |
| 5 | 79 | 1.36 | 7.0% ↓ |
| 6 | 97 | 1.29 | 5.4% ↓ |
| 7 | 204 | 1.29 |
🏆 Best goodness-of-fit (reduced χ²) is 1.29 at iteration 187
✅ Fitting complete.
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Fit results
✅ Success: True
⏱️ Fitting time: 8.80 seconds
📏 Goodness-of-fit (reduced χ²): 1.29
📏 R-factor (Rf): 5.63%
📏 R-factor squared (Rf²): 5.27%
📏 Weighted R-factor (wR): 4.41%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.8909 | 3.8909 | 0.0000 | Å | 0.00 % ↓ | |
| 2 | lbco | atom_site | La | b_iso | 0.5000 | 0.5051 | 1216.7409 | Ų | 1.02 % ↑ |
| 3 | lbco | atom_site | Ba | b_iso | 0.5000 | 0.5048 | 1977.3028 | Ų | 0.96 % ↑ |
| 4 | lbco | atom_site | Co | b_iso | 0.5000 | 0.2371 | 0.0612 | Ų | 52.59 % ↓ |
| 5 | lbco | atom_site | O | b_iso | 0.5000 | 1.3935 | 0.0167 | Ų | 178.71 % ↑ |
| 6 | hrpt | linked_phases | lbco | scale | 7.2120 | 9.1350 | 0.0641 | 26.66 % ↑ | |
| 7 | hrpt | peak | broad_gauss_u | 0.0803 | 0.0816 | 0.0031 | deg² | 1.63 % ↑ | |
| 8 | hrpt | peak | broad_gauss_v | -0.1029 | -0.1159 | 0.0067 | deg² | 12.62 % ↑ | |
| 9 | hrpt | peak | broad_gauss_w | 0.1077 | 0.1204 | 0.0033 | deg² | 11.88 % ↑ | |
| 10 | hrpt | peak | broad_lorentz_y | 0.0893 | 0.0844 | 0.0021 | deg | 5.47 % ↓ | |
| 11 | hrpt | instrument | twotheta_offset | 0.6231 | 0.6226 | 0.0010 | deg | 0.09 % ↓ | |
| 12 | hrpt | background | 10 | y | 167.5167 | 168.5585 | 1.3671 | 0.62 % ↑ | |
| 13 | hrpt | background | 30 | y | 166.7627 | 164.3357 | 0.9992 | 1.46 % ↓ | |
| 14 | hrpt | background | 50 | y | 170.8330 | 166.8881 | 0.7388 | 2.31 % ↓ | |
| 15 | hrpt | background | 110 | y | 172.2546 | 175.4004 | 0.6571 | 1.83 % ↑ | |
| 16 | hrpt | background | 165 | y | 180.6405 | 174.2811 | 0.9113 | 3.52 % ↓ |
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Save Project State¶
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
project.analysis.aliases.create(
label='biso_La',
param_uid=project.structures['lbco'].atom_sites['La'].b_iso.uid,
)
project.analysis.aliases.create(
label='biso_Ba',
param_uid=project.structures['lbco'].atom_sites['Ba'].b_iso.uid,
)
Set constraints.
project.analysis.constraints.create(expression='biso_Ba = biso_La')
Show defined constraints.
project.analysis.show_constraints()
User defined constraints
| expression | |
|---|---|
| 1 | biso_Ba = biso_La |
Show free parameters before applying constraints.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.89087 | 0.00004 | -inf | inf | Å | |
| 2 | lbco | atom_site | La | b_iso | 0.50509 | 1216.74090 | -inf | inf | Ų |
| 3 | lbco | atom_site | Ba | b_iso | 0.50481 | 1977.30283 | -inf | inf | Ų |
| 4 | lbco | atom_site | Co | b_iso | 0.23707 | 0.06119 | -inf | inf | Ų |
| 5 | lbco | atom_site | O | b_iso | 1.39354 | 0.01668 | -inf | inf | Ų |
| 6 | hrpt | linked_phases | lbco | scale | 9.13503 | 0.06407 | -inf | inf | |
| 7 | hrpt | peak | broad_gauss_u | 0.08157 | 0.00314 | -inf | inf | deg² | |
| 8 | hrpt | peak | broad_gauss_v | -0.11592 | 0.00672 | -inf | inf | deg² | |
| 9 | hrpt | peak | broad_gauss_w | 0.12045 | 0.00328 | -inf | inf | deg² | |
| 10 | hrpt | peak | broad_lorentz_y | 0.08445 | 0.00215 | -inf | inf | deg | |
| 11 | hrpt | instrument | twotheta_offset | 0.62258 | 0.00104 | -inf | inf | deg | |
| 12 | hrpt | background | 10 | y | 168.55849 | 1.36709 | -inf | inf | |
| 13 | hrpt | background | 30 | y | 164.33571 | 0.99917 | -inf | inf | |
| 14 | hrpt | background | 50 | y | 166.88814 | 0.73884 | -inf | inf | |
| 15 | hrpt | background | 110 | y | 175.40040 | 0.65706 | -inf | inf | |
| 16 | hrpt | background | 165 | y | 174.28113 | 0.91128 | -inf | inf |
Apply constraints.
project.analysis.apply_constraints()
Show free parameters after applying constraints.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.89087 | 0.00004 | -inf | inf | Å | |
| 2 | lbco | atom_site | La | b_iso | 0.50509 | 1216.74090 | -inf | inf | Ų |
| 3 | lbco | atom_site | Co | b_iso | 0.23707 | 0.06119 | -inf | inf | Ų |
| 4 | lbco | atom_site | O | b_iso | 1.39354 | 0.01668 | -inf | inf | Ų |
| 5 | hrpt | linked_phases | lbco | scale | 9.13503 | 0.06407 | -inf | inf | |
| 6 | hrpt | peak | broad_gauss_u | 0.08157 | 0.00314 | -inf | inf | deg² | |
| 7 | hrpt | peak | broad_gauss_v | -0.11592 | 0.00672 | -inf | inf | deg² | |
| 8 | hrpt | peak | broad_gauss_w | 0.12045 | 0.00328 | -inf | inf | deg² | |
| 9 | hrpt | peak | broad_lorentz_y | 0.08445 | 0.00215 | -inf | inf | deg | |
| 10 | hrpt | instrument | twotheta_offset | 0.62258 | 0.00104 | -inf | inf | deg | |
| 11 | hrpt | background | 10 | y | 168.55849 | 1.36709 | -inf | inf | |
| 12 | hrpt | background | 30 | y | 164.33571 | 0.99917 | -inf | inf | |
| 13 | hrpt | background | 50 | y | 166.88814 | 0.73884 | -inf | inf | |
| 14 | hrpt | background | 110 | y | 175.40040 | 0.65706 | -inf | inf | |
| 15 | hrpt | background | 165 | y | 174.28113 | 0.91128 | -inf | inf |
Run Fitting¶
project.analysis.fit()
project.analysis.show_fit_results()
Using experiment 🔬 'hrpt' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 1.29 | |
| 2 | 20 | 1.29 |
🏆 Best goodness-of-fit (reduced χ²) is 1.29 at iteration 19
✅ Fitting complete.
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Fit results
✅ Success: True
⏱️ Fitting time: 0.96 seconds
📏 Goodness-of-fit (reduced χ²): 1.29
📏 R-factor (Rf): 5.63%
📏 R-factor squared (Rf²): 5.27%
📏 Weighted R-factor (wR): 4.41%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.8909 | 3.8909 | 0.0000 | Å | 0.00 % ↑ | |
| 2 | lbco | atom_site | La | b_iso | 0.5051 | 0.5051 | 0.0278 | Ų | 0.00 % ↓ |
| 3 | lbco | atom_site | Co | b_iso | 0.2371 | 0.2370 | 0.0564 | Ų | 0.03 % ↓ |
| 4 | lbco | atom_site | O | b_iso | 1.3935 | 1.3935 | 0.0160 | Ų | 0.00 % ↑ |
| 5 | hrpt | linked_phases | lbco | scale | 9.1350 | 9.1351 | 0.0538 | 0.00 % ↑ | |
| 6 | hrpt | peak | broad_gauss_u | 0.0816 | 0.0816 | 0.0031 | deg² | 0.00 % ↑ | |
| 7 | hrpt | peak | broad_gauss_v | -0.1159 | -0.1159 | 0.0066 | deg² | 0.00 % ↑ | |
| 8 | hrpt | peak | broad_gauss_w | 0.1204 | 0.1204 | 0.0032 | deg² | 0.00 % ↑ | |
| 9 | hrpt | peak | broad_lorentz_y | 0.0844 | 0.0844 | 0.0021 | deg | 0.00 % ↓ | |
| 10 | hrpt | instrument | twotheta_offset | 0.6226 | 0.6226 | 0.0010 | deg | 0.00 % ↑ | |
| 11 | hrpt | background | 10 | y | 168.5585 | 168.5585 | 1.3669 | 0.00 % ↓ | |
| 12 | hrpt | background | 30 | y | 164.3357 | 164.3357 | 0.9990 | 0.00 % ↓ | |
| 13 | hrpt | background | 50 | y | 166.8881 | 166.8881 | 0.7386 | 0.00 % ↓ | |
| 14 | hrpt | background | 110 | y | 175.4004 | 175.4006 | 0.6488 | 0.00 % ↑ | |
| 15 | hrpt | background | 165 | y | 174.2811 | 174.2812 | 0.8944 | 0.00 % ↑ |
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Save Project State¶
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
project.analysis.aliases.create(
label='occ_La',
param_uid=project.structures['lbco'].atom_sites['La'].occupancy.uid,
)
project.analysis.aliases.create(
label='occ_Ba',
param_uid=project.structures['lbco'].atom_sites['Ba'].occupancy.uid,
)
Set more constraints.
project.analysis.constraints.create(
expression='occ_Ba = 1 - occ_La',
)
Show defined constraints.
project.analysis.show_constraints()
User defined constraints
| expression | |
|---|---|
| 1 | biso_Ba = biso_La |
| 2 | occ_Ba = 1 - occ_La |
Apply constraints.
project.analysis.apply_constraints()
Set structure parameters to be refined.
project.structures['lbco'].atom_sites['La'].occupancy.free = True
Show free parameters after selection.
project.analysis.show_free_params()
Free parameters for both structures (🧩 data blocks) and experiments (🔬 data blocks)
| datablock | category | entry | parameter | value | uncertainty | min | max | units | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.89087 | 0.00004 | -inf | inf | Å | |
| 2 | lbco | atom_site | La | occupancy | 0.50000 | -inf | inf | ||
| 3 | lbco | atom_site | La | b_iso | 0.50508 | 0.02777 | -inf | inf | Ų |
| 4 | lbco | atom_site | Co | b_iso | 0.23699 | 0.05643 | -inf | inf | Ų |
| 5 | lbco | atom_site | O | b_iso | 1.39355 | 0.01599 | -inf | inf | Ų |
| 6 | hrpt | linked_phases | lbco | scale | 9.13509 | 0.05380 | -inf | inf | |
| 7 | hrpt | peak | broad_gauss_u | 0.08157 | 0.00310 | -inf | inf | deg² | |
| 8 | hrpt | peak | broad_gauss_v | -0.11593 | 0.00664 | -inf | inf | deg² | |
| 9 | hrpt | peak | broad_gauss_w | 0.12045 | 0.00325 | -inf | inf | deg² | |
| 10 | hrpt | peak | broad_lorentz_y | 0.08445 | 0.00214 | -inf | inf | deg | |
| 11 | hrpt | instrument | twotheta_offset | 0.62258 | 0.00103 | -inf | inf | deg | |
| 12 | hrpt | background | 10 | y | 168.55849 | 1.36685 | -inf | inf | |
| 13 | hrpt | background | 30 | y | 164.33569 | 0.99900 | -inf | inf | |
| 14 | hrpt | background | 50 | y | 166.88808 | 0.73857 | -inf | inf | |
| 15 | hrpt | background | 110 | y | 175.40056 | 0.64879 | -inf | inf | |
| 16 | hrpt | background | 165 | y | 174.28124 | 0.89439 | -inf | inf |
Run Fitting¶
project.analysis.fit()
project.analysis.show_fit_results()
Using experiment 🔬 'hrpt' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 1.29 | |
| 2 | 55 | 1.28 |
🏆 Best goodness-of-fit (reduced χ²) is 1.28 at iteration 54
✅ Fitting complete.
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Fit results
✅ Success: True
⏱️ Fitting time: 2.15 seconds
📏 Goodness-of-fit (reduced χ²): 1.28
📏 R-factor (Rf): 5.61%
📏 R-factor squared (Rf²): 5.25%
📏 Weighted R-factor (wR): 4.39%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | lbco | cell | length_a | 3.8909 | 3.8909 | 0.0000 | Å | 0.00 % ↑ | |
| 2 | lbco | atom_site | La | occupancy | 0.5000 | 0.5840 | 0.0203 | 16.81 % ↑ | |
| 3 | lbco | atom_site | La | b_iso | 0.5051 | 0.5983 | 0.0355 | Ų | 18.46 % ↑ |
| 4 | lbco | atom_site | Co | b_iso | 0.2370 | 0.1665 | 0.0580 | Ų | 29.74 % ↓ |
| 5 | lbco | atom_site | O | b_iso | 1.3935 | 1.3491 | 0.0192 | Ų | 3.19 % ↓ |
| 6 | hrpt | linked_phases | lbco | scale | 9.1351 | 8.9057 | 0.0761 | 2.51 % ↓ | |
| 7 | hrpt | peak | broad_gauss_u | 0.0816 | 0.0812 | 0.0031 | deg² | 0.43 % ↓ | |
| 8 | hrpt | peak | broad_gauss_v | -0.1159 | -0.1154 | 0.0066 | deg² | 0.48 % ↓ | |
| 9 | hrpt | peak | broad_gauss_w | 0.1204 | 0.1203 | 0.0032 | deg² | 0.14 % ↓ | |
| 10 | hrpt | peak | broad_lorentz_y | 0.0844 | 0.0846 | 0.0021 | deg | 0.18 % ↑ | |
| 11 | hrpt | instrument | twotheta_offset | 0.6226 | 0.6226 | 0.0010 | deg | 0.00 % ↑ | |
| 12 | hrpt | background | 10 | y | 168.5585 | 168.9780 | 1.3666 | 0.25 % ↑ | |
| 13 | hrpt | background | 30 | y | 164.3357 | 164.0535 | 0.9992 | 0.17 % ↓ | |
| 14 | hrpt | background | 50 | y | 166.8881 | 166.9125 | 0.7364 | 0.01 % ↑ | |
| 15 | hrpt | background | 110 | y | 175.4006 | 175.2699 | 0.6479 | 0.07 % ↓ | |
| 16 | hrpt | background | 165 | y | 174.2812 | 174.5580 | 0.8935 | 0.16 % ↑ |
Plot Measured vs Calculated¶
project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)
project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)
Save Project State¶
project.save_as(dir_path='lbco_hrpt', temporary=True)
Saving project 📦 'lbco_hrpt' to
/tmp/lbco_hrpt
├── 📄 project.cif
├── 📁 structures/
│ └── 📄 lbco.cif
├── 📁 experiments/
│ └── 📄 hrpt.cif
├── 📄 analysis.cif
└── 📄 summary.cif
Step 5: Summary¶
This final section shows how to review the results of the analysis.
Show Project Summary¶
project.summary.show_report()
———————————— PROJECT INFO ————————————
Title
La0.5Ba0.5CoO3 at HRPT@PSI
Description
This project demonstrates a standard refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type structure, using neutron powder diffraction data collected in constant wavelength mode at the HRPT diffractometer (PSI). ————————————————————— CRYSTALLOGRAPHIC DATA —————————————————————
Phase datablock
🧩 lbco
Space group
P m -3 m
Cell parameters
| Parameter | Value | |
|---|---|---|
| 1 | a | 3.89087 |
| 2 | b | 3.89087 |
| 3 | c | 3.89087 |
| 4 | alpha | 90.00000 |
| 5 | beta | 90.00000 |
| 6 | gamma | 90.00000 |
Atom sites
| label | type | x | y | z | occ | Biso | |
|---|---|---|---|---|---|---|---|
| 1 | La | La | 0.00000 | 0.00000 | 0.00000 | 0.58403 | 0.59832 |
| 2 | Ba | Ba | 0.00000 | 0.00000 | 0.00000 | 0.41597 | 0.59832 |
| 3 | Co | Co | 0.50000 | 0.50000 | 0.50000 | 1.00000 | 0.16651 |
| 4 | O | O | 0.00000 | 0.50000 | 0.50000 | 1.00000 | 1.34914 |
——————————— EXPERIMENTS ———————————
Experiment datablock
🔬 hrpt
Experiment type
powder, neutron, constant wavelength
Wavelength
1.49400
2θ offset
0.62261
Profile type
pseudo-voigt
Peak broadening (Gaussian)
| Parameter | Value | |
|---|---|---|
| 1 | U | 0.08122 |
| 2 | V | -0.11537 |
| 3 | W | 0.12028 |
Peak broadening (Lorentzian)
| Parameter | Value | |
|---|---|---|
| 1 | X | 0.00000 |
| 2 | Y | 0.08460 |
——————— FITTING ———————
Calculation engine
hrpt: cryspy
Minimization engine
lmfit
Fit quality
| metric | value | |
|---|---|---|
| 1 | Goodness-of-fit (reduced χ²) | 1.28 |