materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.46k stars 846 forks source link

Wrong equation in analysis/diffraction/tem.py get_interplanar_angle #2777

Open EurusWei opened 1 year ago

EurusWei commented 1 year ago

Describe the bug In the function get_interplnar_angle of module analysis/diffraction/tem.py, there are some typos that are circled in the attached screenshot and should be corrected as below.

To Reproduce

  1. r1_norm = np.sqrt( p1[0] * 2 a_star**2
    • p1[1] * 2 b_star**2
    • p1[2] * 2 c_star**2
    • 2 p1[0] p1[1] a_star b_star * cos_gamma_star
    • 2 p1[0] p1[2] a_star c_star * cos_beta_star
    • 2 p1[1] p1[2] b_star c_star * cos_alpha_star )
  2. r2_norm = np.sqrt( p2[0] * 2 a_star**2
    • p2[1] * 2 b_star**2
    • p2[2] * 2 c_star**2
    • 2 p2[0] p2[1] a_star b_star * cos_gamma_star
    • 2 p2[0] p2[2] a_star c_star * cos_beta_star
    • 2 p2[1] p2[2] b_star c_star * cos_alpha_star )
  3. r1_dot_r2 = ( p1[0] p2[0] a_star**2
    • p1[1] p2[1] b_star**2
    • p1[2] p2[2] c_star**2
    • (p1[0] p2[1] + p2[0] p1[1]) a_star b_star * cos_gamma_star
    • (p1[0] p2[2] + p2[0] p1[2]) a_star c_star * cos_beta_star
    • (p1[1] p2[2] + p2[1] p1[2]) b_star c_star * cos_alpha_star )

Screenshots Attached below.

Desktop (please complete the following information):

shyuep commented 1 year ago

@mkhorton Pls assign to Jason or Frank.

mkhorton commented 1 year ago

Tagging @welltemperedpaprika and @thefrankwan as original authors of this module.

mkhorton commented 1 year ago

@EurusWei, since you have suggested a fix, you are also welcome to submit a brief PR with your suggested change.