{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:33.818482Z",
"iopub.status.busy": "2026-08-18T18:18:33.818282Z",
"iopub.status.idle": "2026-08-18T18:18:33.822350Z",
"shell.execute_reply": "2026-08-18T18:18:33.821654Z"
},
"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: Tb2TiO7, HEiDi\n",
"\n",
"Crystal structure refinement of Tb2TiO7 using single crystal neutron\n",
"diffraction data from HEiDi at FRM II."
]
},
{
"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:18:33.824038Z",
"iopub.status.busy": "2026-08-18T18:18:33.823879Z",
"iopub.status.idle": "2026-08-18T18:18:36.509614Z",
"shell.execute_reply": "2026-08-18T18:18:36.508546Z"
}
},
"outputs": [],
"source": [
"import easydiffraction as edi"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## π¦ Define Project"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:36.511534Z",
"iopub.status.busy": "2026-08-18T18:18:36.511214Z",
"iopub.status.idle": "2026-08-18T18:18:36.844055Z",
"shell.execute_reply": "2026-08-18T18:18:36.843312Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project π¦ \u001b[0m\u001b[32m'tbti_heidi'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-tbti-heidi'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"βββ π project.edi\n",
"βββ π structures/\n",
"βββ π experiments/\n",
"βββ π analysis/\n",
"β βββ π analysis.edi\n",
"βββ π reports/\n",
" βββ π tbti_heidi.html\n"
]
}
],
"source": [
"# Create a minimal project with a short name\n",
"project = edi.Project(name='tbti_heidi')\n",
"project.metadata.title = 'Tb2Ti2O7 at HEiDi@FRMII'\n",
"project.metadata.description = \"\"\"This project demonstrates a standard\n",
"refinement of the crystal structure of Tb2Ti2O7 using single crystal \n",
"neutron diffraction data from HEiDi at FRM II.\"\"\"\n",
"\n",
"project.save_as(dir_path='projects/refine-tbti-heidi')"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"## π§© Define Structure"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:36.845978Z",
"iopub.status.busy": "2026-08-18T18:18:36.845807Z",
"iopub.status.idle": "2026-08-18T18:18:37.019381Z",
"shell.execute_reply": "2026-08-18T18:18:37.018473Z"
}
},
"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'struct-tbti'\u001b[0m: Tb2Ti2O7 \u001b[1m(\u001b[0mcrystal structure\u001b[1m)\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Data \u001b[32m'struct-tbti'\u001b[0m downloaded to \u001b[32m'../../../data/struct-tbti.cif'\u001b[0m\n"
]
}
],
"source": [
"# Download CIF file from repository\n",
"structure_path = edi.download_data('struct-tbti', destination='data')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "8",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.021159Z",
"iopub.status.busy": "2026-08-18T18:18:37.020887Z",
"iopub.status.idle": "2026-08-18T18:18:37.031574Z",
"shell.execute_reply": "2026-08-18T18:18:37.030704Z"
}
},
"outputs": [],
"source": [
"project.structures.add_from_cif_path(structure_path)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.033399Z",
"iopub.status.busy": "2026-08-18T18:18:37.033244Z",
"iopub.status.idle": "2026-08-18T18:18:37.037736Z",
"shell.execute_reply": "2026-08-18T18:18:37.036945Z"
}
},
"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'tbti'\u001b[0m\u001b[1m]\u001b[0m\n"
]
}
],
"source": [
"project.structures.show_names()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "10",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.039355Z",
"iopub.status.busy": "2026-08-18T18:18:37.039202Z",
"iopub.status.idle": "2026-08-18T18:18:37.041754Z",
"shell.execute_reply": "2026-08-18T18:18:37.041057Z"
}
},
"outputs": [],
"source": [
"structure = project.structures['tbti']"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.043421Z",
"iopub.status.busy": "2026-08-18T18:18:37.043268Z",
"iopub.status.idle": "2026-08-18T18:18:37.101976Z",
"shell.execute_reply": "2026-08-18T18:18:37.100891Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"
| Edi |
|---|
| 1 | data_tbti |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 10.13 |
|---|
| 4 | _cell.length_b 10.13 |
|---|
| 5 | _cell.length_c 10.13 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 90. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "F d -3 m" |
|---|
| 11 | _space_group.coord_system_code 2 |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 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 |
|---|
| 27 | Tb Tb 0.5 0.5 0.5 d 16 1. 0.530(20) Biso |
|---|
| 28 | Ti Ti 0. 0. 0. c 16 1. 0.480(30) Biso |
|---|
| 29 | O1 O 0.328040(90) 0.125 0.125 f 48 1.000(10) 0.450(20) Biso |
|---|
| 30 | O2 O 0.375 0.375 0.375 b 8 0.970(20) 0.230(40) Biso |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"structure.show_as_text()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "12",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.103575Z",
"iopub.status.busy": "2026-08-18T18:18:37.103382Z",
"iopub.status.idle": "2026-08-18T18:18:37.106926Z",
"shell.execute_reply": "2026-08-18T18:18:37.106155Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['Tb'].adp_type = 'Uiso'\n",
"structure.atom_sites['Ti'].adp_type = 'Uiso'\n",
"structure.atom_sites['O1'].adp_type = 'Uiso'\n",
"structure.atom_sites['O2'].adp_type = 'Uiso'"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.108440Z",
"iopub.status.busy": "2026-08-18T18:18:37.108286Z",
"iopub.status.idle": "2026-08-18T18:18:37.112027Z",
"shell.execute_reply": "2026-08-18T18:18:37.110966Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"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.wyckoff_letter\n",
"_atom_site.multiplicity\n",
"_atom_site.occupancy\n",
"_atom_site.adp_iso\n",
"_atom_site.adp_type\n",
"Tb Tb 0.5 0.5 0.5 d 16 1. 0.007(20) Uiso\n",
"Ti Ti 0. 0. 0. c 16 1. 0.006(30) Uiso\n",
"O1 O 0.328040(90) 0.125 0.125 f 48 1.000(10) 0.006(20) Uiso\n",
"O2 O 0.375 0.375 0.375 b 8 0.970(20) 0.003(40) Uiso\n"
]
}
],
"source": [
"print(structure.atom_sites.as_cif)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "14",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.113479Z",
"iopub.status.busy": "2026-08-18T18:18:37.113297Z",
"iopub.status.idle": "2026-08-18T18:18:37.116625Z",
"shell.execute_reply": "2026-08-18T18:18:37.115716Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['Tb'].adp_iso = 0.0\n",
"structure.atom_sites['Ti'].adp_iso = 0.0\n",
"structure.atom_sites['O1'].adp_iso = 0.0\n",
"structure.atom_sites['O2'].adp_iso = 0.0"
]
},
{
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"### Display Structure (ADP)\n",
"\n",
"Select the ADP atom view. With the starting isotropic displacements every\n",
"atom is drawn as a sphere; after the anisotropic refinement below, the same\n",
"view will draw probability ellipsoids for the anisotropic sites."
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "16",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.118131Z",
"iopub.status.busy": "2026-08-18T18:18:37.117972Z",
"iopub.status.idle": "2026-08-18T18:18:37.120759Z",
"shell.execute_reply": "2026-08-18T18:18:37.119963Z"
}
},
"outputs": [],
"source": [
"project.structure_style.atom_view = 'adp'"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "17",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.122343Z",
"iopub.status.busy": "2026-08-18T18:18:37.122133Z",
"iopub.status.idle": "2026-08-18T18:18:37.245156Z",
"shell.execute_reply": "2026-08-18T18:18:37.244236Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\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='tbti')"
]
},
{
"cell_type": "markdown",
"id": "18",
"metadata": {},
"source": [
"## π¬ Define Experiment"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "19",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.246936Z",
"iopub.status.busy": "2026-08-18T18:18:37.246743Z",
"iopub.status.idle": "2026-08-18T18:18:37.418341Z",
"shell.execute_reply": "2026-08-18T18:18:37.417444Z"
}
},
"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-tbti-heidi'\u001b[0m: Tb2Ti2O7, HEiDi \u001b[1m(\u001b[0mMLZ\u001b[1m)\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Data \u001b[32m'meas-tbti-heidi'\u001b[0m downloaded to \u001b[32m'../../../data/meas-tbti-heidi.xye'\u001b[0m\n"
]
}
],
"source": [
"# Download data file from repository\n",
"data_path = edi.download_data('meas-tbti-heidi', destination='data')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "20",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.420113Z",
"iopub.status.busy": "2026-08-18T18:18:37.419889Z",
"iopub.status.idle": "2026-08-18T18:18:37.529159Z",
"shell.execute_reply": "2026-08-18T18:18:37.528729Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mData loaded successfully\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Experiment π¬ \u001b[32m'heidi'\u001b[0m. Number of data points: \u001b[1;36m220\u001b[0m.\n"
]
}
],
"source": [
"project.experiments.add_from_data_path(\n",
" name='heidi',\n",
" data_path=data_path,\n",
" sample_form='single crystal',\n",
" beam_mode='constant wavelength',\n",
" radiation_probe='neutron',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "21",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.531979Z",
"iopub.status.busy": "2026-08-18T18:18:37.531814Z",
"iopub.status.idle": "2026-08-18T18:18:37.536578Z",
"shell.execute_reply": "2026-08-18T18:18:37.536169Z"
}
},
"outputs": [],
"source": [
"experiment = project.experiments['heidi']"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "22",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.540738Z",
"iopub.status.busy": "2026-08-18T18:18:37.540587Z",
"iopub.status.idle": "2026-08-18T18:18:37.543212Z",
"shell.execute_reply": "2026-08-18T18:18:37.542637Z"
}
},
"outputs": [],
"source": [
"experiment.linked_structure.structure_id = 'tbti'\n",
"experiment.linked_structure.scale = 1.0"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "23",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.544497Z",
"iopub.status.busy": "2026-08-18T18:18:37.544330Z",
"iopub.status.idle": "2026-08-18T18:18:37.546925Z",
"shell.execute_reply": "2026-08-18T18:18:37.546289Z"
}
},
"outputs": [],
"source": [
"experiment.instrument.setup_wavelength = 0.793"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "24",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.548337Z",
"iopub.status.busy": "2026-08-18T18:18:37.548179Z",
"iopub.status.idle": "2026-08-18T18:18:37.551126Z",
"shell.execute_reply": "2026-08-18T18:18:37.550303Z"
}
},
"outputs": [],
"source": [
"experiment.extinction.mosaicity = 35000\n",
"experiment.extinction.radius = 10"
]
},
{
"cell_type": "markdown",
"id": "25",
"metadata": {},
"source": [
"## π Perform Analysis"
]
},
{
"cell_type": "markdown",
"id": "26",
"metadata": {},
"source": [
"### ADP iso"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "27",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.552992Z",
"iopub.status.busy": "2026-08-18T18:18:37.552847Z",
"iopub.status.idle": "2026-08-18T18:18:37.846651Z",
"shell.execute_reply": "2026-08-18T18:18:37.845844Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='heidi')"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "28",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.848186Z",
"iopub.status.busy": "2026-08-18T18:18:37.848022Z",
"iopub.status.idle": "2026-08-18T18:18:37.851794Z",
"shell.execute_reply": "2026-08-18T18:18:37.850950Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['O1'].fract_x.free = True\n",
"\n",
"structure.atom_sites['Ti'].occupancy.free = True\n",
"structure.atom_sites['O1'].occupancy.free = True\n",
"structure.atom_sites['O2'].occupancy.free = True\n",
"\n",
"structure.atom_sites['Tb'].adp_iso.free = True\n",
"structure.atom_sites['Ti'].adp_iso.free = True\n",
"structure.atom_sites['O1'].adp_iso.free = True\n",
"structure.atom_sites['O2'].adp_iso.free = True"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "29",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.853244Z",
"iopub.status.busy": "2026-08-18T18:18:37.853087Z",
"iopub.status.idle": "2026-08-18T18:18:37.855802Z",
"shell.execute_reply": "2026-08-18T18:18:37.855137Z"
}
},
"outputs": [],
"source": [
"experiment.linked_structure.scale.free = True\n",
"experiment.extinction.radius.free = True"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "30",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:37.857765Z",
"iopub.status.busy": "2026-08-18T18:18:37.857604Z",
"iopub.status.idle": "2026-08-18T18:18:38.718233Z",
"shell.execute_reply": "2026-08-18T18:18:38.717331Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-709bd9dfbdda4daf9dd6c1c76a82ed3b-button');\n",
" const status = document.getElementById('ed-fit-stop-709bd9dfbdda4daf9dd6c1c76a82ed3b-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'heidi'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\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": [
" | iteration | time (s) | ΟΒ² | change / status |
|---|
| 1 | 1 | 0.01 | 355.79 | |
|---|
| 2 | 14 | 0.13 | 186.41 | 47.6% β |
|---|
| 3 | 25 | 0.23 | 42.28 | 77.3% β |
|---|
| 4 | 36 | 0.34 | 12.97 | 69.3% β |
|---|
| 5 | 47 | 0.44 | 12.75 | 1.6% β |
|---|
| 6 | 81 | 0.76 | 12.75 | |
|---|
"
],
"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;36m12.75\u001b[0m at iteration \u001b[1;36m80\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Fitting complete.\n"
]
}
],
"source": [
"# Start refinement. All parameters, which have standard uncertainties\n",
"# in the input CIF files, are refined by default.\n",
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "31",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:38.719927Z",
"iopub.status.busy": "2026-08-18T18:18:38.719735Z",
"iopub.status.idle": "2026-08-18T18:18:39.069172Z",
"shell.execute_reply": "2026-08-18T18:18:39.068502Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"βοΈ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | π§ͺ Minimizer | lmfit (leastsq) |
|---|
| 2 | β
Overall status | success |
|---|
| 3 | β±οΈ Fitting time (seconds) | 0.76 |
|---|
| 4 | π Iterations | 78 |
|---|
| 5 | π Goodness-of-fit (reduced ΟΒ²) | 12.75 |
|---|
| 6 | π R-factor (Rf, %) | 7.65 |
|---|
| 7 | π R-factor squared (RfΒ², %) | 8.10 |
|---|
| 8 | π Weighted R-factor (wR, %) | 8.59 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | tbti | atom_site | Tb | adp_iso | Γ
Β² | 0.0000 | 0.0068 | 0.0003 | N/A |
|---|
| 2 | tbti | atom_site | Ti | occupancy | | 1.0000 | 0.9730 | 0.0178 | 2.70 % β |
|---|
| 3 | tbti | atom_site | Ti | adp_iso | Γ
Β² | 0.0000 | 0.0054 | 0.0006 | N/A |
|---|
| 4 | tbti | atom_site | O1 | fract_x | | 0.3280 | 0.3280 | 0.0001 | 0.00 % β |
|---|
| 5 | tbti | atom_site | O1 | occupancy | | 1.0000 | 0.9989 | 0.0104 | 0.11 % β |
|---|
| 6 | tbti | atom_site | O1 | adp_iso | Γ
Β² | 0.0000 | 0.0057 | 0.0002 | N/A |
|---|
| 7 | tbti | atom_site | O2 | occupancy | | 0.9700 | 0.9688 | 0.0183 | 0.12 % β |
|---|
| 8 | tbti | atom_site | O2 | adp_iso | Γ
Β² | 0.0000 | 0.0030 | 0.0005 | N/A |
|---|
| 9 | heidi | extinction | | radius | ΞΌm | 10.0000 | 26.4348 | 1.0122 | 164.35 % β |
|---|
| 10 | heidi | linked_structure | | scale | | 1.0000 | 2.9329 | 0.0586 | 193.29 % β |
|---|
"
],
"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": [
"# Show fit results summary\n",
"project.display.fit.results()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "32",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.071155Z",
"iopub.status.busy": "2026-08-18T18:18:39.070978Z",
"iopub.status.idle": "2026-08-18T18:18:39.078429Z",
"shell.execute_reply": "2026-08-18T18:18:39.077661Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Edi |
|---|
| 1 | data_tbti |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 10.13 |
|---|
| 4 | _cell.length_b 10.13 |
|---|
| 5 | _cell.length_c 10.13 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 90. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "F d -3 m" |
|---|
| 11 | _space_group.coord_system_code 2 |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 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 |
|---|
| 27 | Tb Tb 0.5 0.5 0.5 d 16 1. 0.00682(29) Uiso |
|---|
| 28 | Ti Ti 0. 0. 0. c 16 0.973(18) 0.00540(60) Uiso |
|---|
| 29 | O1 O 0.328044(94) 0.125 0.125 f 48 0.999(10) 0.00573(25) Uiso |
|---|
| 30 | O2 O 0.375 0.375 0.375 b 8 0.969(18) 0.00303(48) Uiso |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"structure.show_as_text()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "33",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.079912Z",
"iopub.status.busy": "2026-08-18T18:18:39.079727Z",
"iopub.status.idle": "2026-08-18T18:18:39.138147Z",
"shell.execute_reply": "2026-08-18T18:18:39.137517Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\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='tbti')"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "34",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.140269Z",
"iopub.status.busy": "2026-08-18T18:18:39.140066Z",
"iopub.status.idle": "2026-08-18T18:18:39.144691Z",
"shell.execute_reply": "2026-08-18T18:18:39.144082Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mDefined experiments π¬\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1m[\u001b[0m\u001b[32m'heidi'\u001b[0m\u001b[1m]\u001b[0m\n"
]
}
],
"source": [
"project.experiments.show_names()"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "35",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.146431Z",
"iopub.status.busy": "2026-08-18T18:18:39.146258Z",
"iopub.status.idle": "2026-08-18T18:18:39.161659Z",
"shell.execute_reply": "2026-08-18T18:18:39.160864Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='heidi')"
]
},
{
"cell_type": "markdown",
"id": "36",
"metadata": {},
"source": [
"### ADP aniso"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "37",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.163166Z",
"iopub.status.busy": "2026-08-18T18:18:39.163001Z",
"iopub.status.idle": "2026-08-18T18:18:39.168336Z",
"shell.execute_reply": "2026-08-18T18:18:39.167278Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['Tb'].adp_type = 'Uani'\n",
"structure.atom_sites['Ti'].adp_type = 'Uani'\n",
"structure.atom_sites['O1'].adp_type = 'Uani'\n",
"# structure.atom_sites['O2'].adp_type = 'Uani'"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "38",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.169865Z",
"iopub.status.busy": "2026-08-18T18:18:39.169687Z",
"iopub.status.idle": "2026-08-18T18:18:39.172906Z",
"shell.execute_reply": "2026-08-18T18:18:39.172205Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"loop_\n",
"_atom_site_aniso.id\n",
"_atom_site_aniso.adp_11\n",
"_atom_site_aniso.adp_22\n",
"_atom_site_aniso.adp_33\n",
"_atom_site_aniso.adp_12\n",
"_atom_site_aniso.adp_13\n",
"_atom_site_aniso.adp_23\n",
"Tb 0.00681683 0.00681683 0.00681683 0. 0. 0.\n",
"Ti 0.00539742 0.00539742 0.00539742 0. 0. 0.\n",
"O1 0.00572628 0.00572628 0.00572628 0. 0. 0.\n"
]
}
],
"source": [
"print(structure.atom_site_aniso.as_cif)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "39",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.174490Z",
"iopub.status.busy": "2026-08-18T18:18:39.174312Z",
"iopub.status.idle": "2026-08-18T18:18:39.177691Z",
"shell.execute_reply": "2026-08-18T18:18:39.177005Z"
}
},
"outputs": [],
"source": [
"structure.atom_site_aniso['Tb'].adp_11.free = True\n",
"structure.atom_site_aniso['Tb'].adp_12.free = True\n",
"structure.atom_site_aniso['Ti'].adp_11.free = True\n",
"structure.atom_site_aniso['Ti'].adp_12.free = True\n",
"structure.atom_site_aniso['O1'].adp_11.free = True\n",
"structure.atom_site_aniso['O1'].adp_22.free = True\n",
"structure.atom_site_aniso['O1'].adp_23.free = True\n",
"# structure.atom_site_aniso['O2'].adp_11.free = True"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "40",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:39.179334Z",
"iopub.status.busy": "2026-08-18T18:18:39.179174Z",
"iopub.status.idle": "2026-08-18T18:18:41.798667Z",
"shell.execute_reply": "2026-08-18T18:18:41.797810Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-7c94bcae6830495cb6f50c58ae7abcbb-button');\n",
" const status = document.getElementById('ed-fit-stop-7c94bcae6830495cb6f50c58ae7abcbb-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'heidi'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\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": [
" | iteration | time (s) | ΟΒ² | change / status |
|---|
| 1 | 1 | 0.28 | 13.00 | |
|---|
| 2 | 18 | 0.76 | 3.02 | 76.8% β |
|---|
| 3 | 33 | 1.19 | 2.94 | 2.5% β |
|---|
| 4 | 79 | 2.53 | 2.94 | |
|---|
"
],
"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.94\u001b[0m at iteration \u001b[1;36m78\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "41",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:41.800601Z",
"iopub.status.busy": "2026-08-18T18:18:41.800359Z",
"iopub.status.idle": "2026-08-18T18:18:42.192184Z",
"shell.execute_reply": "2026-08-18T18:18:42.191445Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"βοΈ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | π§ͺ Minimizer | lmfit (leastsq) |
|---|
| 2 | β
Overall status | success |
|---|
| 3 | β±οΈ Fitting time (seconds) | 2.53 |
|---|
| 4 | π Iterations | 76 |
|---|
| 5 | π Goodness-of-fit (reduced ΟΒ²) | 2.94 |
|---|
| 6 | π R-factor (Rf, %) | 4.21 |
|---|
| 7 | π R-factor squared (RfΒ², %) | 6.61 |
|---|
| 8 | π Weighted R-factor (wR, %) | 13.29 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | tbti | atom_site | Ti | occupancy | | 0.9730 | 0.9661 | 0.0085 | 0.71 % β |
|---|
| 2 | tbti | atom_site | O1 | fract_x | | 0.3280 | 0.3280 | 0.0000 | 0.01 % β |
|---|
| 3 | tbti | atom_site | O1 | occupancy | | 0.9989 | 0.9940 | 0.0050 | 0.50 % β |
|---|
| 4 | tbti | atom_site | O2 | occupancy | | 0.9688 | 0.9718 | 0.0088 | 0.31 % β |
|---|
| 5 | tbti | atom_site | O2 | adp_iso | Γ
Β² | 0.0030 | 0.0033 | 0.0002 | 7.87 % β |
|---|
| 6 | tbti | atom_site_aniso | Tb | adp_11 | Γ
Β² | 0.0068 | 0.0066 | 0.0001 | 3.45 % β |
|---|
| 7 | tbti | atom_site_aniso | Tb | adp_12 | Γ
Β² | 0.0000 | -0.0023 | 0.0001 | N/A |
|---|
| 8 | tbti | atom_site_aniso | Ti | adp_11 | Γ
Β² | 0.0054 | 0.0049 | 0.0003 | 9.56 % β |
|---|
| 9 | tbti | atom_site_aniso | Ti | adp_12 | Γ
Β² | 0.0000 | -0.0005 | 0.0002 | N/A |
|---|
| 10 | tbti | atom_site_aniso | O1 | adp_11 | Γ
Β² | 0.0057 | 0.0067 | 0.0002 | 17.67 % β |
|---|
| 11 | tbti | atom_site_aniso | O1 | adp_22 | Γ
Β² | 0.0057 | 0.0049 | 0.0001 | 14.61 % β |
|---|
| 12 | tbti | atom_site_aniso | O1 | adp_23 | Γ
Β² | 0.0000 | 0.0019 | 0.0001 | N/A |
|---|
| 13 | heidi | extinction | | radius | ΞΌm | 26.4348 | 24.8317 | 0.4931 | 6.06 % β |
|---|
| 14 | heidi | linked_structure | | scale | | 2.9329 | 2.8744 | 0.0274 | 1.99 % β |
|---|
"
],
"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": 34,
"id": "42",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:42.194120Z",
"iopub.status.busy": "2026-08-18T18:18:42.193961Z",
"iopub.status.idle": "2026-08-18T18:18:42.217119Z",
"shell.execute_reply": "2026-08-18T18:18:42.216411Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.correlations()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "43",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:42.218979Z",
"iopub.status.busy": "2026-08-18T18:18:42.218814Z",
"iopub.status.idle": "2026-08-18T18:18:42.233074Z",
"shell.execute_reply": "2026-08-18T18:18:42.232306Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='heidi')"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "44",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:42.235007Z",
"iopub.status.busy": "2026-08-18T18:18:42.234786Z",
"iopub.status.idle": "2026-08-18T18:18:42.245275Z",
"shell.execute_reply": "2026-08-18T18:18:42.244496Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Edi |
|---|
| 1 | data_tbti |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 10.13 |
|---|
| 4 | _cell.length_b 10.13 |
|---|
| 5 | _cell.length_c 10.13 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 90. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "F d -3 m" |
|---|
| 11 | _space_group.coord_system_code 2 |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 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 |
|---|
| 27 | Tb Tb 0.5 0.5 0.5 d 16 1. 0.00658189 Uani |
|---|
| 28 | Ti Ti 0. 0. 0. c 16 0.9661(85) 0.00488144 Uani |
|---|
| 29 | O1 O 0.327996(47) 0.125 0.125 f 48 0.9940(50) 0.00550586 Uani |
|---|
| 30 | O2 O 0.375 0.375 0.375 b 8 0.9718(88) 0.00327(24) Uiso |
|---|
| 31 | |
|---|
| 32 | loop_ |
|---|
| 33 | _atom_site_aniso.id |
|---|
| 34 | _atom_site_aniso.adp_11 |
|---|
| 35 | _atom_site_aniso.adp_22 |
|---|
| 36 | _atom_site_aniso.adp_33 |
|---|
| 37 | _atom_site_aniso.adp_12 |
|---|
| 38 | _atom_site_aniso.adp_13 |
|---|
| 39 | _atom_site_aniso.adp_23 |
|---|
| 40 | Tb 0.00658(14) 0.00658189 0.00658189 -0.00228(11) -0.00228459 -0.00228459 |
|---|
| 41 | Ti 0.00488(29) 0.00488144 0.00488144 -0.00048(25) -0.00048176 -0.00048176 |
|---|
| 42 | O1 0.00674(18) 0.00489(13) 0.0048898 0. 0. 0.00189(13) |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"structure.show_as_text()"
]
},
{
"cell_type": "markdown",
"id": "45",
"metadata": {},
"source": [
"### Display Structure (final)\n",
"\n",
"Tb, Ti and O1 were refined with anisotropic displacements (`Uani`), so the\n",
"ADP view now draws them as probability ellipsoids, while O2 stayed isotropic\n",
"(`Uiso`) and remains a sphere β highlighting how the view changed from the\n",
"initial spheres to ellipsoids."
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "46",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:42.247084Z",
"iopub.status.busy": "2026-08-18T18:18:42.246936Z",
"iopub.status.idle": "2026-08-18T18:18:42.314213Z",
"shell.execute_reply": "2026-08-18T18:18:42.313600Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'tbti'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\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='tbti')"
]
},
{
"cell_type": "markdown",
"id": "47",
"metadata": {},
"source": [
"## π Report\n",
"\n",
"PDF generation can be enabled locally by uncommenting the line below,\n",
"but it requires Tectonic and may download a TeX bundle, so it is\n",
"disabled to keep this tutorial reproducible offline."
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "48",
"metadata": {
"execution": {
"iopub.execute_input": "2026-08-18T18:18:42.316433Z",
"iopub.status.busy": "2026-08-18T18:18:42.316259Z",
"iopub.status.idle": "2026-08-18T18:18:42.500603Z",
"shell.execute_reply": "2026-08-18T18:18:42.499793Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project π¦ \u001b[0m\u001b[32m'tbti_heidi'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-tbti-heidi'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"βββ π project.edi\n",
"βββ π structures/\n",
"β βββ π tbti.edi\n",
"βββ π experiments/\n",
"β βββ π heidi.edi\n",
"βββ π analysis/\n",
"β βββ π analysis.edi\n",
"βββ π reports/\n",
" βββ π tbti_heidi.html\n"
]
}
],
"source": [
"# project.report.pdf = True\n",
"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
}