Skip to content

Commit f9c1a22

Browse files
authored
Merge pull request #29 from DanPorter/polarised_neutrons
Polarised neutrons
2 parents ef046ee + ff2bc7a commit f9c1a22

18 files changed

+648
-237
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
run: pipx run build
1717

1818
- name: Upload sdist and wheel as artifacts
19-
uses: actions/upload-artifact@v3
19+
uses: actions/upload-artifact@v4
2020
with:
2121
name: dist
2222
path: dist
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
# download sdist and wheel from dist job
38-
- uses: actions/download-artifact@v3
38+
- uses: actions/download-artifact@v4
3939

4040
# publish to PyPI using trusted publishing
4141
- name: Publish to PyPI

Dans_Diffraction/README.md

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ xtl.Cell.gamma
4646

4747
Selected functions (see internal documentation for more):
4848
```python
49-
xtl.Cell.latt([2.85,2.85,10.8,90,90,120]) # Define the lattice parameters from a list
49+
xtl.Cell.latt([2.85,2.85,10.8,90,90,120]) # Define the lattice parameters from a list or subset
5050
xtl.Cell.tth([0,0,12],energy_kev=8.0) # Calculate the two-theta of a reflection
5151
xtl.Cell.lp() # Returns the current lattice parameters
5252
xtl.Cell.volume() # Returns the calculated volume in A^3
@@ -111,16 +111,16 @@ xtl.Structrue contains all atomic positions in the unit cell.
111111

112112
Each atom has properties:
113113

114-
| Property | |
115-
| ------------- | ------------- |
116-
| u | Fractional atomic coordinates along direction of **a** |
117-
| v | Fractional atomic coordinates along direction of **b** |
118-
| w | Fractional atomic coordinates along direction of **c** |
119-
| type | element species, given as element name, e.g. 'Fe' |
120-
| label | Name of atomic position, e.g. 'Fe1' |
121-
| occupancy | Occupancy of this atom at this atomic position |
122-
| uiso | atomic displacement factor (ADP) <u^2> |
123-
| mxmymz | magnetic moment direction [x,y,z] |
114+
| Property | |
115+
|-----------|----------------------------------------------------------|
116+
| u | Fractional atomic coordinates along direction of **a** |
117+
| v | Fractional atomic coordinates along direction of **b** |
118+
| w | Fractional atomic coordinates along direction of **c** |
119+
| type | element species, given as element name, e.g. 'Fe' |
120+
| label | Name of atomic position, e.g. 'Fe1' |
121+
| occupancy | Occupancy of this atom at this atomic position |
122+
| uiso | atomic displacement factor (ADP) <u^2> |
123+
| mxmymz | magnetic moment direction [x,y,z] |
124124

125125
Functions available:
126126
```python
@@ -176,13 +176,14 @@ xtl.Plot.tensor_scattering_stokes # Return tensor scattering intensities for non
176176
### Scattering
177177
Simulate diffraction from the crystal structure, for various scattering types, including:
178178

179-
| Name | Explanation |
180-
| ---- | ----------- |
181-
| 'xray' | X-Ray diffraction, using atomic form factors |
182-
| 'neutron' | Neutron difraction, using neutron scattering lengths. |
183-
| 'neutron magnetic' | Magnetic neutron diffraction |
184-
| 'xray magnetic' | Non-resonant x-ray magnetic diffraction |
185-
| 'xray resonant' | Resonant x-ray magnetic diffraction |
179+
| Name | Explanation |
180+
|--------------------|----------------------------------------------------------|
181+
| 'xray' | X-Ray diffraction, using atomic form factors |
182+
| 'neutron' | Neutron difraction, using neutron scattering lengths. |
183+
| 'neutron magnetic' | Magnetic neutron diffraction |
184+
| 'xray magnetic' | Non-resonant x-ray magnetic diffraction |
185+
| 'xray resonant' | Resonant x-ray magnetic diffraction |
186+
| 'xray dispersion' | X-Ray diffraction using energy dispersive form factors |
186187

