Commit 221d2fd
fix(diffraction): correct reciprocal lattice cross terms in get_interplanar_angle (#4685)
get_interplanar_angle computes each plane's reciprocal vector norm and
their dot product using the standard triclinic metric formulas. The
k*l cross term in both r1_norm and r2_norm used cos_gamma_star instead
of cos_alpha_star, and the h*l cross term in the dot product indexed
p1[1] instead of p1[2]. Since a, b, c* worth of terms cancel out
whenever two of the lattice angles are 90 degrees, this was invisible
on the existing cubic/tetragonal/hexagonal test fixtures and only
shows up for genuinely triclinic or low-symmetry monoclinic
structures, where it silently returns the wrong angle.
Added a regression test against an independently computed reference
using the crystallographic reciprocal lattice directly on a triclinic
cell with three distinct angles.
Signed-off-by: Mike German <mike@stepsventures.com>
Co-authored-by: Shyue Ping Ong <shyuep@users.noreply.github.com>1 parent 777b616 commit 221d2fd
2 files changed
Lines changed: 27 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
220 | 244 | | |
221 | 245 | | |
222 | 246 | | |
| |||
0 commit comments