DanPorter / Dans_Diffraction

Reads crystallographic cif files and simulates diffraction
Apache License 2.0
45 stars 13 forks source link

difference between "neutron" and "neutron magnetic"? #17

Closed XinjianOUYANG closed 3 months ago

XinjianOUYANG commented 3 months ago

When calculating the scattering partern for a magnetic structure, what's the difference beween "neutron" and "neutron magnetic" for scattering_type parameter?

If I understand correctly, for a magnetic structure, the "neutron" scattering_type only calculates the scattering partern of its nuclear component, while the "neutron magnetic" only calculates its magnetic component. Is this true in the implementation of the codes?

Thank your for your answer!

DanPorter commented 3 months ago

Hi XinjianOUYANG, thanks for your question and your interest in Dans_Diffraction! You are correct that using "neutron" as the scattering type calculates only the nuclear component and "neutron magnetic" calculates only the magnetic component. To combine them you would need to combine the structure factors:

import Dans_Diffraction as dif
import Dans_Diffraction.functions_scattering as fs

xtl = dif.Crystal('file.mcif')

hkl = [[1, 0, 0], [0,1,0],[2,0,0]]
sf_nuclear = xtl.Scatter.structure_factor(hkl, scattering_type='neutron')
sf_mag = xtl.Scatter.structure_factor(hkl, scattering_type='neutron magnetic')
sf_tot = sf_nuclear + sf_mag
intensity = fs.intensity(sf_tot)

for ref, ii in zip(hkl, intensity):
    print(f"{ref} :  {ii:.2f}")