187188
Functions calculate the complex structure factor based on the equation:
188189

@@ -192,19 +193,27 @@ Scattering factors and scattering lengths for available elements are found in [d
192193

193194
Setup the scattering attributes with the *xtl.Scatter.setup_scatter(parameter)* function:
194195

195-
| Parameter | Explanation |
196-
| ---------- | ----------- |
197-
| type | 'xray','neutron','xray magnetic','neutron magnetic','xray resonant' |
198-
| energy_kev | radiation energy in keV |
199-
| wavelength_a | radiation wavelength in Angstrom |
200-
| powder_units | units to use when displaying/ plotting ['twotheta', 'd',' 'q'] |
201-
| min_twotheta | minimum detector (two-theta) angle |
202-
| max_twotheta | maximum detector (two-theta) angle |
203-
| min_theta | minimum sample angle = -opening angle |
204-
| max_theta | maximum sample angle = opening angle |
205-
| theta_offset | sample offset angle |
206-
| specular | [h,k,l] : reflections normal to sample surface |
207-
| parallel | [h,k,l] : reflections normal to sample surface |
196+
| Parameter | Explanation |
197+
|---------------------|-----------------------------------------------------------------------------------------|
198+
| scattering_type | 'xray','neutron','xray magnetic','neutron magnetic','xray resonant', 'xray dispersion' |
199+
| energy_kev | radiation energy in keV |
200+
| wavelength_a | radiation wavelength in Angstrom |
201+
| powder_units | units to use when displaying/ plotting ['twotheta', 'd',' 'q'] |
202+
| min_twotheta | minimum detector (two-theta) angle |
203+
| max_twotheta | maximum detector (two-theta) angle |
204+
| min_theta | minimum sample angle = -opening angle |
205+
| max_theta | maximum sample angle = opening angle |
206+
| theta_offset | sample offset angle |
207+
| specular | [h,k,l] : reflections normal to sample surface |
208+
| parallel | [h,k,l] : reflections normal to sample surface |
209+
| scattering_factors | xray scattering factor, either 'waaskirf' or 'itc' |
210+
| scattering_lengths | neutron scattering lengths either 'sears' or 'default' |
211+
| magnetic_formfactor | True/False magnetic form factor for magnetic SF |
212+
| polarisation | beam polarisation setting ['ss', 'sp'*, 'sp', 'pp'] |
213+
| polarisation_vector | [x,y,z] incident polarisation vector |
214+
| azimuthal_reference | [h,k,l] direction of azimuthal zero angle |
215+
| azimuth | azimuthal angle in deg |
216+
| flm | Resonant settings (flm1, flm2, flm3) |
208217

209218

210219
Selected functions (see internal documentation for more):
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#\#CIF_2.0
2+
# Created by the Bilbao Crystallographic Server
3+
# http://www.cryst.ehu.es
4+
# Date: 11/19/2017 17:07:02
5+
# Database entry: 1.31 MnO
6+
# Cif-like file for the case 1.31
7+
8+
9+
data_5yOhtAoR
10+
_audit_creation_date 2017-11-19
11+
_audit_creation_method "Bilbao Crystallographic Server"
12+
13+
_chemical_name_systematic
14+
;
15+
;
16+
_chemical_name_common ?
17+
_chemical_formula_moiety ?
18+
_chemical_formula_structural ?
19+
_chemical_formula_analytical ?
20+
_chemical_formula_iupac ?
21+
_chemical_formula_sum 'Mn O'
22+
_chemical_formula_weight ?
23+
_chemical_melting_point ?
24+
_chemical_compound_source ?
25+
_chemical_absolute_configuration .
26+
27+
28+
_citation_journal_abbrev "PHYSICAL REVIEW LETTERS"
29+
_citation_journal_volume 96
30+
_citation_page_first ?
31+
_citation_page_last ?
32+
_citation_article_id 047209
33+
_citation_year 2006
34+
_citation_DOI 10.1103/physrevlett.96.047209
35+
36+
loop_
37+
_citation_author_name
38+
"A.L. Goodwin"
39+
"M.G. Tucker"
40+
"M.T. Dove"
41+
"D.A. Keen"
42+
43+
44+
45+
46+
47+
_atomic_positions_source_database_code_ICSD 9864
48+
_atomic_positions_source_other .
49+
50+
_transition_temperature 120
51+
_experiment_temperature 10
52+
53+
loop_
54+
_irrep_id
55+
_irrep_dimension
56+
_irrep_small_dimension
57+
_irrep_direction_type
58+
_irrep_action
59+
_irrep_modes_number
60+
_irrep_presence
61+
mL3+ 8 2 special primary . .
62+
63+
_exptl_crystal_magnetic_properties_details
64+
;
65+
NSD
66+
Additional modulation observed. Only average structure presented here
67+
Atomic positions used are of the parent phase (icsd 9864).
68+
The reference reports a C2 positional structure.
69+
Its deviations from from the parent structure used here smaller than 0.1 A.
70+
Modulus magnetic moment Mn: 5.65
71+
Other source: Phys. Rev. 83 (1951) 333
72+
The magnetic symmetry implies the space group C2/m as effective
73+
symmetry for the positional structure, higher than the symmetry C2
74+
proposed in the reference.
75+
;
76+
77+
_active_magnetic_irreps_details
78+
;
79+
1k magnetic structure
80+
a secondary magnetic irrep possible but not present: mL2+
81+
;
82+
83+
_parent_space_group.name_H-M_alt 'F m -3m'
84+
_parent_space_group.IT_number 225
85+
_parent_space_group.transform_Pp_abc 'a,b,c;0,0,0'
86+
87+
loop_
88+
_parent_propagation_vector.id
89+
_parent_propagation_vector.kxkykz
90+
k1 [0.5 0.5 0.5]
91+
92+
_parent_space_group.child_transform_Pp_abc '2a,2b,2c;0,0,0'
93+
_space_group_magn.transform_BNS_Pp_abc 'a/4+b/4-c/2,a/4-b/4,-a/2-b/2;0,0,0'
94+
95+
96+
_space_group_magn.number_BNS 15.90
97+
_space_group_magn.name_BNS "C_c 2/c"
98+
_space_group_magn.point_group_name "2/m1'"
99+
_space_group_magn.point_group_number "5.2.13"
100+
_cell_length_a 8.8920
101+
_cell_length_b 8.8920
102+
_cell_length_c 8.8920
103+
_cell_angle_alpha 90.0000
104+
_cell_angle_beta 90.0000
105+
_cell_angle_gamma 90.0000
106+
107+
loop_
108+
_space_group_symop_magn_operation.id
109+
_space_group_symop_magn_operation.xyz
110+
1 x,y,z,+1
111+
2 -y+3/4,-x+3/4,-z,+1
112+
3 -x+1/4,-y+3/4,-z,+1
113+
4 y,x+1/2,z,+1
114+
115+
loop_
116+
_space_group_symop_magn_centering.id
117+
_space_group_symop_magn_centering.xyz
118+
1 x,y,z,+1
119+
2 x,y+1/4,z+3/4,+1
120+
3 x,y+1/2,z+1/2,+1
121+
4 x,y+3/4,z+1/4,+1
122+
5 x+1/4,y,z+3/4,+1
123+
6 x+1/4,y+1/4,z+1/2,+1
124+
7 x+1/4,y+1/2,z+1/4,+1
125+
8 x+1/4,y+3/4,z,+1
126+
9 x+1/2,y,z+1/2,+1
127+
10 x+1/2,y+1/4,z+1/4,+1
128+
11 x+1/2,y+1/2,z,+1
129+
12 x+1/2,y+3/4,z+3/4,+1
130+
13 x+3/4,y,z+1/4,+1
131+
14 x+3/4,y+1/4,z,+1
132+
15 x+3/4,y+1/2,z+3/4,+1
133+
16 x+3/4,y+3/4,z+1/2,+1
134+
17 x+3/4,y+3/4,z,-1
135+
18 x+3/4,y,z+3/4,-1
136+
19 x+3/4,y+1/4,z+1/2,-1
137+
20 x+3/4,y+1/2,z+1/4,-1
138+
21 x,y+3/4,z+3/4,-1
139+
22 x,y,z+1/2,-1
140+
23 x,y+1/4,z+1/4,-1
141+
24 x,y+1/2,z,-1
142+
25 x+1/4,y+3/4,z+1/2,-1
143+
26 x+1/4,y,z+1/4,-1
144+
27 x+1/4,y+1/4,z,-1
145+
28 x+1/4,y+1/2,z+3/4,-1
146+
29 x+1/2,y+3/4,z+1/4,-1
147+
30 x+1/2,y,z,-1
148+
31 x+1/2,y+1/4,z+3/4,-1
149+
32 x+1/2,y+1/2,z+1/2,-1
150+
151+
loop_
152+
_atom_site_label
153+
_atom_site_type_symbol
154+
_atom_site_fract_x
155+
_atom_site_fract_y
156+
_atom_site_fract_z
157+
_atom_site_occupancy
158+
Mn1 Mn 0.00000 0.00000 0.00000 1
159+
O1 O 0.75000 0.50000 0.00000 1
160+
161+
loop_
162+
_atom_site_moment.label
163+
_atom_site_moment.crystalaxis_x
164+
_atom_site_moment.crystalaxis_y
165+
_atom_site_moment.crystalaxis_z
166+
_atom_site_moment.symmform
167+
Mn1 2.31 2.31 -4.62 mx,mx,mz
168+

Dans_Diffraction/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
3030
By Dan Porter, PhD
3131
Diamond
32-
2017
32+
2017-2025
3333
34-
Version 3.3.2
35-
Last updated: 20/11/2024
34+
Version 3.3.3
35+
Last updated: 06/02/2025
3636
3737
Version History:
3838
02/03/18 1.0 Version History started.
@@ -83,6 +83,7 @@
8383
26/09/24 3.3.0 Added complex neutron scattering lengths for isotopes from package periodictable. Thanks thamnos!
8484
06/11/24 3.3.1 Fixed incorrect cell basis for triclinic cells. Added functions_lattice.py and tests. Thanks LeeRichter!
8585
20/11/24 3.3.2 Added alternate option for neutron scattering lengths
86+
06/02/25 3.3.3 Added scattering options for polarised neutron and x-ray scattering. Thanks dragonyanglong!
8687
8788
Acknoledgements:
8889
2018 Thanks to Hepesu for help with Python3 support and ideas about breaking up calculations
@@ -109,6 +110,7 @@
109110
Aug 2024 Thanks to MaxPelly for spell checks in examples
110111
Sep 2024 Thanks to thamnos for suggestion to add complex neutron scattering lengths
111112
Oct 2024 Thanks to Lee Richter for pointing out the error in triclinic basis definition
113+
Dec 2024 Thanks to dragonyanglong for pointing out the error with magnetic neutron scattering
112114
113115
-----------------------------------------------------------------------------
114116
Copyright 2024 Diamond Light Source Ltd.
@@ -163,8 +165,8 @@
163165
'Structures', 'Fdmnes', 'FdmnesAnalysis']
164166

165167

166-
__version__ = '3.3.2'
167-
__date__ = '2024/11/20'
168+
__version__ = '3.3.3'
169+
__date__ = '2025/02/06'
168170

169171

170172
# Build

0 commit comments

Comments
 (0)