# Cc

Dear all,
I am going to compute the static structure factor S(k) to characterize the decrease in the degree of crystalline order. S(k)=1/M abs(sigma(exp(-ikrij)). S(k) will be a number between 1 to zero that shows the order of crystalinity. I don’t know how I can compute S(k) in my Lammps code or I have to use other software. Thanks in advance. Any response would be appreciated.

All features that are available in LAMMPS are listed in the manual: 5. Commands — LAMMPS documentation
If you don’t see what you are looking for there, then you will have to post-process your simulation data with a different tool.

Structure factor can be calculated from the Fourier transform of the radial distribution function, which can be calculated using LAMMPS, see https://docs.lammps.org/compute_rdf.html.

Thank you so much for your quick response. I am not very familiar with RDF and Fourier transform. I read about them and if I have more questions, I will bother you again.
Many thanks

Thanks a lot for your reply. I couldn’t find any tools for computing the static structure factor. Do you know any? Thanks.

The last time that I have done this was a quarter century ago for this publication Long-range Structures in Bulk Water. A Molecular Dynamics Study

As you can see from the formula in the paper, this was done by taking h(r) = g(r) - 1 and doing a sine transform. If I remember correctly (but it has been an awful long time ago), I would take the interval of -rcut to rcut and fill the negative part with -h(-r) and the positive part with h(r). r=rcut and r=-rcut would be the same point. This is easy to do with scripting because there is little data, so the FFTs don’t need to be fast.

Dear Simongravelle,
As you recommend I computed RDF and its Fourier transform for a perfect fcc Al small lattice structure. The Lammps data file, its RDF and its FFT are attached. Would you please kindly let me know how I can obtain static structure factor? I expect that S(k) will be equal to 1 because the structure is perfect and ordered. Your kelp in this regard is highly appreciated.
Thanks,
Masoud
Model.dat (5.2 KB)

RDF.txt (1.1 KB)

See the following paper
K. Zhang, On the Concept of Static Structure Factor, arXiv:1606.03610 (2016)

The code is also available on the author’s website

1 Like

Hello. Thank you very much for telling me about this useful paper and website. I run the gr.c code but the code sq.c file did not run and there is an error in it. Did you run the codes before?
Many thanks

I have not, no. I wrote a Python script instead.
https://github.com/Tj-Barrett/LAMMPS-Tools/tree/main/Static-Structure-Factor

Thanks a lot for your help. I will see your Python script. I have a layer of SiC and a layer of Al. After diffusion, I am going to slice the model into small thicknesses and for each sliced region compute S(k). Do you think your code can compute for each region S(k)? Many thanks

Yea it should be able to do that fine. It iterates over ‘prefix’, so so long as your files have a standard naming convention like ‘file-1-1.txt’, ‘file-1-2.txt’, etc. and you make the prefix a list of those, ie [‘file-1-1’, ‘file-1-2’], it will plot all on the same window.

If you want them separate just keep the prefix as a single name and modify it, or just modify the script to plot and save each one independently from the method above

Dear Barrett,

Thanks a lot for your explanation. I run your Python code, but I don’t know how I could obtain S(k) as a number (1 for a perfect crystal lattice and goes to zero for an unordered structure). Sorry, maybe my questions are elementary. I am a mechanical engineer and do not know much about this field. I attached a paper in this regard as well
Structure static factor.pdf (2.2 MB)
.
Many many thanks