Change minimizer¶
This example shows how to change the minimization engine for refinement.
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()
job = ed.Job()
Define a model¶
Download the CIF file from the EasyDiffraction repository on GitHub
In [4]:
Copied!
ed.download_from_repository('lbco_adp.cif', destination='data')
ed.download_from_repository('lbco_adp.cif', destination='data')
Load a phase from the downloaded CIF file
In [5]:
Copied!
job.add_phase_from_file('data/lbco_adp.cif')
print(job.phases)
job.add_phase_from_file('data/lbco_adp.cif')
print(job.phases)
Collection of 1 phases: ['lbco']
Show phase info in CIF format
In [6]:
Copied!
phase = job.phases['lbco']
print(phase.cif)
phase = job.phases['lbco']
print(phase.cif)
data_lbco _cell_length_a 3.89 _cell_length_b 3.89 _cell_length_c 3.89 _cell_angle_alpha 90.00000000 _cell_angle_beta 90.00000000 _cell_angle_gamma 90.00000000 _space_group_name_H-M_ref 'P m -3 m' 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 La La 0.00000000 0.00000000 0.00000000 0.5 Biso 0.4958 Ba Ba 0.00000000 0.00000000 0.00000000 0.5 Biso 0.4943 Co Co 0.5 0.5 0.5 1.00000000 Biso 0.2567 O O 0.00000000 0.5 0.5 1.00000000 Biso 1.4041
Display the crystal structure of a given model
In [7]:
Copied!
job.show_crystal_structure(id='lbco')
job.show_crystal_structure(id='lbco')
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('hrpt.xye', destination='data')
ed.download_from_repository('hrpt.xye', destination='data')
Show content of the downloaded file (first 6 lines)
In [9]:
Copied!
with open('data/hrpt.xye') as f:
print(''.join(f.readlines()[:6]))
with open('data/hrpt.xye') as f:
print(''.join(f.readlines()[:6]))
# 2theta intensity su 10.00 167.00 12.60 10.05 157.00 12.50 10.10 187.00 13.30 10.15 197.00 14.00 10.20 164.00 12.50
Load experimentally measured data from a file in XYE format
In [10]:
Copied!
job.add_experiment_from_file('data/hrpt.xye')
job.add_experiment_from_file('data/hrpt.xye')
Display the experimentally measured data
In [11]:
Copied!
job.show_experiment_chart()
job.show_experiment_chart()