qzhu2017 / XRD

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

Similarity check for two structures #26

Closed qzhu2017 closed 4 years ago

qzhu2017 commented 4 years ago

I just added the function to compute the XRDs for two structures and their similarity in 3a65f31

To run it you can go to scripts and do

$ python pxrd_comp.py -c [../dataset/NaCl.cif,../dataset/NaCl-POSCAR] -a [0,60]

This will generate a `1.html' file as follows

image

@sabaronett Can you try to enable this function in flask as well

@sayred1 The computed similarity is a bit funny. We can clearly find the two patterns are similar by eye. But the similarity is small. Need to check...

qzhu2017 commented 4 years ago

@sayred1 Have you looked into the code?

sayred1 commented 4 years ago

Yes, I have been looking into it today and am still looking for the fix. I will have updates when I finish.

On Mon, Feb 17, 2020 at 12:28 PM Qiang Zhu notifications@github.com wrote:

@sayred1 https://github.com/sayred1 Have you looked into the code?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/XRD/issues/26?email_source=notifications&email_token=AIPGLD2UOXXSSJ2W67AIH63RDLXNDA5CNFSM4KV7UKEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL7SPVI#issuecomment-587147221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPGLD6HDDCTGCV4J7Z3M5LRDLXNDANCNFSM4KV7UKEA .

qzhu2017 commented 4 years ago

@sayred1
I just checked it. The way which you compute S is totally wrong. I just updated the code with the correct formula (01795d003dc8cc17f08891a301edaf549ef18d0e). But it takes some time to compute it. Please add the numba to speed it up.

qzhu2017 commented 4 years ago

@sabaronett @sayred1 You should run the following script to have a sense how the similarity changes with shift values

 (base) qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/XRD$ python scripts/pxrd_comp.py -c [dataset/NaCl.cif,dataset/NaCl-POSCAR] -a [0,60] -l 1
/opt/anaconda3/lib/python3.7/site-packages/ase/io/cif.py:375: UserWarning:

crystal system 'cubic' is not interpreted for space group Spacegroup(225, setting=1). This may result in wrong setting!

PXRD Similarity 0.7313 with shift 1.0000
(base) qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/XRD$ python scripts/pxrd_comp.py -c [dataset/NaCl.cif,dataset/NaCl-POSCAR] -a [0,60] -l 2
/opt/anaconda3/lib/python3.7/site-packages/ase/io/cif.py:375: UserWarning:

crystal system 'cubic' is not interpreted for space group Spacegroup(225, setting=1). This may result in wrong setting!

PXRD Similarity 0.8684 with shift 2.0000
(base) qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/XRD$ python scripts/pxrd_comp.py -c [dataset/NaCl.cif,dataset/NaCl-POSCAR] -a [0,60] -l 3
/opt/anaconda3/lib/python3.7/site-packages/ase/io/cif.py:375: UserWarning:

crystal system 'cubic' is not interpreted for space group Spacegroup(225, setting=1). This may result in wrong setting!

PXRD Similarity 0.9418 with shift 3.0000
(base) qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/XRD$ python scripts/pxrd_comp.py -c [dataset/NaCl.cif,dataset/NaCl-POSCAR] -a [0,60] -l 4
/opt/anaconda3/lib/python3.7/site-packages/ase/io/cif.py:375: UserWarning:

crystal system 'cubic' is not interpreted for space group Spacegroup(225, setting=1). This may result in wrong setting!

PXRD Similarity 0.9376 with shift 4.0000
(base) qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/XRD$ python scripts/pxrd_comp.py -c [dataset/NaCl.cif,dataset/NaCl-POSCAR] -a [0,60] -l 5
/opt/anaconda3/lib/python3.7/site-packages/ase/io/cif.py:375: UserWarning:

crystal system 'cubic' is not interpreted for space group Spacegroup(225, setting=1). This may result in wrong setting!

PXRD Similarity 0.9973 with shift 5.0000