Skip to content

Simplify BZPath API with KPointSet#168

Merged
Alphaharrius merged 10 commits into
mainfrom
bugfix/interpolate-transform
May 23, 2026
Merged

Simplify BZPath API with KPointSet#168
Alphaharrius merged 10 commits into
mainfrom
bugfix/interpolate-transform

Conversation

@eyjafjallac

@eyjafjallac eyjafjallac commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Refactors waypoint handling to use KPointSet only (named points + reciprocal-space context).
  • Removes interpolate_reciprocal_path and consolidates path generation to a single API:
    • interpolate_path(recip, waypoints: Sequence[str], points: KPointSet, n_points=100)
  • Interpolation now resolves named points from KPointSet, rebases to target recip.
  • Updates plot/docs references to point to qten.bands.interpolate_path.

Migration

Before:

path = Q.interpolate_path(
    recip,
    ["Gamma", "X"],
    n_points=200,
    points={"Gamma": (0, 0, 0), "X": (0.5, 0, 0.5)},
)

After:

kpts = Q.KPointSet.from_points(
    recip_src,
    {"Gamma": (0, 0, 0), "X": (0.5, 0, 0.5)},
)
path = Q.interpolate_path(recip_dst, ["Gamma", "X"], kpts, n_points=200)

Validation

  • Updated tests/test_bands.py and tests/test_plots.py.
  • Updated docs/usages referencing the old symbolic path API.
  • All affected tests pass.

…_reciprocal_path`

Enhance the `interpolate_path` and `interpolate_reciprocal_path` functions to accept an optional `waypoint_transform` parameter, allowing for basis transformations of waypoint fractional coordinates before interpolation. Update documentation to reflect these changes and ensure proper error handling for invalid transform types and shapes. Add tests to verify the correct application of transforms and error conditions.
Consolidate multi-line function calls into single lines in the `test_interpolate_path` tests to enhance code clarity. This change simplifies the test structure while maintaining functionality and readability.
@eyjafjallac eyjafjallac added this to the v0.4.1-qten milestone May 22, 2026
@eyjafjallac eyjafjallac self-assigned this May 22, 2026
@eyjafjallac eyjafjallac added the bug Something isn't working label May 22, 2026
@eyjafjallac eyjafjallac requested a review from Alphaharrius May 22, 2026 10:24
…`KPointSet`

Update the `interpolate_path` and `interpolate_reciprocal_path` functions to accept a `KPointSet` for waypoint resolution, enhancing clarity and functionality. Remove support for direct fractional coordinates and associated parameters, streamlining the interface. Update documentation and tests to reflect these changes, ensuring proper error handling for invalid input types and maintaining backward compatibility where necessary.
@eyjafjallac eyjafjallac changed the title Add waypoint transform support to path interpolation APIs Simplify BZ path API with KPointSet May 22, 2026
This commit removes the `interpolate_reciprocal_path` function and its associated references from the codebase, including imports and documentation. The `interpolate_path` function has been updated to handle waypoint interpolation directly, ensuring that all relevant functionality is preserved. Tests have been adjusted accordingly to reflect these changes, enhancing clarity and maintaining functionality.
This commit consolidates multi-line list comprehensions and function calls into single lines across several files, enhancing code clarity. The changes include adjustments in `bands.py`, `ops.py`, `state_space.py`, and `test_bands.py`. These modifications aim to streamline the code structure while maintaining existing functionality and improving overall readability.
@eyjafjallac eyjafjallac changed the title Simplify BZ path API with KPointSet Simplify BZPath API with KPointSet May 22, 2026
…iable

This commit updates the test cases in `test_bands.py` to utilize a `waypoints` variable instead of hardcoded lists for improved readability and maintainability. The changes ensure that all instances of waypoint lists are consistently defined, enhancing clarity in the tests while preserving existing functionality.

@Alphaharrius Alphaharrius left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address

Comment thread src/qten/symbolics/state_space.py Outdated
Comment thread src/qten/symbolics/state_space.py Outdated
Comment thread src/qten/bands.py Outdated
This commit introduces the `KPointSet` class, which encapsulates named high-symmetry momentum points associated with a reciprocal lattice. The class provides methods for creating a point set from momentum values or fractional coordinates, rebasing points in a new reciprocal lattice, and resolving momentum by name. Additionally, the `KPointSet` is imported in the `geometries` module, while its previous references in the `symbolics` module have been removed to streamline the codebase.
This commit modifies the `KPointSet` references in the `bands.py`, `spatials.py`, and `spatials.pyi` files to ensure consistency and clarity. The type annotations for the `from_points` method have been updated to use `sy.Rational` instead of `float`, enhancing type safety. Additionally, the `resolve` method has been removed from `KPointSet`, with its functionality replaced by direct access to the `points` attribute in the test cases, streamlining the code and improving readability.

@Alphaharrius Alphaharrius left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Alphaharrius Alphaharrius merged commit 3729807 into main May 23, 2026
1 check passed
@Alphaharrius Alphaharrius deleted the bugfix/interpolate-transform branch May 23, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interpolate_path and interpolate_reciprocal_path ignore waypoint transform information

2 participants