qzhu2017 / XRD

X-ray diffraction calculations
MIT License
7 stars 6 forks source link

XRD is not consistent with Mercury #9

Closed qzhu2017 closed 4 years ago

qzhu2017 commented 4 years ago

@sayred1 I tried to use the same file (NaCl.cif) to compute the XRD, and compared it with Mercury. 8971765

The results are shown below. Clearly, we have a significant off for the 3rd peak. Could you just focus on that peak and recheck if the intensity is calculated correctly? I am thinking if this is because we missed some correction term or simply because we messed some expression in the current correction terms.

image

Please do this in time. If you are not clear about my concern, please talk to me. We have wasted a lot of time.

sayred1 commented 4 years ago

I went in and looked our intensity calculations, there was a single line of code that needed to be fixed at line 701 that accounts for multiplicity. https://github.com/qzhu2017/XRD/blob/0784b0f41726e762aa0c51712478dcf3ba16ede7/XRD.py#L692-L702.

Here's what the pxrd and mercury comparison looks like now:

Screen Shot 2020-01-07 at 5 51 25 PM

This is without preferred orientation. Our and mercurys profile functions still seem to be very different than one another in terms of intensities, and also have a slight shift in 2theta values. Notice also that both simulated peaks line up in 2theta, and that mercurys simulated peak is also slightly shifted from its profile function.

I crosschecked out pxrd intensities and 2thetas with pymatgen, everything seems to line up.

Screen Shot 2020-01-07 at 5 54 54 PM

If we alter the march parameter, for instance I set the march parameter _G = 0.63 in similarity.ipynb, this is what we get:

Screen Shot 2020-01-07 at 6 16 38 PM

Obviously preferred orientation has a significant impact. But if you play with the march parameter, there isn't a value at which all simulated intensities from pxrd and mercury xrd line up, so we may be missing another correction factor that mercury has.

I also added another profiling function, https://en.wikipedia.org/wiki/Voigt_profile, which I believe is the function that mercury uses.

qzhu2017 commented 4 years ago

@sayred1 , following our video discussion. I suspect the broadening of the peak is related to the theta angle by

image

I got the relation from a quick on-line search http://www.fhi-berlin.mpg.de/acnew/department/pages/teaching/pages/teaching__wintersemester__2015_2016/frank_girgsdies__peak_profile_fitting_in_xrd__151106.pdf

So, suppose the sample has a fixed size (p), the bcos(theta) term should be constant. Therefore, the peak at high angle will have bigger broadening. So the intensity should drop.

I am not sure if this is just a simple cos(theta). But I just tried to rescale your data by cos(theta). The results look comparable with Mercury results.

image image

Please further check if my relation is correct.

qzhu2017 commented 4 years ago

@sayred1 Okay, I just found a very concise (but very useful) tutorial which clears my concerns regarding the issues appeared in our discussion.

http://prism.mit.edu/xray/introduction%20to%20xrpd%20data%20analysis.pdf

The peak shift follows a cosθ behavior, so peak shift might change direction over a large angular range.