Calculate Sq from structure files

208 views
Skip to first unread message

Chenyang Shi

unread,
Jun 5, 2018, 5:54:27 PM6/5/18
to diffpy-users
Dear Pavol and Simon,

Hope all is well! 

I am wondering what is the proper way to simulate S(Q) from a structure file (e.g. cif and xyz file). 

My naive thinking would be to use the similar code for PDF simulation as in attached SQs.py.  The calculator has a qgrid and fq options. I can then convert fq to sq using definition. However, I am not sure how fq is calculated in this code. If using DPC, this should be I(Q) normalized by <f(Q)>^2, but how about PC?

dpc = PDFCalculator(**cfg)

dpc(S1)

q, fq = dpc.qgrid, dpc.fq


Another question I have is there a similar command to PDFParser() when loading a S(Q) file. I have attached a S(Q) file generated by PDFgetX2. 

parser = PDFParser()

parser.parseFile(PDF_file_name)


Thanks,
Chenyang




IMC.cif
IMC.sq
IMC.xyz
SQs.py

Ben Frandsen

unread,
May 10, 2019, 5:13:15 PM5/10/19
to diffpy-users
Just following up on this old post from Chenyang. Is this the best way to calculate S(Q) from a structure file? I ask because in the test cases I have done, the calculated S(Q) looks very strange, so I am a bit suspicious of it.

Any ideas, Pavol? Or anyone else?

Thanks,
Ben

Juhas, Pavol

unread,
May 13, 2019, 4:11:40 PM5/13/19
to diffpy...@googlegroups.com, benfr...@gmail.com, curie...@gmail.com
On Fri, May 10, 2019 at 02:13:14PM -0700, Ben Frandsen wrote:
...
> Just following up on this old post from Chenyang. Is this the best way to
> calculate S(Q) from a structure file? I ask because in the test cases I
> have done, the calculated S(Q) looks very strange,
> so I am a bit suspicious of it.

Hi Ben and Chenyang,

This depends if you need S(Q) from a periodic structure or
from finite cluster.

For periodic structures the S(Q) obtained from PDFCalculator and
DebyePDFCalculator are fairly similar, but physically not
very accurate. In case of PDFCalculator the F(Q) is obtained by
inverse Fourier transformation from G(r) and for DebyePDFCalculator
it is calculated using the Debye Scattering Equation (DSE). Because
crystals are infinite the total summation should give delta
functions at Qhkl values corresponding to Bragg reflections and
with amplitudes equal to squared structure factors Fhkl. Both Debye
and real-space PDF calculators however cut off the DSE summation at
a distance rmax from central atom which imposes large termination
ripples to the obtained F(Q). The Bragg reflections can be
recognized as increased oscillations, but the values in between
are very jagged. Note that rmax cutoff is different from setting
a spherical shape correction to infinite crystal.
Sphere has some atoms close to the surface and these then
have different DSE contribution than atoms in the center.
For rmax cutoff the summation includes only DSE contribution
of the center atom with respect to all other atoms inside the
sphere, and this causes increased ripples. See the attached
figure for a comparison of these results.

If you need to simulate S(Q) for a finite molecule, say for
a SAS simulation, it is better to use the DebyePDFCalculator
because it includes scattering factor dependency f_i(Q).
Some time ago I needed similar calculations and wrote up
a prototype SASCalculator, which derives from DSE results in
DebyePDFCalculator. I have reviewed that code a bit and put
it up on GitHub at https://github.com/pavoljuhas/sascalculator.git.
The SASCalculator is more convenient for S(Q) calculation than
DebyePDFCalculator, because it avoids zero-division issues near Q=0.
It also calculates F(Q), I(Q) and I_total(Q) in its respective
attributes fq, iq, iqtot. That said for periodic structures
it has the same rmax cutoff oscillations as other PDF calculators.

I hope this clarifies the matter.
Let me know if you have any comments or suggestions for the
SASCalculator; if I get some time, I plan to add it to srreal.

Best,

Pavol

--
Dr. Pavol Juhas
Computational Science Initiative
Brookhaven National Laboratory
P.O. Box 5000
Upton, NY 11973-5000
dbsqcompare.py.txt
dbsqcompare.pdf

Ben Frandsen

unread,
May 18, 2019, 4:59:49 AM5/18/19
to diffpy-users
Thanks, Pavol. This is helpful. I'll take a look at the SASCalculator.


On Tuesday, June 5, 2018 at 3:54:27 PM UTC-6, Chenyang Shi wrote:
Reply all
Reply to author
Forward
0 new messages