Fitting pd-neut-tof NCAF-WISH¶
This example shows how to refine the crystal structure parameters of Si from neutron diffraction data in a time-of-flight experiment performed on WISH diffractometer at ISIS.
Import EasyDiffraction¶
In [2]:
Copied!
import easydiffraction as ed
import easydiffraction as ed
Create a job¶
Create a job — the main object to store all the information
In [3]:
Copied!
job = ed.Job(type='tof')
print(job.type)
job = ed.Job(type='tof')
print(job.type)
Job type: pd-tof-unp-1d-neut
Define a model¶
Download the CIF file from the EasyDiffraction repository on GitHub
In [4]:
Copied!
ed.download_from_repository('ncaf.cif', destination='data')
ed.download_from_repository('ncaf.cif', destination='data')
Load a phase from the downloaded CIF file
In [5]:
Copied!
job.add_phase_from_file('data/ncaf.cif')
print(job.phases)
job.add_phase_from_file('data/ncaf.cif')
print(job.phases)
Collection of 1 phases: ['ncaf']
Show phase info in CIF format
In [6]:
Copied!
phase = job.phases['ncaf']
print(phase.cif)
phase = job.phases['ncaf']
print(phase.cif)
data_ncaf _cell_length_a 10.250256 _cell_length_b 10.250256 _cell_length_c 10.250256 _cell_angle_alpha 90.00000000 _cell_angle_beta 90.00000000 _cell_angle_gamma 90.00000000 _space_group_name_H-M_ref 'I 21 3' loop_ _atom_site_label _atom_site_type_symbol _atom_site_fract_x _atom_site_fract_y _atom_site_fract_z _atom_site_occupancy _atom_site_adp_type _atom_site_B_iso_or_equiv Ca Ca 0.4661 0.00000000 0.25 1.00000000 Biso 0.9 Al Al 0.25171 0.25171 0.25171 1.00000000 Biso 0.66 Na Na 0.08481 0.08481 0.08481 1.00000000 Biso 1.9 F1 F 0.1375 0.3053 0.1195 1.00000000 Biso 0.9 F2 F 0.3626 0.3634 0.1867 1.00000000 Biso 1.28 F3 F 0.4612 0.4612 0.4612 1.00000000 Biso 0.79
Display the crystal structure of a given model
In [7]:
Copied!
job.show_crystal_structure(id='ncaf')
job.show_crystal_structure(id='ncaf')
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
Define an experiment¶
Download the data file from the EasyDiffraction repository on GitHub
In [8]:
Copied!
ed.download_from_repository('wish.xye', destination='data')
ed.download_from_repository('wish.xye', destination='data')
Show content of the downloaded file (first 5 lines)
In [9]:
Copied!
with open('data/wish.xye') as f:
print(''.join(f.readlines()[:5]))
with open('data/wish.xye') as f:
print(''.join(f.readlines()[:5]))
9001.0830 616.5238 124.5646 9006.8848 578.7690 123.1410 9012.6904 574.1842 120.5078 9018.5000 507.7390 111.3004 9024.3125 404.6729 101.6163
Load experimentally measured data from downloaded file in XYE format
In [10]:
Copied!
job.add_experiment_from_file('data/wish.xye')
job.add_experiment_from_file('data/wish.xye')
Display the experimentally measured data
In [11]:
Copied!
job.show_experiment_chart()
job.show_experiment_chart()