Structure Refinement: Taurine, SENJU¶
Crystal structure refinement of Taurine using time-of-flight single crystal neutron diffraction data from SENJU at J-PARC.
Import Library¶
In [2]:
Copied!
import easydiffraction as ed
import easydiffraction as ed
Step 1: Define Project¶
In [3]:
Copied!
# Create minimal project without name and description
project = ed.Project()
# Create minimal project without name and description
project = ed.Project()
Step 2: Define Structure¶
In [4]:
Copied!
# Download CIF file from repository
structure_path = ed.download_data(id=21, destination='data')
# Download CIF file from repository
structure_path = ed.download_data(id=21, destination='data')
Getting data...
Data #21: Taurine (crystal structure)
✅ Data #21 downloaded to 'data/ed-21.cif'
In [5]:
Copied!
project.structures.add_from_cif_path(structure_path)
project.structures.add_from_cif_path(structure_path)
In [6]:
Copied!
project.structures.show_names()
project.structures.show_names()
Defined structures 🧩
['taurine']
In [7]:
Copied!
structure = project.structures['taurine']
structure = project.structures['taurine']
In [8]:
Copied!
# structure.show_as_cif()
# structure.show_as_cif()
Step 3: Define Experiment¶
In [9]:
Copied!
data_path = ed.download_data(id=22, destination='data')
data_path = ed.download_data(id=22, destination='data')
Getting data...
Data #22: Taurine, SENJU (J-PARC)
✅ Data #22 downloaded to 'data/ed-22.xye'
In [10]:
Copied!
project.experiments.add_from_data_path(
name='senju',
data_path=data_path,
sample_form='single crystal',
beam_mode='time-of-flight',
radiation_probe='neutron',
)
project.experiments.add_from_data_path(
name='senju',
data_path=data_path,
sample_form='single crystal',
beam_mode='time-of-flight',
radiation_probe='neutron',
)
Data loaded successfully
Experiment 🔬 'senju'. Number of data points: 286.
In [11]:
Copied!
experiment = project.experiments['senju']
experiment = project.experiments['senju']
In [12]:
Copied!
experiment.linked_crystal.id = 'taurine'
experiment.linked_crystal.scale = 1.0
experiment.linked_crystal.id = 'taurine'
experiment.linked_crystal.scale = 1.0
In [13]:
Copied!
experiment.extinction.mosaicity = 1000.0
experiment.extinction.radius = 100.0
experiment.extinction.mosaicity = 1000.0
experiment.extinction.radius = 100.0
Step 4: Perform Analysis¶
In [14]:
Copied!
project.plot_meas_vs_calc(expt_name='senju')
project.plot_meas_vs_calc(expt_name='senju')
In [15]:
Copied!
experiment.linked_crystal.scale.free = True
experiment.extinction.radius.free = True
experiment.linked_crystal.scale.free = True
experiment.extinction.radius.free = True
In [16]:
Copied!
# experiment.show_as_cif()
# experiment.show_as_cif()
In [17]:
Copied!
# Start refinement. All parameters, which have standard uncertainties
# in the input CIF files, are refined by default.
project.analysis.fit()
# Start refinement. All parameters, which have standard uncertainties
# in the input CIF files, are refined by default.
project.analysis.fit()
Using experiment 🔬 'senju' for 'single' fitting
🚀 Starting fit process with 'lmfit (leastsq)'...
📈 Goodness-of-fit (reduced χ²) change:
| iteration | χ² | improvement [%] | |
|---|---|---|---|
| 1 | 1 | 748.12 | |
| 2 | 64 | 465.20 | 37.8% ↓ |
| 3 | 123 | 93.07 | 80.0% ↓ |
| 4 | 182 | 34.96 | 62.4% ↓ |
| 5 | 241 | 24.65 | 29.5% ↓ |
| 6 | 300 | 24.21 | 1.8% ↓ |
| 7 | 359 | 23.78 | 1.8% ↓ |
| 8 | 1003 | 23.56 |
🏆 Best goodness-of-fit (reduced χ²) is 23.56 at iteration 958
✅ Fitting complete.
In [18]:
Copied!
# Show fit results summary
project.analysis.show_fit_results()
# Show fit results summary
project.analysis.show_fit_results()
Fit results
❌ Success: False
⏱️ Fitting time: 20.90 seconds
📏 Goodness-of-fit (reduced χ²): 23.56
📏 R-factor (Rf): 21.59%
📏 R-factor squared (Rf²): 16.98%
📏 Weighted R-factor (wR): 17.74%
📈 Fitted parameters:
| datablock | category | entry | parameter | start | fitted | uncertainty | units | change | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | taurine | atom_site | S1 | fract_x | 0.2000 | 0.2044 | N/A | 2.18 % ↑ | |
| 2 | taurine | atom_site | S1 | fract_y | 0.3500 | 0.3469 | N/A | 0.90 % ↓ | |
| 3 | taurine | atom_site | S1 | fract_z | 0.3500 | 0.3482 | N/A | 0.52 % ↓ | |
| 4 | taurine | atom_site | S1 | b_iso | 1.5791 | 1.1417 | N/A | Ų | 27.70 % ↓ |
| 5 | taurine | atom_site | O1 | fract_x | 0.3130 | 0.3181 | N/A | 1.62 % ↑ | |
| 6 | taurine | atom_site | O1 | fract_y | 0.2400 | 0.2414 | N/A | 0.57 % ↑ | |
| 7 | taurine | atom_site | O1 | fract_z | 0.3510 | 0.3521 | N/A | 0.31 % ↑ | |
| 8 | taurine | atom_site | O1 | b_iso | 2.7635 | 2.7912 | N/A | Ų | 1.00 % ↑ |
| 9 | taurine | atom_site | O2 | fract_x | 0.9380 | 0.9396 | N/A | 0.17 % ↑ | |
| 10 | taurine | atom_site | O2 | fract_y | 0.3370 | 0.3381 | N/A | 0.32 % ↑ | |
| 11 | taurine | atom_site | O2 | fract_z | 0.2940 | 0.2928 | N/A | 0.41 % ↓ | |
| 12 | taurine | atom_site | O2 | b_iso | 3.6320 | 3.7348 | N/A | Ų | 2.83 % ↑ |
| 13 | taurine | atom_site | O3 | fract_x | 0.2220 | 0.2248 | N/A | 1.25 % ↑ | |
| 14 | taurine | atom_site | O3 | fract_y | 0.4120 | 0.4093 | N/A | 0.66 % ↓ | |
| 15 | taurine | atom_site | O3 | fract_z | 0.5070 | 0.5071 | N/A | 0.02 % ↑ | |
| 16 | taurine | atom_site | O3 | b_iso | 1.8950 | 2.1451 | N/A | Ų | 13.20 % ↑ |
| 17 | taurine | atom_site | N1 | fract_x | 0.2640 | 0.2637 | N/A | 0.10 % ↓ | |
| 18 | taurine | atom_site | N1 | fract_y | 0.6280 | 0.6273 | N/A | 0.12 % ↓ | |
| 19 | taurine | atom_site | N1 | fract_z | 0.3310 | 0.3326 | N/A | 0.48 % ↑ | |
| 20 | taurine | atom_site | N1 | b_iso | 2.1318 | 2.1431 | N/A | Ų | 0.53 % ↑ |
| 21 | taurine | atom_site | H1 | fract_x | 0.1330 | 0.1364 | N/A | 2.53 % ↑ | |
| 22 | taurine | atom_site | H1 | fract_y | 0.5880 | 0.5844 | N/A | 0.61 % ↓ | |
| 23 | taurine | atom_site | H1 | fract_z | 0.4210 | 0.4159 | N/A | 1.20 % ↓ | |
| 24 | taurine | atom_site | H1 | b_iso | 3.3951 | 2.4978 | N/A | Ų | 26.43 % ↓ |
| 25 | taurine | atom_site | H2 | fract_x | 0.1910 | 0.1874 | N/A | 1.89 % ↓ | |
| 26 | taurine | atom_site | H2 | fract_y | 0.7150 | 0.7140 | N/A | 0.14 % ↓ | |
| 27 | taurine | atom_site | H2 | fract_z | 0.3120 | 0.3078 | N/A | 1.33 % ↓ | |
| 28 | taurine | atom_site | H2 | b_iso | 4.5795 | 4.2614 | N/A | Ų | 6.95 % ↓ |
| 29 | taurine | atom_site | H3 | fract_x | 0.4400 | 0.4321 | N/A | 1.80 % ↓ | |
| 30 | taurine | atom_site | H3 | fract_y | 0.6240 | 0.6255 | N/A | 0.24 % ↑ | |
| 31 | taurine | atom_site | H3 | fract_z | 0.3490 | 0.3482 | N/A | 0.22 % ↓ | |
| 32 | taurine | atom_site | H3 | b_iso | 4.6585 | 4.9394 | N/A | Ų | 6.03 % ↑ |
| 33 | taurine | atom_site | C1 | fract_x | 0.3440 | 0.3479 | N/A | 1.12 % ↑ | |
| 34 | taurine | atom_site | C1 | fract_y | 0.4400 | 0.4402 | N/A | 0.04 % ↑ | |
| 35 | taurine | atom_site | C1 | fract_z | 0.2020 | 0.2025 | N/A | 0.22 % ↑ | |
| 36 | taurine | atom_site | C1 | b_iso | 1.7371 | 1.6820 | N/A | Ų | 3.17 % ↓ |
| 37 | taurine | atom_site | H11 | fract_x | 0.5520 | 0.5466 | N/A | 0.98 % ↓ | |
| 38 | taurine | atom_site | H11 | fract_y | 0.4330 | 0.4341 | N/A | 0.26 % ↑ | |
| 39 | taurine | atom_site | H11 | fract_z | 0.2430 | 0.2403 | N/A | 1.09 % ↓ | |
| 40 | taurine | atom_site | H11 | b_iso | 3.3951 | 3.4650 | N/A | Ų | 2.06 % ↑ |
| 41 | taurine | atom_site | H12 | fract_x | 0.3200 | 0.3264 | N/A | 2.00 % ↑ | |
| 42 | taurine | atom_site | H12 | fract_y | 0.3880 | 0.3774 | N/A | 2.74 % ↓ | |
| 43 | taurine | atom_site | H12 | fract_z | 0.0810 | 0.0851 | N/A | 5.02 % ↑ | |
| 44 | taurine | atom_site | H12 | b_iso | 3.3162 | 3.2415 | N/A | Ų | 2.25 % ↓ |
| 45 | taurine | atom_site | C2 | fract_x | 0.2000 | 0.1949 | N/A | 2.56 % ↓ | |
| 46 | taurine | atom_site | C2 | fract_y | 0.5570 | 0.5548 | N/A | 0.40 % ↓ | |
| 47 | taurine | atom_site | C2 | fract_z | 0.1820 | 0.1786 | N/A | 1.88 % ↓ | |
| 48 | taurine | atom_site | C2 | b_iso | 1.7371 | 1.8770 | N/A | Ų | 8.06 % ↑ |
| 49 | taurine | atom_site | H21 | fract_x | 0.2760 | 0.2722 | N/A | 1.39 % ↓ | |
| 50 | taurine | atom_site | H21 | fract_y | 0.6000 | 0.5975 | N/A | 0.42 % ↓ | |
| 51 | taurine | atom_site | H21 | fract_z | 0.0770 | 0.0737 | N/A | 4.27 % ↓ | |
| 52 | taurine | atom_site | H21 | b_iso | 2.1318 | 2.3711 | N/A | Ų | 11.23 % ↑ |
| 53 | taurine | atom_site | H22 | fract_x | 0.9990 | 0.9998 | N/A | 0.08 % ↑ | |
| 54 | taurine | atom_site | H22 | fract_y | 0.5490 | 0.5544 | N/A | 0.99 % ↑ | |
| 55 | taurine | atom_site | H22 | fract_z | 0.1610 | 0.1667 | N/A | 3.57 % ↑ | |
| 56 | taurine | atom_site | H22 | b_iso | 4.9743 | 4.4547 | N/A | Ų | 10.45 % ↓ |
| 57 | senju | extinction | radius | 100.0000 | 2.0159 | N/A | µm | 97.98 % ↓ | |
| 58 | senju | linked_crystal | scale | 1.0000 | 1.3517 | N/A | 35.17 % ↑ |
In [19]:
Copied!
# experiment.show_as_cif()
# experiment.show_as_cif()
In [20]:
Copied!
project.experiments.show_names()
project.experiments.show_names()
Defined experiments 🔬
['senju']
In [21]:
Copied!
project.plot_meas_vs_calc(expt_name='senju')
project.plot_meas_vs_calc(expt_name='senju')
Step 5: Show Project Summary¶
In [22]:
Copied!
project.summary.show_report()
project.summary.show_report()
———————————— PROJECT INFO ————————————
Title
Untitled Project
————————————————————— CRYSTALLOGRAPHIC DATA —————————————————————
Phase datablock
🧩 taurine
Space group
P 21/c
Cell parameters
| Parameter | Value | |
|---|---|---|
| 1 | a | 5.27290 |
| 2 | b | 11.65650 |
| 3 | c | 7.83830 |
| 4 | alpha | 90.00000 |
| 5 | beta | 94.01100 |
| 6 | gamma | 90.00000 |
Atom sites
| label | type | x | y | z | occ | Biso | |
|---|---|---|---|---|---|---|---|
| 1 | S1 | S | 0.20436 | 0.34685 | 0.34817 | 1.00000 | 1.14166 |
| 2 | O1 | O | 0.31806 | 0.24136 | 0.35209 | 1.00000 | 2.79115 |
| 3 | O2 | O | 0.93958 | 0.33809 | 0.29279 | 1.00000 | 3.73482 |
| 4 | O3 | O | 0.22478 | 0.40927 | 0.50709 | 1.00000 | 2.14513 |
| 5 | N1 | N | 0.26375 | 0.62726 | 0.33259 | 1.00000 | 2.14310 |
| 6 | H1 | H | 0.13636 | 0.58442 | 0.41594 | 1.00000 | 2.49781 |
| 7 | H2 | H | 0.18740 | 0.71402 | 0.30784 | 1.00000 | 4.26140 |
| 8 | H3 | H | 0.43207 | 0.62553 | 0.34824 | 1.00000 | 4.93944 |
| 9 | C1 | C | 0.34787 | 0.44016 | 0.20245 | 1.00000 | 1.68200 |
| 10 | H11 | H | 0.54661 | 0.43411 | 0.24035 | 1.00000 | 3.46501 |
| 11 | H12 | H | 0.32640 | 0.37737 | 0.08507 | 1.00000 | 3.24146 |
| 12 | C2 | C | 0.19488 | 0.55477 | 0.17858 | 1.00000 | 1.87705 |
| 13 | H21 | H | 0.27217 | 0.59751 | 0.07371 | 1.00000 | 2.37111 |
| 14 | H22 | H | 0.99978 | 0.55443 | 0.16674 | 1.00000 | 4.45472 |
——————————— EXPERIMENTS ———————————
Experiment datablock
🔬 senju
Experiment type
single crystal, neutron, time-of-flight
——————— FITTING ———————
Calculation engine
senju: CalculatorEnum.CRYSPY
Minimization engine
lmfit
Fit quality
| metric | value | |
|---|---|---|
| 1 | Goodness-of-fit (reduced χ²) | 23.56 |