{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:46.994062Z", "iopub.status.busy": "2026-08-18T18:26:46.993880Z", "iopub.status.idle": "2026-08-18T18:26:46.998189Z", "shell.execute_reply": "2026-08-18T18:26:46.997437Z" }, "tags": [ "hide-in-docs" ] }, "outputs": [], "source": [ "# Check whether easydiffraction is installed; install it if needed.\n", "# Required for remote environments such as Google Colab.\n", "import importlib.util\n", "\n", "if importlib.util.find_spec('easydiffraction') is None:\n", " %pip install easydiffraction==0.20.1" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "# Structure Refinement: LMO, ECHIDNA\n", "\n", "This example refines an LMO structure with Li/Ni site mixing against\n", "constant-wavelength neutron powder diffraction data collected on the\n", "ECHIDNA diffractometer at ANSTO. The workflow starts from approximate\n", "structural and profile parameters, constrains the coupled site\n", "occupancies, and performs a Rietveld refinement." ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## πŸ› οΈ Import Library" ] }, { "cell_type": "code", "execution_count": 2, "id": "3", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:46.999617Z", "iopub.status.busy": "2026-08-18T18:26:46.999422Z", "iopub.status.idle": "2026-08-18T18:26:49.772617Z", "shell.execute_reply": "2026-08-18T18:26:49.771888Z" } }, "outputs": [], "source": [ "import easydiffraction as edi" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "## πŸ“¦ Define Project\n", "\n", "The project manages the structure, experiment, analysis, and saved\n", "results used throughout the tutorial.\n", "\n", "### Create Project" ] }, { "cell_type": "code", "execution_count": 3, "id": "5", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:49.774962Z", "iopub.status.busy": "2026-08-18T18:26:49.774640Z", "iopub.status.idle": "2026-08-18T18:26:50.068800Z", "shell.execute_reply": "2026-08-18T18:26:50.067995Z" } }, "outputs": [], "source": [ "project = edi.Project(\n", " name='lmo_echidna',\n", " description='LMO refinement using ECHIDNA neutron powder diffraction data.',\n", ")" ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "### Save Initial Project\n", "\n", "Create the project directory before fitting so that analysis results\n", "can be written as they are produced." ] }, { "cell_type": "code", "execution_count": 4, "id": "7", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.071199Z", "iopub.status.busy": "2026-08-18T18:26:50.071004Z", "iopub.status.idle": "2026-08-18T18:26:50.124784Z", "shell.execute_reply": "2026-08-18T18:26:50.124044Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lmo_echidna'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lmo-echidna'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n", "β”œβ”€β”€ πŸ“ structures/\n", "β”œβ”€β”€ πŸ“ experiments/\n", "β”œβ”€β”€ πŸ“ analysis/\n", "β”‚ └── πŸ“„ analysis.edi\n", "└── πŸ“ reports/\n", " └── πŸ“„ lmo_echidna.html\n" ] } ], "source": [ "project.save_as(dir_path='projects/refine-lmo-echidna')" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "## 🧩 Define Structure\n", "\n", "The rhombohedral LMO model contains two crystallographic cation sites.\n", "Li1 and Ni1 share the site at z = 1/2, while Li2 and Ni2 share the site\n", "at z = 0. Their starting occupancies describe a small amount of Li/Ni\n", "site mixing.\n", "\n", "### Create Structure from CIF\n", "\n", "Define the complete starting structure in a compact inline CIF. The\n", "hexagonal setting of space group R-3m is used, with approximate cell\n", "dimensions and oxygen z coordinate." ] }, { "cell_type": "code", "execution_count": 5, "id": "9", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.126837Z", "iopub.status.busy": "2026-08-18T18:26:50.126658Z", "iopub.status.idle": "2026-08-18T18:26:50.129522Z", "shell.execute_reply": "2026-08-18T18:26:50.128839Z" } }, "outputs": [], "source": [ "structure_cif = \"\"\"\n", "data_lmo\n", "\n", "_cell.length_a 2.88\n", "_cell.length_b 2.88\n", "_cell.length_c 14.18\n", "_cell.angle_alpha 90.\n", "_cell.angle_beta 90.\n", "_cell.angle_gamma 120.\n", "\n", "_space_group.name_h_m \"R -3 m\"\n", "_space_group.coord_system_code h\n", "\n", "loop_\n", "_atom_site.id\n", "_atom_site.type_symbol\n", "_atom_site.fract_x\n", "_atom_site.fract_y\n", "_atom_site.fract_z\n", "_atom_site.occupancy\n", "_atom_site.adp_iso\n", "_atom_site.adp_type\n", "O O 0. 0. 0.26 1.0000 0.94645 Biso\n", "Ni1 Ni 0. 0. 0.5 0.0184 1.00000 Biso\n", "Li1 Li 0. 0. 0.5 0.9816 1.00000 Biso\n", "Li2 Li 0. 0. 0.0 0.0184 1.00000 Biso\n", "Ni2 Ni 0. 0. 0.0 0.9816 1.00000 Biso\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 6, "id": "10", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.131297Z", "iopub.status.busy": "2026-08-18T18:26:50.131126Z", "iopub.status.idle": "2026-08-18T18:26:50.140675Z", "shell.execute_reply": "2026-08-18T18:26:50.139843Z" } }, "outputs": [], "source": [ "project.structures.add_from_cif_str(structure_cif)" ] }, { "cell_type": "code", "execution_count": 7, "id": "11", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.142282Z", "iopub.status.busy": "2026-08-18T18:26:50.142091Z", "iopub.status.idle": "2026-08-18T18:26:50.146920Z", "shell.execute_reply": "2026-08-18T18:26:50.146159Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mDefined structures 🧩\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m[\u001b[0m\u001b[32m'lmo'\u001b[0m\u001b[1m]\u001b[0m\n" ] } ], "source": [ "project.structures.show_names()" ] }, { "cell_type": "markdown", "id": "12", "metadata": {}, "source": [ "Use a short alias to access the structure parameters below." ] }, { "cell_type": "code", "execution_count": 8, "id": "13", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.148667Z", "iopub.status.busy": "2026-08-18T18:26:50.148515Z", "iopub.status.idle": "2026-08-18T18:26:50.151231Z", "shell.execute_reply": "2026-08-18T18:26:50.150472Z" } }, "outputs": [], "source": [ "structure = project.structures['lmo']" ] }, { "cell_type": "markdown", "id": "14", "metadata": {}, "source": [ "### Display Structure\n", "\n", "Inspect the structure as text and as an interactive crystal model." ] }, { "cell_type": "code", "execution_count": 9, "id": "15", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.152708Z", "iopub.status.busy": "2026-08-18T18:26:50.152553Z", "iopub.status.idle": "2026-08-18T18:26:50.433398Z", "shell.execute_reply": "2026-08-18T18:26:50.432435Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lmo'\u001b[0m\u001b[1;36m as text\u001b[0m\n" ] }, { "data": { "text/html": [ "
Edi
1data_lmo
2
3_cell.length_a 2.88
4_cell.length_b 2.88
5_cell.length_c 14.18
6_cell.angle_alpha 90.
7_cell.angle_beta 90.
8_cell.angle_gamma 120.
9
10_space_group.name_h_m "R -3 m"
11_space_group.coord_system_code h
12
13_geom.min_bond_distance_cutoff 0.
14_geom.bond_distance_inc 0.25
15
16loop_
17_atom_site.id
18_atom_site.type_symbol
19_atom_site.fract_x
20_atom_site.fract_y
21_atom_site.fract_z
22_atom_site.wyckoff_letter
23_atom_site.multiplicity
24_atom_site.occupancy
25_atom_site.adp_iso
26_atom_site.adp_type
27O O 0. 0. 0.26 c 6 1. 0.94645 Biso
28Ni1 Ni 0. 0. 0.5 b 3 0.0184 1. Biso
29Li1 Li 0. 0. 0.5 b 3 0.9816 1. Biso
30Li2 Li 0. 0. 0. a 3 0.0184 1. Biso
31Ni2 Ni 0. 0. 0. a 3 0.9816 1. Biso
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure.show_as_text()" ] }, { "cell_type": "code", "execution_count": 10, "id": "16", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.434976Z", "iopub.status.busy": "2026-08-18T18:26:50.434793Z", "iopub.status.idle": "2026-08-18T18:26:50.463083Z", "shell.execute_reply": "2026-08-18T18:26:50.462170Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lmo'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'covalent'\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
\n", "
\n", "
Loading plot…
\n", "
\n", "
\n", "
\n", "
drag = rotate
wheel = zoom
right-drag = pan
\n", "
\n", "
\n", "\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.structure(struct_name='lmo')" ] }, { "cell_type": "markdown", "id": "17", "metadata": {}, "source": [ "## πŸ”¬ Define Experiment\n", "\n", "Load the measured pattern, choose the calculation engine, configure\n", "the instrument and peak profile, and link the structure to the data.\n", "\n", "### Download Data\n", "\n", "Download the LMO pattern from the EasyDiffraction online data\n", "repository. The columns contain 2-theta, intensity, and the standard\n", "uncertainty of the measured intensity." ] }, { "cell_type": "code", "execution_count": 11, "id": "18", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.465087Z", "iopub.status.busy": "2026-08-18T18:26:50.464917Z", "iopub.status.idle": "2026-08-18T18:26:50.667569Z", "shell.execute_reply": "2026-08-18T18:26:50.666688Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mGetting data\u001b[0m\u001b[1;36m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Data \u001b[32m'meas-lmo-echidna'\u001b[0m: LMO, ECHIDNA \u001b[1m(\u001b[0mANSTO\u001b[1m)\u001b[0m, wavelength \u001b[1;36m1.6215\u001b[0m A\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βœ… Data \u001b[32m'meas-lmo-echidna'\u001b[0m downloaded to \u001b[32m'../../../data/meas-lmo-echidna.dat'\u001b[0m\n" ] } ], "source": [ "data_path = edi.download_data('meas-lmo-echidna', destination='data')" ] }, { "cell_type": "markdown", "id": "19", "metadata": {}, "source": [ "### Create Experiment" ] }, { "cell_type": "code", "execution_count": 12, "id": "20", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:50.669311Z", "iopub.status.busy": "2026-08-18T18:26:50.669006Z", "iopub.status.idle": "2026-08-18T18:26:51.200904Z", "shell.execute_reply": "2026-08-18T18:26:51.200204Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mData loaded successfully\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Experiment πŸ”¬ \u001b[32m'echidna'\u001b[0m. Number of data points: \u001b[1;36m3200\u001b[0m.\n" ] } ], "source": [ "project.experiments.add_from_data_path(\n", " name='echidna',\n", " data_path=data_path,\n", " sample_form='powder',\n", " beam_mode='constant wavelength',\n", " radiation_probe='neutron',\n", ")" ] }, { "cell_type": "markdown", "id": "21", "metadata": {}, "source": [ "Use a short alias to access the experiment parameters below." ] }, { "cell_type": "code", "execution_count": 13, "id": "22", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.202766Z", "iopub.status.busy": "2026-08-18T18:26:51.202601Z", "iopub.status.idle": "2026-08-18T18:26:51.205149Z", "shell.execute_reply": "2026-08-18T18:26:51.204532Z" } }, "outputs": [], "source": [ "experiment = project.experiments['echidna']" ] }, { "cell_type": "markdown", "id": "23", "metadata": {}, "source": [ "### Select Calculator\n", "\n", "Use the CrysFML calculation engine for this refinement." ] }, { "cell_type": "code", "execution_count": 14, "id": "24", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.206860Z", "iopub.status.busy": "2026-08-18T18:26:51.206701Z", "iopub.status.idle": "2026-08-18T18:26:51.213276Z", "shell.execute_reply": "2026-08-18T18:26:51.212418Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCalculator types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1crysfmlCrysFML library for crystallographic calculations
2*cryspyCrysPy library for crystallographic calculations
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "experiment.calculator.show_supported()" ] }, { "cell_type": "code", "execution_count": 15, "id": "25", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.214717Z", "iopub.status.busy": "2026-08-18T18:26:51.214564Z", "iopub.status.idle": "2026-08-18T18:26:51.219520Z", "shell.execute_reply": "2026-08-18T18:26:51.218868Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'echidna'\u001b[0m\u001b[1;36m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "crysfml\n" ] } ], "source": [ "experiment.calculator.type = 'crysfml'" ] }, { "cell_type": "markdown", "id": "26", "metadata": {}, "source": [ "### Set Instrument\n", "\n", "Set the measured neutron wavelength and approximate calibration\n", "corrections for the 2-theta zero, sample displacement, and sample\n", "transparency." ] }, { "cell_type": "code", "execution_count": 16, "id": "27", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.221400Z", "iopub.status.busy": "2026-08-18T18:26:51.221219Z", "iopub.status.idle": "2026-08-18T18:26:51.224849Z", "shell.execute_reply": "2026-08-18T18:26:51.224108Z" } }, "outputs": [], "source": [ "experiment.instrument.setup_wavelength = 1.6215\n", "experiment.instrument.calib_twotheta_offset = 0.0\n", "experiment.instrument.calib_sample_displacement = 0.03\n", "experiment.instrument.calib_sample_transparency = 0.02" ] }, { "cell_type": "markdown", "id": "28", "metadata": {}, "source": [ "### Set Peak Profile\n", "\n", "Select the Thompson-Cox-Hastings pseudo-Voigt profile. U, V, and W\n", "define its Gaussian broadening; Y defines its Lorentzian broadening;\n", "and the Finger-Cox-Jephcoat terms describe the low-angle asymmetry." ] }, { "cell_type": "code", "execution_count": 17, "id": "29", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.226380Z", "iopub.status.busy": "2026-08-18T18:26:51.226215Z", "iopub.status.idle": "2026-08-18T18:26:51.232717Z", "shell.execute_reply": "2026-08-18T18:26:51.231864Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mPeak types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*pseudo-voigtCWL pseudo-Voigt profile
2thompson-cox-hastingsCWL Thompson-Cox-Hastings profile with FCJ asymmetry correction.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "experiment.peak.show_supported()" ] }, { "cell_type": "code", "execution_count": 18, "id": "30", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.234184Z", "iopub.status.busy": "2026-08-18T18:26:51.234030Z", "iopub.status.idle": "2026-08-18T18:26:51.240441Z", "shell.execute_reply": "2026-08-18T18:26:51.239834Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Switching peak profile type adds these settings with defaults: \n", " β€’ asym_fcj_1=0.0 \n", " β€’ asym_fcj_2=0.0 \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'echidna'\u001b[0m\u001b[1;36m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "thompson-cox-hastings\n" ] } ], "source": [ "experiment.peak.type = 'thompson-cox-hastings'" ] }, { "cell_type": "code", "execution_count": 19, "id": "31", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.242216Z", "iopub.status.busy": "2026-08-18T18:26:51.242062Z", "iopub.status.idle": "2026-08-18T18:26:51.245721Z", "shell.execute_reply": "2026-08-18T18:26:51.244950Z" } }, "outputs": [], "source": [ "experiment.peak.broad_gauss_u = 0.1\n", "experiment.peak.broad_gauss_v = -0.3\n", "experiment.peak.broad_gauss_w = 0.4\n", "experiment.peak.broad_lorentz_y = 0.1\n", "experiment.peak.asym_fcj_1 = 0.08\n", "experiment.peak.asym_fcj_2 = 0.08" ] }, { "cell_type": "markdown", "id": "32", "metadata": {}, "source": [ "### Set Absorption\n", "\n", "Apply the Hewat cylindrical-sample absorption correction with an\n", "approximate value of the dimensionless absorption-radius product." ] }, { "cell_type": "code", "execution_count": 20, "id": "33", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.247192Z", "iopub.status.busy": "2026-08-18T18:26:51.247022Z", "iopub.status.idle": "2026-08-18T18:26:51.252329Z", "shell.execute_reply": "2026-08-18T18:26:51.251485Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mAbsorption type changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "cylinder-hewat\n" ] } ], "source": [ "experiment.absorption.type = 'cylinder-hewat'\n", "experiment.absorption.mu_r = 0.3" ] }, { "cell_type": "markdown", "id": "34", "metadata": {}, "source": [ "### Set Excluded Regions\n", "\n", "Exclude the low- and high-angle regions outside the useful measured\n", "range from 12 to 162 degrees." ] }, { "cell_type": "code", "execution_count": 21, "id": "35", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.253907Z", "iopub.status.busy": "2026-08-18T18:26:51.253721Z", "iopub.status.idle": "2026-08-18T18:26:51.257624Z", "shell.execute_reply": "2026-08-18T18:26:51.256824Z" } }, "outputs": [], "source": [ "experiment.excluded_regions.create(id='1', start=0.0, end=12.0)\n", "experiment.excluded_regions.create(id='2', start=162.0, end=180.0)" ] }, { "cell_type": "markdown", "id": "36", "metadata": {}, "source": [ "### Set Background\n", "\n", "Estimate initial background points from the measured pattern." ] }, { "cell_type": "code", "execution_count": 22, "id": "37", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.259218Z", "iopub.status.busy": "2026-08-18T18:26:51.259047Z", "iopub.status.idle": "2026-08-18T18:26:51.266001Z", "shell.execute_reply": "2026-08-18T18:26:51.265254Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mBackground types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1chebyshevChebyshev polynomial background
2*line-segmentLinear interpolation between points
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "experiment.background.show_supported()" ] }, { "cell_type": "code", "execution_count": 23, "id": "38", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.267858Z", "iopub.status.busy": "2026-08-18T18:26:51.267666Z", "iopub.status.idle": "2026-08-18T18:26:51.294701Z", "shell.execute_reply": "2026-08-18T18:26:51.293897Z" } }, "outputs": [], "source": [ "experiment.background.auto_estimate()" ] }, { "cell_type": "code", "execution_count": 24, "id": "39", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.296915Z", "iopub.status.busy": "2026-08-18T18:26:51.296716Z", "iopub.status.idle": "2026-08-18T18:26:51.303880Z", "shell.execute_reply": "2026-08-18T18:26:51.303113Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mLine-segment background points\u001b[0m\n" ] }, { "data": { "text/html": [ "
PositionIntensity
112.02420558.74541
220.03970640.62497
332.05130497.74000
439.42070641.87000
558.71960553.94103
693.37010550.51000
7149.84400653.58448
8161.99680772.38099
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "experiment.background.show()" ] }, { "cell_type": "markdown", "id": "40", "metadata": {}, "source": [ "### Set Linked Structure\n", "\n", "Link the LMO model to the experiment and provide an initial estimate\n", "for its scale factor." ] }, { "cell_type": "code", "execution_count": 25, "id": "41", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.305487Z", "iopub.status.busy": "2026-08-18T18:26:51.305281Z", "iopub.status.idle": "2026-08-18T18:26:51.308835Z", "shell.execute_reply": "2026-08-18T18:26:51.308145Z" } }, "outputs": [], "source": [ "experiment.linked_structures.create(structure_id='lmo', scale=10.0)" ] }, { "cell_type": "markdown", "id": "42", "metadata": {}, "source": [ "### Inspect Experiment\n", "\n", "Display the configured experiment as text." ] }, { "cell_type": "code", "execution_count": 26, "id": "43", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.310631Z", "iopub.status.busy": "2026-08-18T18:26:51.310429Z", "iopub.status.idle": "2026-08-18T18:26:51.534636Z", "shell.execute_reply": "2026-08-18T18:26:51.533769Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mExperiment πŸ”¬ \u001b[0m\u001b[32m'echidna'\u001b[0m\u001b[1;36m as text\u001b[0m\n" ] }, { "data": { "text/html": [ "
Edi
1data_echidna
2
3_experiment_type.sample_form powder
4_experiment_type.beam_mode "constant wavelength"
5_experiment_type.radiation_probe neutron
6_experiment_type.scattering_type bragg
7
8_diffrn.ambient_temperature ?
9_diffrn.ambient_pressure ?
10_diffrn.ambient_magnetic_field ?
11_diffrn.ambient_electric_field ?
12
13_calculator.type crysfml
14
15_peak.asym_fcj_1 0.08
16_peak.asym_fcj_2 0.08
17_peak.broad_gauss_u 0.1
18_peak.broad_gauss_v -0.3
19_peak.broad_gauss_w 0.4
20_peak.broad_lorentz_x 0.
21_peak.broad_lorentz_y 0.1
22_peak.cutoff_fwhm 0.
23_peak.type cwl-thompson-cox-hastings
24
25_instrument.setup_wavelength 1.6215
26_instrument.setup_wavelength_2 0.
27_instrument.setup_wavelength_2_to_1_ratio 0.
28_instrument.calib_twotheta_offset 0.
29_instrument.calib_sample_displacement 0.03
30_instrument.calib_sample_transparency 0.02
31
32_absorption.type cylinder-hewat
33_absorption.mu_r 0.3
34
35loop_
36_linked_structure.structure_id
37_linked_structure.scale
38lmo 10.
39
40loop_
41_excluded_region.id
42_excluded_region.start
43_excluded_region.end
441 0. 12.
452 162. 180.
46
47_background.type line-segment
48
49loop_
50_background.id
51_background.position
52_background.intensity
531 12.0242 558.74540525
542 20.0397 640.62496987
553 32.0513 497.74
564 39.4207 641.87
575 58.7196 553.94102828
586 93.3701 550.51
597 149.844 653.58448376
608 161.9968 772.38098901
61
62loop_
63_data.two_theta
64_data.id
65_data.d_spacing
66_data.intensity_meas
67_data.intensity_meas_su
68_data.intensity_calc
69_data.intensity_bkg
70_data.calc_status
714.0138 1 0. 73.54 11.06927 0. 0. excl
724.0639 2 0. 76.08 11.30158 0. 0. excl
734.1139 3 0. 69.48 10.74801 0. 0. excl
744.164 4 0. 73.23 11.00793 0. 0. excl
754.2139 5 0. 87.95 12.11325 0. 0. excl
764.2638 6 0. 103.51 13.09452 0. 0. excl
774.3139 7 0. 134.34 14.94499 0. 0. excl
784.3639 8 0. 158.84 16.27419 0. 0. excl
794.4139 9 0. 157.33 16.2141 0. 0. excl
804.4639 10 0. 185.27 17.68956 0. 0. excl
81...
82163.4564 3191 0. 1063.71 69.45311 0. 0. excl
83163.5065 3192 0. 981.95 66.61054 0. 0. excl
84163.5566 3193 0. 959.97 65.18457 0. 0. excl
85163.6065 3194 0. 1116.65 71.63894 0. 0. excl
86163.6565 3195 0. 1014.94 67.92402 0. 0. excl
87163.7066 3196 0. 1106.06 70.89243 0. 0. excl
88163.7566 3197 0. 1219.54 75.04669 0. 0. excl
89163.8065 3198 0. 1272.44 76.11867 0. 0. excl
90163.8565 3199 0. 1239.6 75.53265 0. 0. excl
91163.9066 3200 0. 1262.89 76.04648 0. 0. excl
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "experiment.show_as_text()" ] }, { "cell_type": "markdown", "id": "44", "metadata": {}, "source": [ "## πŸš€ Perform Analysis\n", "\n", "Inspect the starting calculation, constrain the coupled site-mixing\n", "parameters, select the independent refinement parameters, and fit the\n", "model to the measured pattern.\n", "\n", "### Display Initial Pattern" ] }, { "cell_type": "code", "execution_count": 27, "id": "45", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.536384Z", "iopub.status.busy": "2026-08-18T18:26:51.536229Z", "iopub.status.idle": "2026-08-18T18:26:51.621911Z", "shell.execute_reply": "2026-08-18T18:26:51.621088Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='echidna')" ] }, { "cell_type": "markdown", "id": "46", "metadata": {}, "source": [ "### Set Constraints\n", "\n", "First create readable aliases for the displacement and occupancy\n", "parameters involved in the constraints." ] }, { "cell_type": "code", "execution_count": 28, "id": "47", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.626135Z", "iopub.status.busy": "2026-08-18T18:26:51.625960Z", "iopub.status.idle": "2026-08-18T18:26:51.631397Z", "shell.execute_reply": "2026-08-18T18:26:51.630727Z" } }, "outputs": [], "source": [ "project.analysis.aliases.create(\n", " id='biso_Li1',\n", " param=structure.atom_sites['Li1'].adp_iso,\n", ")\n", "project.analysis.aliases.create(\n", " id='biso_Li2',\n", " param=structure.atom_sites['Li2'].adp_iso,\n", ")\n", "project.analysis.aliases.create(\n", " id='biso_Ni1',\n", " param=structure.atom_sites['Ni1'].adp_iso,\n", ")\n", "project.analysis.aliases.create(\n", " id='biso_Ni2',\n", " param=structure.atom_sites['Ni2'].adp_iso,\n", ")\n", "\n", "project.analysis.aliases.create(\n", " id='occ_Li1',\n", " param=structure.atom_sites['Li1'].occupancy,\n", ")\n", "project.analysis.aliases.create(\n", " id='occ_Li2',\n", " param=structure.atom_sites['Li2'].occupancy,\n", ")\n", "project.analysis.aliases.create(\n", " id='occ_Ni1',\n", " param=structure.atom_sites['Ni1'].occupancy,\n", ")\n", "project.analysis.aliases.create(\n", " id='occ_Ni2',\n", " param=structure.atom_sites['Ni2'].occupancy,\n", ")" ] }, { "cell_type": "markdown", "id": "48", "metadata": {}, "source": [ "Atoms sharing a crystallographic site use the same Biso value. The\n", "occupancy constraints keep each shared site fully occupied and couple\n", "the same Li/Ni exchange fraction across both sites. Consequently,\n", "`occ_Li1` is the only independent occupancy parameter." ] }, { "cell_type": "code", "execution_count": 29, "id": "49", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.632956Z", "iopub.status.busy": "2026-08-18T18:26:51.632798Z", "iopub.status.idle": "2026-08-18T18:26:51.636700Z", "shell.execute_reply": "2026-08-18T18:26:51.635922Z" } }, "outputs": [], "source": [ "project.analysis.constraints.create(\n", " id='1',\n", " expression='biso_Ni1 = biso_Li1',\n", ")\n", "project.analysis.constraints.create(\n", " id='2',\n", " expression='biso_Li2 = biso_Ni2',\n", ")\n", "project.analysis.constraints.create(\n", " id='3',\n", " expression='occ_Ni1 = 1 - occ_Li1',\n", ")\n", "project.analysis.constraints.create(\n", " id='4',\n", " expression='occ_Li2 = 1 - occ_Li1',\n", ")\n", "project.analysis.constraints.create(\n", " id='5',\n", " expression='occ_Ni2 = occ_Li1',\n", ")" ] }, { "cell_type": "code", "execution_count": 30, "id": "50", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.638181Z", "iopub.status.busy": "2026-08-18T18:26:51.638026Z", "iopub.status.idle": "2026-08-18T18:26:51.645091Z", "shell.execute_reply": "2026-08-18T18:26:51.644287Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mUser defined constraints\u001b[0m\n" ] }, { "data": { "text/html": [ "
idexpression
11biso_Ni1 = biso_Li1
22biso_Li2 = biso_Ni2
33occ_Ni1 = 1 - occ_Li1
44occ_Li2 = 1 - occ_Li1
55occ_Ni2 = occ_Li1
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Constraints enabled: \u001b[3;92mTrue\u001b[0m\n" ] } ], "source": [ "project.analysis.constraints.show()" ] }, { "cell_type": "markdown", "id": "51", "metadata": {}, "source": [ "### Set Free Parameters\n", "\n", "Refine the two independent cell lengths, oxygen z coordinate, the two\n", "independent cation Biso values, and the independent Li occupancy." ] }, { "cell_type": "code", "execution_count": 31, "id": "52", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.646552Z", "iopub.status.busy": "2026-08-18T18:26:51.646365Z", "iopub.status.idle": "2026-08-18T18:26:51.649832Z", "shell.execute_reply": "2026-08-18T18:26:51.649160Z" } }, "outputs": [], "source": [ "structure.cell.length_a.free = True\n", "structure.cell.length_c.free = True\n", "\n", "structure.atom_sites['O'].fract_z.free = True\n", "structure.atom_sites['Li1'].adp_iso.free = True\n", "structure.atom_sites['Ni2'].adp_iso.free = True\n", "structure.atom_sites['Li1'].occupancy.free = True" ] }, { "cell_type": "markdown", "id": "53", "metadata": {}, "source": [ "Refine the scale, instrument calibration terms, U/V/W/Y profile terms,\n", "and active background-point intensities. The asymmetry and absorption\n", "parameters remain fixed at their approximate values." ] }, { "cell_type": "code", "execution_count": 32, "id": "54", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.651308Z", "iopub.status.busy": "2026-08-18T18:26:51.651140Z", "iopub.status.idle": "2026-08-18T18:26:51.655447Z", "shell.execute_reply": "2026-08-18T18:26:51.654724Z" } }, "outputs": [], "source": [ "experiment.linked_structures['lmo'].scale.free = True\n", "\n", "experiment.instrument.calib_twotheta_offset.free = True\n", "experiment.instrument.calib_sample_displacement.free = True\n", "experiment.instrument.calib_sample_transparency.free = True\n", "\n", "experiment.peak.broad_gauss_u.free = True\n", "experiment.peak.broad_gauss_v.free = True\n", "experiment.peak.broad_gauss_w.free = True\n", "experiment.peak.broad_lorentz_y.free = True\n", "\n", "for point in experiment.background:\n", " point.intensity.free = True" ] }, { "cell_type": "markdown", "id": "55", "metadata": {}, "source": [ "Display all parameters selected for refinement." ] }, { "cell_type": "code", "execution_count": 33, "id": "56", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.657117Z", "iopub.status.busy": "2026-08-18T18:26:51.656952Z", "iopub.status.idle": "2026-08-18T18:26:51.736261Z", "shell.execute_reply": "2026-08-18T18:26:51.735386Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lmocelllength_a2.88000-infinfΓ…
2lmocelllength_c14.18000-infinfΓ…
3lmoatom_siteOfract_z0.26000-infinf
4lmoatom_siteLi1occupancy0.98160-infinf
5lmoatom_siteLi1adp_iso1.00000-infinfΓ…Β²
6lmoatom_siteNi2adp_iso1.00000-infinfΓ…Β²
7echidnalinked_structurelmoscale10.00000-infinf
8echidnapeakbroad_gauss_u0.10000-infinfdegΒ²
9echidnapeakbroad_gauss_v-0.30000-infinfdegΒ²
10echidnapeakbroad_gauss_w0.40000-infinfdegΒ²
11echidnapeakbroad_lorentz_y0.10000-infinfdeg
12echidnainstrumenttwotheta_offset0.00000-infinfdeg
13echidnainstrumentsample_displacement0.03000-infinfdeg
14echidnainstrumentsample_transparency0.02000-infinfdeg
15echidnabackground1intensity558.74541-infinf
16echidnabackground2intensity640.62497-infinf
17echidnabackground3intensity497.74000-infinf
18echidnabackground4intensity641.87000-infinf
19echidnabackground5intensity553.94103-infinf
20echidnabackground6intensity550.51000-infinf
21echidnabackground7intensity653.58448-infinf
22echidnabackground8intensity772.38099-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "57", "metadata": {}, "source": [ "### Select Minimizer\n", "\n", "Use the Levenberg-Marquardt optimizer provided by Bumps." ] }, { "cell_type": "code", "execution_count": 34, "id": "58", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.738006Z", "iopub.status.busy": "2026-08-18T18:26:51.737779Z", "iopub.status.idle": "2026-08-18T18:26:51.746070Z", "shell.execute_reply": "2026-08-18T18:26:51.745185Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mMinimizer types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1bumpsBUMPS library using the default Levenberg-Marquardt method
2bumps (amoeba)BUMPS library with Nelder-Mead simplex method
3bumps (de)BUMPS library with differential evolution method
4bumps (dream)BUMPS library with DREAM Bayesian sampling
5bumps (lm)BUMPS library with Levenberg-Marquardt method
6dfolsDFO-LS library for derivative-free least-squares optimization
7emceeemcee affine-invariant ensemble Bayesian sampling
8lmfitLMFIT library using the default Levenberg-Marquardt method
9lmfit (least_squares)LMFIT library with SciPy's trust region reflective algorithm
10*lmfit (leastsq)LMFIT library with Levenberg-Marquardt least squares method
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.minimizer.show_supported()" ] }, { "cell_type": "code", "execution_count": 35, "id": "59", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.747750Z", "iopub.status.busy": "2026-08-18T18:26:51.747540Z", "iopub.status.idle": "2026-08-18T18:26:51.754204Z", "shell.execute_reply": "2026-08-18T18:26:51.753518Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCurrent minimizer changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "bumps \u001b[1m(\u001b[0mlm\u001b[1m)\u001b[0m\n" ] } ], "source": [ "project.analysis.minimizer.type = 'bumps (lm)'" ] }, { "cell_type": "markdown", "id": "60", "metadata": {}, "source": [ "### Fit Model" ] }, { "cell_type": "code", "execution_count": 36, "id": "61", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:26:51.755739Z", "iopub.status.busy": "2026-08-18T18:26:51.755559Z", "iopub.status.idle": "2026-08-18T18:28:21.628635Z", "shell.execute_reply": "2026-08-18T18:28:21.625854Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-3e7fca297e284a4b887370ae63119f2e-button');\n", " const status = document.getElementById('ed-fit-stop-3e7fca297e284a4b887370ae63119f2e-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'echidna'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'bumps \u001b[0m\u001b[32m(\u001b[0m\u001b[32mlm\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.2384.57
2245.0757.9831.4% ↓
3479.916.2289.3% ↓
47014.752.8953.5% ↓
59319.582.4415.5% ↓
611624.442.411.2% ↓
716234.192.41
820844.882.41
923253.222.41
1025560.962.41
1127867.792.41
1230273.112.41
1332889.802.41
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ† Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m2.41\u001b[0m at iteration \u001b[1;36m302\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βœ… Fitting complete.\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "markdown", "id": "62", "metadata": {}, "source": [ "### Inspect Results\n", "\n", "Review the fit statistics, refined parameters, and parameter\n", "correlations, then compare the refined calculation with the data." ] }, { "cell_type": "code", "execution_count": 37, "id": "63", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:21.630600Z", "iopub.status.busy": "2026-08-18T18:28:21.630405Z", "iopub.status.idle": "2026-08-18T18:28:21.946671Z", "shell.execute_reply": "2026-08-18T18:28:21.945843Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerbumps (lm)
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)89.80
4πŸ“ Goodness-of-fit (reduced χ²)2.41
5πŸ“ R-factor (Rf, %)3.94
6πŸ“ R-factor squared (RfΒ², %)4.50
7πŸ“ Weighted R-factor (wR, %)4.29
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lmocelllength_aΓ…2.88002.87520.00010.17 % ↓
2lmocelllength_cΓ…14.180014.18350.00040.02 % ↑
3lmoatom_siteOfract_z0.26000.25910.00010.36 % ↓
4lmoatom_siteLi1occupancy0.98160.98040.00180.12 % ↓
5lmoatom_siteLi1adp_isoΓ…Β²1.00001.95400.109395.40 % ↑
6lmoatom_siteNi2adp_isoΓ…Β²1.00000.22740.011877.26 % ↓
7echidnalinked_structurelmoscale10.000015.99900.084159.99 % ↑
8echidnapeakbroad_gauss_udegΒ²0.10000.09720.00232.84 % ↓
9echidnapeakbroad_gauss_vdegΒ²-0.3000-0.28420.00665.26 % ↓
10echidnapeakbroad_gauss_wdegΒ²0.40000.40360.00520.91 % ↑
11echidnapeakbroad_lorentz_ydeg0.10000.08060.002119.35 % ↓
12echidnainstrumenttwotheta_offsetdeg0.0000-0.06400.0072N/A
13echidnainstrumentsample_displacementdeg0.03000.02700.004210.07 % ↓
14echidnainstrumentsample_transparencydeg0.02000.01760.005412.24 % ↓
15echidnabackground1intensity558.7454548.67745.53051.80 % ↓
16echidnabackground2intensity640.6250564.87884.480411.82 % ↓
17echidnabackground3intensity497.7400528.52603.81356.19 % ↑
18echidnabackground4intensity641.8700584.04183.59679.01 % ↓
19echidnabackground5intensity553.9410568.58892.46462.64 % ↑
20echidnabackground6intensity550.5100574.22451.99364.31 % ↑
21echidnabackground7intensity653.5845644.23302.75901.43 % ↓
22echidnabackground8intensity772.3810631.47116.203718.24 % ↓
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
β€’ start = parameter value before refinement
β€’ value = refined value from least-squares minimization
β€’ s.u. = standard uncertainty (one sigma), from the covariance matrix
β€’ change = relative change from start, in %; ↑ = increase, ↓ = decrease
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.fit.results()" ] }, { "cell_type": "code", "execution_count": 38, "id": "64", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:21.948475Z", "iopub.status.busy": "2026-08-18T18:28:21.948270Z", "iopub.status.idle": "2026-08-18T18:28:21.972539Z", "shell.execute_reply": "2026-08-18T18:28:21.971749Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
Loading plot…
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.fit.correlations()" ] }, { "cell_type": "code", "execution_count": 39, "id": "65", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:21.974007Z", "iopub.status.busy": "2026-08-18T18:28:21.973841Z", "iopub.status.idle": "2026-08-18T18:28:22.087491Z", "shell.execute_reply": "2026-08-18T18:28:22.083210Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='echidna')" ] }, { "cell_type": "markdown", "id": "66", "metadata": {}, "source": [ "## πŸ’Ύ Save Project\n", "\n", "Save the refined parameters and analysis results in the project\n", "directory created near the beginning of the tutorial." ] }, { "cell_type": "code", "execution_count": 40, "id": "67", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:22.098570Z", "iopub.status.busy": "2026-08-18T18:28:22.098343Z", "iopub.status.idle": "2026-08-18T18:28:22.445248Z", "shell.execute_reply": "2026-08-18T18:28:22.444483Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lmo_echidna'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lmo-echidna'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n", "β”œβ”€β”€ πŸ“ structures/\n", "β”‚ └── πŸ“„ lmo.edi\n", "β”œβ”€β”€ πŸ“ experiments/\n", "β”‚ └── πŸ“„ echidna.edi\n", "β”œβ”€β”€ πŸ“ analysis/\n", "β”‚ └── πŸ“„ analysis.edi\n", "└── πŸ“ reports/\n", " └── πŸ“„ lmo_echidna.html\n" ] } ], "source": [ "project.save()" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.14.6" } }, "nbformat": 4, "nbformat_minor": 5 }