Skip to content

Commit

Permalink
Try calculating diffraction pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSazonov committed Jul 21, 2024
1 parent 4a4ae1a commit 8f1185c
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ jobs:

- name: Debug pyCFML import
shell: bash
run: python3 tests/unit_tests/pycfml/test__cfml_metrics__debug.py
run: python3 tests/functional_tests/pyCFML/cfml_utilities/powder_pattern_from_json/test__powder_pattern_from_json.py

#- name: Debug pyCFML import
# shell: bash
# run: python3 tests/unit_tests/pycfml/test__cfml_metrics__debug.py

#- name: Run pyCFML unit tests
# shell: bash
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
_database_code_ICSD 19023
_chemical_name_systematic 'Dilithium Calcium Silicate'
_chemical_formula_structural 'Li2 Ca Si O4'
_chemical_formula_sum 'Ca1 Li2 O4 Si1'
_structure_type 'K3VO4'
_cell_length_a 5.047
_cell_length_b 5.047
_cell_length_c 6.486
_cell_angle_alpha 90.0
_cell_angle_beta 90.0
_cell_angle_gamma 90.0
_cell_volume 165.21
_cell_formula_units_Z 2.0
_cell_molecular_mass 146.04
_symmetry_space_group_name_H-M 'I -4 2 m'
_symmetry_Int_Tables_number 121
_temperature_in_K None
_pressure_in_MPa None
_experimental_technique 'X-ray diffraction (single crystal)'
_type_of_data 'Experimental'
_citation_journal_full 'Journal of Solid State Chemistry'
_citation_year 1973
_citation_journal_volume 7
_citation_page_first 422
_citation_page_last 427
loop_
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_Wyckoff_symbol
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Ca 2 b 0.0 0.0 0.5 1.0
Li 4 d 0.0 0.5 0.25 1.0
O 8 i 0.189 0.189 0.142 1.0
Si 2 a 0.0 0.0 0.0 1.0
loop_
_atom_type_symbol
_atom_type_oxidation_number
Ca+2 2
Li+1 1
O-2 -2
Si+4 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os
from pycrysfml import crysfml08lib

os.environ['CRYSFML_DB'] = os.path.join(os.path.dirname(crysfml08lib.__file__), 'Databases') # access to Databases/magnetic_data.txt

PHASE_CIF = os.path.join(os.path.dirname(__file__), 'phases', '19023_Ca1Li2O4Si1_Tetragonal_121.cif')

JSON = {
"cif": PHASE_CIF,
"experiments": [
{
"NPD": {
"_diffrn_source": "nuclear reactor",
"_diffrn_radiation_probe": "neutron",
"_diffrn_radiation_wavelength": 1.27,
"_pd_instr_resolution_u": 0.02,
"_pd_instr_resolution_v": -0.02,
"_pd_instr_resolution_w": 0.12,
"_pd_instr_resolution_x": 0.0015,
"_pd_instr_resolution_y": 0,
"_pd_instr_reflex_asymmetry_p1": 0,
"_pd_instr_reflex_asymmetry_p2": 0,
"_pd_instr_reflex_asymmetry_p3": 0,
"_pd_instr_reflex_asymmetry_p4": 0,
"_pd_meas_2theta_offset": 0,
"_pd_meas_2theta_range_min": 1,
"_pd_meas_2theta_range_max": 140,
"_pd_meas_2theta_range_inc": 0.05,
"_phase": [
{
"_label": "CIFCODE",
"_scale": 1
}
],
"_pd_background": [
{
"_2theta": 1,
"_intensity": 20
},
{
"_2theta": 140,
"_intensity": 20
}
]
}
}
]
}

# Debug

if __name__ == '__main__':
print(f':::::: Calculating diffraction pattern for: {os.path.basename(PHASE_CIF)}')
x, y = crysfml08lib.f_powder_pattern_from_json(JSON)
print(f':::::: Resulted y-array: {y}')

0 comments on commit 8f1185c

Please sign in to comment.