Closed lnnbig closed 3 months ago
Hi Innbig, thanks for your message!
I've never tried simulating liquids before so this is really interesting.
I've got an idea those drop-offs might be due to the artificially reduced number of peaks at those points due to the cut-offs - there are no tails of the peaks at higher or lower angles to increase the background. However, with 13179 atoms and over 2 million reflections to calculate, the simulations take a little while to test, but I will have a look!
In the mean time, I suspect a simple hack would be to calculate a few extra degrees and omit the first and last few points. You can then simply omit those points at the start and end:
plt.plot(tth[10:-10], inten[10:-10], '-', lw=0.5)
Hi Innbig,
I've just made some changes in Version 3.2 that should help. I'll release this version to PIP shortly.
As mentioned above, the problem arrives from the the missing reflections just beyond the limits of the calculation - the tails of these missing reflections are needed to produce a consistent histogram.
To correct this, the calculation now calculates reflections including those upto 3 peak_width distances beyond the bounds, then cuts the calculation down the the required size at the end. As shown below, this removes the error for several different peak_width (pw) values:
Another addition you may be interested in is the "save" and "load" function I've added, allowing you to save a calculation and reload it without having to re-calculate the structure factors:
# run with save='file.npy' the first time
tth, inten, reflections = xtl.Scatter.powder(units='tth', peak_width=0.01, save='sf.npy')
# load structure factors from 'sf.npy' to save the lengthy calculation
tth, inten, reflections = xtl.Scatter.powder(units='tth', peak_width=0.01, load='sf.npy')
If you change any of the calculation parameters, the number of structure factors will change and you'll get an error, but for re-plotting the data is saves a lot of time.
Hope this is helpful, feel free to reopen the ticket or create a new one if you have any further problems. Thanks again for your interest!
Hello Dan,
I noticed an abnormal tail when using Dans_Diffraction for a liquid structure ( xrd.zip ). Could you please take a look at this? Thank you!