qzhu2017 / PyXtal_ml

a Python3 library for ML modeling materials properties
MIT License
11 stars 1 forks source link

a bug in BOP #47

Closed qzhu2017 closed 5 years ago

qzhu2017 commented 5 years ago

@David-Zagaceta I noticed that there exists a bug in the bond order parameter calc. For NaCl, the first four atoms are equivalent. They should return the same results. But you see the 2nd number in the qw_series for atom 1 and 2 are different. Please fix this issue asap

qzhu@cms:/scratch/qzhu/github/PyXtal_ml/pyxtal_ml/descriptors$ python bond_order_params.py -c POSCARs/POSCAR-NaCl 
bond_order_params.py:76: ComplexWarning: Casting complex values to real discards the imaginary part
  return float(np.sum(q1*np.conjugate(q2)))
[[ 4.59381495e-17 -2.81584178e-02  7.72009938e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  3.03372715e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.60540884e-16 -1.44091792e-18
   7.18070331e-01  3.01407518e-02  3.78571193e-16 -1.39700044e-16
   4.11425368e-01  1.52564160e-02  5.99375599e-16  6.03663967e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  8.17406390e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.96368233e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.60638893e-16 -1.02806645e-18
   7.18070331e-01  3.01407518e-02  3.81349846e-16 -1.25248782e-16
   4.11425368e-01  1.52564160e-02  5.99227097e-16  7.22169401e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  8.03665665e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.96837331e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.82115348e-16 -9.72836723e-19
   7.18070331e-01  3.01407518e-02  3.85474658e-16 -1.72989429e-16
   4.11425368e-01  1.52564160e-02  5.98118812e-16  7.82250664e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  9.05876542e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.89962676e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.56941181e-16  0.00000000e+00
   7.18070331e-01  3.01407518e-02  3.73211073e-16 -1.13775913e-16
   4.11425368e-01  1.52564160e-02  5.96878535e-16  6.68980069e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  7.65647998e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.99893688e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.66454730e-16 -3.07906266e-18
   7.18070331e-01  3.01407518e-02  3.91991224e-16 -1.49241280e-16
   4.11425368e-01  1.52564160e-02  6.04876861e-16  6.40434954e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  8.88474250e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.95461933e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.56299165e-16 -1.29741383e-18
   7.18070331e-01  3.01407518e-02  3.67717983e-16 -1.13198929e-16
   4.11425368e-01  1.52564160e-02  5.98187807e-16  6.56140861e-16
   6.95502666e-01  1.15831953e-02]
 [ 3.53525080e-17  0.00000000e+00  7.88597060e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  3.00675996e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.74096457e-16 -1.76790361e-18
   7.18070331e-01  3.01407518e-02  3.77367346e-16 -1.61950379e-16
   4.11425368e-01  1.52564160e-02  5.98796693e-16  7.10296295e-16
   6.95502666e-01  1.15831953e-02]
 [ 4.59381495e-17 -2.81584178e-02  8.43191699e-17  0.00000000e+00
   7.63762616e-01  9.29351343e-02  2.92501848e-16  0.00000000e+00
   3.53553391e-01  1.64507509e-03  2.62248501e-16 -1.81665439e-18
   7.18070331e-01  3.01407518e-02  3.77818589e-16 -1.41862359e-16
   4.11425368e-01  1.52564160e-02  5.96288214e-16  6.17792040e-16
   6.95502666e-01  1.15831953e-02]] (8, 22)
qzhu2017 commented 5 years ago

@David-Zagaceta I tried another structure. Na8 1.0 6.848575 0.000000 -2.421337 -3.424288 5.931039 -2.421337 0.000000 0.000000 7.264011 Na 8 direct 0.446984 0.500000 0.000000 Na 0.000000 0.446984 0.500000 Na 0.500000 0.000000 0.946984 Na 0.000000 0.946984 0.500000 Na 0.500000 0.000000 0.446984 Na 0.946984 0.500000 0.000000 Na 0.553016 0.553016 0.553016 Na 0.053016 0.053016 0.053016 Na In this crystal, all Na atoms are supposed to be equivalent. Below is the output of q4 and w4. However, I can still find some tiny differences in the w values.

[[0.05904106 0.01381759]
 [0.05904107 0.01381754]
 [0.05904106 0.02397117]
 [0.05904107 0.01381757]
 [0.05904106 0.02397117]
 [0.05904106 0.01381758]
 [0.05904108 0.01381752]
 [0.05904108 0.01381754]] (8, 2)

I am not sure this is because of numerical errors. or just because w is not rotationally invariant?

David-Zagaceta commented 5 years ago

@qzhu2017/PyXtal_ml reply@reply.github.com

I can't find where there could possibly be numerical errors in the code. The formulae is easily translated from Steinhardts original paper. I will investigate this further once I finish the bispectrum optimization. Currently I am having issues with the clebsch gordon array. I'm going to modify my approach to match the LAAMPS source code for the CG coefficients as my approach isn't returning the correct values.

On Sun, Mar 3, 2019 at 11:58 PM Qiang Zhu notifications@github.com wrote:

@David-Zagaceta https://github.com/David-Zagaceta I tried another structure. Na8 1.0 6.848575 0.000000 -2.421337 -3.424288 5.931039 -2.421337 0.000000 0.000000 7.264011 Na 8 direct 0.446984 0.500000 0.000000 Na 0.000000 0.446984 0.500000 Na 0.500000 0.000000 0.946984 Na 0.000000 0.946984 0.500000 Na 0.500000 0.000000 0.446984 Na 0.946984 0.500000 0.000000 Na 0.553016 0.553016 0.553016 Na 0.053016 0.053016 0.053016 Na In this crystal, all Na atoms are supposed to be equivalent. Below is the output of q4 and w4. However, I can still find some tiny differences in the w values.

[[0.05904106 0.01381759] [0.05904107 0.01381754] [0.05904106 0.02397117] [0.05904107 0.01381757] [0.05904106 0.02397117] [0.05904106 0.01381758] [0.05904108 0.01381752] [0.05904108 0.01381754]] (8, 2)

I am not sure this is because of numerical errors. or just because w is not rotationally invariant?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/PyXtal_ml/issues/47#issuecomment-469153564, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad_kNR7_CGNbwTsb1AGkHsVjUIOI6rfmks5vTNImgaJpZM4bRUHY .

--

[image: UNLV Logo] http://unlv.edu/

David Zagaceta Research Assistant Physics University of Nevada, Las Vegas

zagaceta@unlv.nevada.edu david.zagaceta@unlv.edu Office: 702-774-1407 <17027741407>

unlv.edu • Twitter http://twitter.com/unlv • Facebook https://www.facebook.com/OfficialUNLV • Instagram http://instagram.com/unlv • YouTube https://www.youtube.com/unlvofficial