qzhu2017 / XRD

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

Similarity function #12

Closed qzhu2017 closed 4 years ago

qzhu2017 commented 4 years ago

@sayred1 Have you done the similarity function. Do you need any help?

sayred1 commented 4 years ago

Could we have a quick video chat?

On Wed, Jan 8, 2020 at 8:12 PM Qiang Zhu notifications@github.com wrote:

@sayred1 https://github.com/sayred1 Have you done the similarity function. Do you need any help?

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

sayred1 commented 4 years ago

So I've been working on it all day, going through the math and trying to translate it to code, but there's something I'm doing wrong. I met up with David for some help with the math. We got to a point where the integrals that need to be solved cannot be solved analytically, only numerically. I've attempted to translate it into code, but the result isn't correct. I think there may be some terms from the literature that I am not understanding.

When you are available, can we have a video call, so I can get your help to get this done and move on to the next step? Let me know the best time for you.

On Wed, Jan 8, 2020 at 9:01 PM Dean Lewis Sayre Jr. < notifications@github.com> wrote:

Could we have a quick video chat?

On Wed, Jan 8, 2020 at 8:12 PM Qiang Zhu notifications@github.com wrote:

@sayred1 https://github.com/sayred1 Have you done the similarity function. Do you need any help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD2OQV3WUKS2WNXPYRDQ42P3BA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IE6FIYQ , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIPGLDZQZUX5TBGNXQDK7QDQ42P3BANCNFSM4KESF24Q

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD6SPS5I5QGLVSYQ2U3Q42VTNA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIO7FKA#issuecomment-572388008, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPGLD7IGODQIYR75KDU5X3Q42VTNANCNFSM4KESF24Q .

qzhu2017 commented 4 years ago

Do you want to do meeting now?

On Thu, Jan 9, 2020 at 12:07 AM Dean Lewis Sayre Jr. < notifications@github.com> wrote:

So I've been working on it all day, going through the math and trying to translate it to code, but there's something I'm doing wrong. I met up with David for some help with the math. We got to a point where the integrals that need to be solved cannot be solved analytically, only numerically. I've attempted to translate it into code, but the result isn't correct. I think there may be some terms from the literature that I am not understanding.

When you are available, can we have a video call, so I can get your help to get this done and move on to the next step? Let me know the best time for you.

On Wed, Jan 8, 2020 at 9:01 PM Dean Lewis Sayre Jr. < notifications@github.com> wrote:

Could we have a quick video chat?

On Wed, Jan 8, 2020 at 8:12 PM Qiang Zhu notifications@github.com wrote:

@sayred1 https://github.com/sayred1 Have you done the similarity function. Do you need any help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <

https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD2OQV3WUKS2WNXPYRDQ42P3BA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IE6FIYQ

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AIPGLDZQZUX5TBGNXQDK7QDQ42P3BANCNFSM4KESF24Q

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD6SPS5I5QGLVSYQ2U3Q42VTNA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIO7FKA#issuecomment-572388008 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AIPGLD7IGODQIYR75KDU5X3Q42VTNANCNFSM4KESF24Q

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AHAUZ5UPZFXSYKYOGYSGQK3Q43LMRA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIPMHLI#issuecomment-572441517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHAUZ5TIL2YA4SZX7OJ5353Q43LMRANCNFSM4KESF24Q .

--

*Qiang Zhu, *Assistant Professor 4505 S. Maryland Parkway, Room 232, Department of Physics and Astronomy, University of Nevada Las Vegas NV 89154-4002

Phone: 702-895-1707 Fax: 702-895-0804

Webpage: http://www.physics.unlv.edu/~qzhu http://uspex.stonybrook.edu/qzhu.html

sayred1 commented 4 years ago

sure

On Thu, Jan 9, 2020 at 11:55 AM Qiang Zhu notifications@github.com wrote:

Do you want to do meeting now?

On Thu, Jan 9, 2020 at 12:07 AM Dean Lewis Sayre Jr. < notifications@github.com> wrote:

