py4dstem / py4dstem/py4DSTEM

Incorrect mm2 auto wedge in Crystal.orientation_plan()

Open
#743 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
279
Forks
177
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
For an exact Pca2_1 structure with point group mm2:

crystal.orientation_plan(zone_axis_range="auto", ...)

uses:

"mm2": ["fiber", [0, 0, 1], [180.0, 90.0]]

This generates the range:

theta: 0° to 180°
phi: -45° to 45°
bounded by [1,-1,0] and [1,1,0].

However, the standard mm2 operations independently change the signs of x and y. Their images of this diagonal wedge cover only about 50% of the sphere.
A valid fundamental range is:

theta: 0° to 180°
phi: 0° to 90°
bounded by [100] and [010].

There is also a possible silent failure in symmetry_reduce_directions(): if every entry in in_range is False, np.argmax(in_range) returns 0 and selects an invalid operator.

To Reproduce
Using the Pca2_1 CIF(mp-685097):

import py4DSTEM
from pymatgen.core import Structure

structure = Structure.from_file("HfO2_symmetrized.cif")

crystal = py4DSTEM.process.diffraction.Crystal.from_pymatgen_structure(
structure,
conventional_standard_structure=False,
)

crystal.orientation_plan(
zone_axis_range="auto",
angle_step_zone_axis=5.0,
angle_step_in_plane=45.0,
accel_voltage=80e3,
calculate_correlation_array=False,
progress_bar=False,
)

print(crystal.pointgroup.get_point_group_symbol())
print(crystal.orientation_zone_axis_range)
print(crystal.symmetry_operators)

Output:

mm2

[[0, 0, 1],
[0.7071, -0.7071, 0],
[0.7071, 0.7071, 0]]

A full-sphere geometric coverage test gives approximately:

Current auto wedge: 50%
phi = 0° to 90°: 100%

Expected behavior
The automatically selected fundamental range should cover the complete sphere after applying the detected symmetry operators.
For standard-setting mm2, the expected range is an axis-aligned quadrant such as:

theta: 0° to 180°
phi: 0° to 90°

Also, symmetry_reduce_directions() should raise an error if no operator maps a direction into the selected range:
if not np.any(in_range):
raise RuntimeError("No symmetry operator maps this direction into the range.")

py4DSTEM version
0.14.17

GPU
Not GPU-related.

Screenshots

Additional context

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Pca2_1 example with the Crystal.orientation_plan() entry point, then inspect symmetry_reduce_directions() and the auto range selection for mm2. Verify the chosen range reaches complete spherical coverage under the listed symmetry operators, and confirm that directions with no valid mapping raise the specified error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.