feat(moyo-wasm): space-group data-access wrappers#331
Merged
Conversation
Expose four lookup functions from moyo-wasm so JS/TS callers can query crystallographic data without constructing a Cell: - operations_from_number(number, setting, primitive) -> MoyoOperation[] - hall_symbol_entry(hall_number) -> MoyoHallSymbolEntry - space_group_type(number) -> MoyoSpaceGroupType - arithmetic_crystal_class(arithmetic_number) -> MoyoArithmeticCrystalClass Adds Tsify DTOs (MoyoSetting, MoyoCentering, MoyoHallSymbolEntry, MoyoArithmeticCrystalClass, MoyoSpaceGroupType) that mirror the moyopy API surface, plus a vitest suite covering all four functions.
Mirror the existing python and c groups so wasm-pack and vitest are discoverable via `just --list`.
Reflects the new operations_from_number / hall_symbol_entry / space_group_type / arithmetic_crystal_class wrappers.
lan496
marked this pull request as ready for review
May 18, 2026 12:08
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#[wasm_bindgen]data-access functions tomoyo-wasmso JS/TS callers can query crystallographic data without constructing aCell. They wrap the correspondingmoyo::datafunctions and mirror the moyopy API surface (SpaceGroupType,HallSymbolEntry,ArithmeticCrystalClass):operations_from_number(number, setting, primitive) -> MoyoOperation[]hall_symbol_entry(hall_number) -> MoyoHallSymbolEntryspace_group_type(number) -> MoyoSpaceGroupType(synthesized fromHallSymbolEntry+ArithmeticCrystalClassEntry, matchingPySpaceGroupType::new)arithmetic_crystal_class(arithmetic_number) -> MoyoArithmeticCrystalClassMoyoSetting,MoyoCentering,MoyoHallSymbolEntry,MoyoArithmeticCrystalClass,MoyoSpaceGroupType).MoyoSettingis a tagged enum exposing all threeSettingvariants (Spglib,Standard,HallNumber(i32)) — the existinganalyze_cell's string-basedsettingis left untouched and can be unified in a follow-up.JsValue::from_str(format!("moyo error: {:?}", err))pattern used byanalyze_cell, consolidated into amap_moyo_errhelper.Test plan
cd moyo-wasm && npm run build— wasm-pack builds clean; generatedpkg/moyo_wasm.d.tscontains the four new functions plusMoyoSetting/MoyoCentering/MoyoHallSymbolEntry/MoyoArithmeticCrystalClass/MoyoSpaceGroupType.cd moyo-wasm && npx vitest run— 41/41 tests pass (14 new intests/data.test.ts+ 27 existing intests/analyze_cell.test.ts).HallSymbolEntry(528)→ Fd-3c origin choice 2;ArithmeticCrystalClass(45)→3m1P/3m/hP;SpaceGroupType(221)andSpaceGroupType(167)reproducing the moyopy assertions.just prek— all pre-commit hooks green (cargo fmt, mdformat, typos, etc.).[Claude Code] Generated with Claude Code