So I've been working on it all day, going through the math and trying to translate it to code, but there's something I'm doing wrong. I met up with David for some help with the math. We got to a point where the integrals that need to be solved cannot be solved analytically, only numerically. I've attempted to translate it into code, but the result isn't correct. I think there may be some terms from the literature that I am not understanding.

When you are available, can we have a video call, so I can get your help to get this done and move on to the next step? Let me know the best time for you.

On Wed, Jan 8, 2020 at 9:01 PM Dean Lewis Sayre Jr. < notifications@github.com> wrote:

Could we have a quick video chat?

On Wed, Jan 8, 2020 at 8:12 PM Qiang Zhu notifications@github.com wrote:

@sayred1 https://github.com/sayred1 Have you done the similarity function. Do you need any help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <

https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD2OQV3WUKS2WNXPYRDQ42P3BA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IE6FIYQ

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AIPGLDZQZUX5TBGNXQDK7QDQ42P3BANCNFSM4KESF24Q

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AIPGLD6SPS5I5QGLVSYQ2U3Q42VTNA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIO7FKA#issuecomment-572388008

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AIPGLD7IGODQIYR75KDU5X3Q42VTNANCNFSM4KESF24Q

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/qzhu2017/XRD/issues/12?email_source=notifications&email_token=AHAUZ5UPZFXSYKYOGYSGQK3Q43LMRA5CNFSM4KESF242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIPMHLI#issuecomment-572441517 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHAUZ5TIL2YA4SZX7OJ5353Q43LMRANCNFSM4KESF24Q

.

--

*Qiang Zhu, *Assistant Professor 4505 S. Maryland Parkway, Room 232, Department of Physics and Astronomy, University of Nevada Las Vegas NV 89154-4002

Phone: 702-895-1707 Fax: 702-895-0804

Webpage: http://www.physics.unlv.edu/~qzhu http://uspex.stonybrook.edu/qzhu.html

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

sayred1 commented 4 years ago

@qzhu2017 I've finished up the similarity function and uploaded it to the repo, and ran a couple of tests.

  1. Load NaCl.cif for both patterns. Suspect that S = 1 for identical peak to peak comparisons, achieved by setting peak_num1 = peak_num2. Peak 1 and 2 overlap, meaning that S should be 1. This test succeeds for all identical peak to peak comparisons.

    Screen Shot 2020-01-09 at 4 03 27 PM
  2. Load NaCl.cif for pattern 1 and POSCAR-NaCl for pattern 2. The unit cell parameters in each file are slightly different, one would expect that the compared peaks are slightly different. Thus, S should be near 1, but not 1. Again, set peak_num1 = peak_num2. This test succeeds as expected, with S = 0.9610364078696204.

    Screen Shot 2020-01-09 at 4 14 00 PM
  3. Load NaCl.cif for pattern 1 and POSCAR-SrF as pattern 2. For peak-peak comparisons we should expect S to be very low for. This is true for all possible cases, peak_num1 = peak_num2 and peak_num1 not = peak_num2 . From the below plot, S = 1.00719745978192e-10.

    Screen Shot 2020-01-09 at 4 20 21 PM

I'm satisfied with these results, but I believe that we need a stronger benchmark (#10) . I was thinking about checking the results from https://onlinelibrary.wiley.com/doi/epdf/10.1002/1096-987X%28200102%2922%3A3%3C273%3A%3AAID-JCC1001%3E3.0.CO%3B2-0 but I'm having a hard time finding the structures they used.

I now need to code this into pxrd, and clean it up nicely. After this I will proceed with autograd. I'll also do my best to prepare for tomorrow's meeting, but because of my time delay, I might not be at the same pace with everyone.

qzhu2017 commented 4 years ago

@sayred1 Excellent. I think this is nice. I suggest you work on #10 from now. Hopefully, David will take the lead for tomorrow's discussion.

qzhu2017 commented 4 years ago

@sayred1 I checked your code, a couple of comments

sayred1 commented 4 years ago

@qzhu2017 I've fixed the similarity function as well as moved it into another python module. I've tested it for NaCl with two different fwhm values, 0.9 and 0.7, and obtained 0.98 for the similarity. I'll upload the script shortly.