orientational correlation functions

Dear LAMMPS users ,

I want to calculate orientational correlation function with using of compute hexorder/atom command
I tried to extract this command’s results with fix ave/atom and dump commands .

compute ord all hexorder/atom

fix f5 all ave/atom 10 20 1000 c_ord[1] c_ord[2]

dump 9 all custom 1000 B_order.data id type x y f_f5[1]
​ ​

​Can you please let me know How I can calculate orientational correlation function ?
From Dump file I have atom type x and y and complex and real part of qn !
​ ​



You would have to post-process it, I think. The idea is that you determine for all atom pairs i and j the distance between them, and then you compute the product of the local bond orientation of i times the complex conjugate of the bond orientation of j, say psi_ij, store that number together with the distance, and then in the end, you construct a histogram as function of r with in each bin the average value of psi_ij for that distance. You might be able to do it on the fly by writing a compute similar to compute rdf and leveraging the psi_ij computations to a ComputeHexOrderAtom class.


Yes, this is best done as a post-processing step. I will consider adding something based on compute rdf, but it is not going to happen anytime soon.


Dear Stefan and Aidan , thanks for your reply .

I can determine for all atom pairs i and j the distance between them by this commands :

compute dis all pair/local dist
compute prop all property/local patom1 patom2
dump 8 all local 1000 distance.dump index c_prop[1] c_prop[2] c_dis

But now I don’t know how I can attribute the hexorder/atom results to this !

compute ord all hexorder/atom

dump 9 all custom 1000 B_order.data id type x y c_ord[1] c_ord[2]

I will be grateful if you can help me .



You can certainly use pair/local dist in this way to generate all the pair distances, although it is rather inefficient to writeall that data to file and then read it again. And you still need to write post-processing code to read distance.dump and combine it with information from the second file B_order.dump.

Your question about how to “attribute” is not clear, but I think the answer in pseudocode is:

distances = get_distances(“distance.dump”)
psilist = get_psilist(“B_order.dump”)

for each (i,j,rij) in distances:
(pi_r,pi_i) = psilist[i]

(pj_r,pj_i) = psilist[j]

g_r = pi_rpj_r + pi_ipj_i
g_i = pi_ipj_r - pi_rpi_i

bin = get_bin(rij)
gsum_r[bin] += g_r
gsum_i[bin] += g_i



Dear Aidan ,
Thanks for your reply .
For a dump file with just one TIME STEP and with this format ( for 2D systems ):


… …
… …
… …
ITEM: ATOMS id x y c_ord[1] c_ord[2]
… … … … …
I could write a Python code , but it is so slow .
I have attached the code with this Email.
I am completely beginner in programming and now I just want to know is this code acceptable or not ?

Thanks for your attention.


hexorder2D.py (1 KB)

You should try using pizza.py functionalities if you need to post-process lammps dumps.


First focus on getting the right answer, then you can worry about
correctness. It is not possible for me to tell if your Python script
is correct just by looking at it. You will have to confirm that it is
correct by checking if the output seems reasonable and also by running
simple test cases where you know the right answer.

It is true that Pizza.py can make the process quite a bit easier.


2015-11-28 8:44 GMT-07:00 Arthur France-Lanord <[email protected]...>: