pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

Wrong equation in analysis/diffraction/tem.py get_interplanar_angle

Open EurusWei opened this issue 2 years ago • 3 comments

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_star2 + p1[1] ** 2 * b_star2 + 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_star2 + p2[1] ** 2 * b_star2 + 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_star2 + p1[1] * p2[1] * b_star2 + 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):

  • OS: (e.g. Mac)
  • Version (e.g. 2020.07) Screen Shot 2022-12-19 at 11 11 09 AM

EurusWei avatar Dec 19 '22 17:12 EurusWei

@mkhorton Pls assign to Jason or Frank.

shyuep avatar Dec 19 '22 18:12 shyuep

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

mkhorton avatar Dec 20 '22 23:12 mkhorton

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

mkhorton avatar Dec 20 '22 23:12 mkhorton