From 0c9072088752165c6a2b059d6e9fdaea7405c9eb Mon Sep 17 00:00:00 2001 From: lan496 Date: Mon, 13 Jul 2026 20:27:40 +0900 Subject: [PATCH] fix: swap arithmetic crystal class numbers 56/57 for SG 187-190 Per International Tables for Crystallography, Volume C (2004), Table 1.4.2.1, arithmetic crystal class -6m2P is No. 56 and -62mP is No. 57. Moyo had the numbers reversed, so space groups 187/188 reported arithmetic number 57 and 189/190 reported 56. The internal number<->symbol linkage was consistent, so identification results and the reported symbols were already correct; only the exposed numbers change. Same fix as spglib/spglib#632. Co-Authored-By: Claude --- CHANGELOG.md | 6 +++++ moyo/src/data/arithmetic_crystal_class.rs | 4 +-- moyo/src/data/hall_symbol_database.rs | 31 ++++++++++++++++++++--- moyo/src/data/point_group.rs | 4 +-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f614a92..bff03ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Unlisted patch versions (e.g. v0.7.1, v0.7.3, v0.7.6, v0.7.7) contain only dependency or build updates with no user-visible changes. +## Unreleased + +### moyo + +- Fix swapped arithmetic crystal class numbers 56 and 57 for space groups 187-190: `-6m2P` is No. 56 and `-62mP` is No. 57 per International Tables for Crystallography, Volume C (2004), Table 1.4.2.1. The symbols reported for these space groups were already correct; only the numbers exposed via `MoyoDataset` and `moyopy.SpaceGroupType.arithmetic_number` change. Same fix as spglib/spglib#632 (#398) + ## v0.14.0 - 2026-07-04 ### moyo diff --git a/moyo/src/data/arithmetic_crystal_class.rs b/moyo/src/data/arithmetic_crystal_class.rs index b5b34a6e..ed41b820 100644 --- a/moyo/src/data/arithmetic_crystal_class.rs +++ b/moyo/src/data/arithmetic_crystal_class.rs @@ -110,8 +110,8 @@ const ARITHMETIC_CRYSTAL_CLASS_DATABASE: [ArithmeticCrystalClassEntry; 73] = [ ArithmeticCrystalClassEntry::new(53, "6/mP", GeometricCrystalClass::C6h, BravaisClass::hP), ArithmeticCrystalClassEntry::new(54, "622P", GeometricCrystalClass::D6, BravaisClass::hP), ArithmeticCrystalClassEntry::new(55, "6mmP", GeometricCrystalClass::C6v, BravaisClass::hP), - ArithmeticCrystalClassEntry::new(56, "-62mP", GeometricCrystalClass::D3h, BravaisClass::hP), - ArithmeticCrystalClassEntry::new(57, "-6m2P", GeometricCrystalClass::D3h, BravaisClass::hP), + ArithmeticCrystalClassEntry::new(56, "-6m2P", GeometricCrystalClass::D3h, BravaisClass::hP), + ArithmeticCrystalClassEntry::new(57, "-62mP", GeometricCrystalClass::D3h, BravaisClass::hP), ArithmeticCrystalClassEntry::new(58, "6/mmmP", GeometricCrystalClass::D6h, BravaisClass::hP), // Crystal system: cubic ArithmeticCrystalClassEntry::new(59, "23P", GeometricCrystalClass::T, BravaisClass::cP), diff --git a/moyo/src/data/hall_symbol_database.rs b/moyo/src/data/hall_symbol_database.rs index 2b43cad1..a0d093ef 100644 --- a/moyo/src/data/hall_symbol_database.rs +++ b/moyo/src/data/hall_symbol_database.rs @@ -3874,7 +3874,7 @@ static HALL_SYMBOL_DATABASE: [HallSymbolEntry; 530] = [ HallSymbolEntry::new( 481, 187, - 57, + 56, "", "P -6 2", "P -6 m 2", @@ -3884,7 +3884,7 @@ static HALL_SYMBOL_DATABASE: [HallSymbolEntry; 530] = [ HallSymbolEntry::new( 482, 188, - 57, + 56, "", "P -6c 2", "P -6 c 2", @@ -3894,7 +3894,7 @@ static HALL_SYMBOL_DATABASE: [HallSymbolEntry; 530] = [ HallSymbolEntry::new( 483, 189, - 56, + 57, "", "P -6 -2", "P -6 2 m", @@ -3904,7 +3904,7 @@ static HALL_SYMBOL_DATABASE: [HallSymbolEntry; 530] = [ HallSymbolEntry::new( 484, 190, - 56, + 57, "", "P -6c -2c", "P -6 2 c", @@ -4349,6 +4349,7 @@ static HALL_SYMBOL_DATABASE: [HallSymbolEntry; 530] = [ #[cfg(test)] mod tests { use super::{HALL_SYMBOL_DATABASE, HallSymbolEntry}; + use crate::data::arithmetic_crystal_class::arithmetic_crystal_class_entry; use crate::data::hall_symbol::HallSymbol; fn iter_hall_symbol_entry() -> impl Iterator { @@ -4362,4 +4363,26 @@ mod tests { assert_eq!(48 % hs.traverse().len(), 0); } } + + #[test] + fn test_arithmetic_crystal_class_for_sg_187_to_190() { + // International Tables for Crystallography, Volume C (2004), Table 1.4.2.1 + let expected = [ + (187, 56, "-6m2P"), + (188, 56, "-6m2P"), + (189, 57, "-62mP"), + (190, 57, "-62mP"), + ]; + for (number, arithmetic_number, symbol) in expected { + for entry in iter_hall_symbol_entry().filter(|entry| entry.number == number) { + assert_eq!(entry.arithmetic_number, arithmetic_number); + assert_eq!( + arithmetic_crystal_class_entry(entry.arithmetic_number) + .unwrap() + .symbol, + symbol + ); + } + } + } } diff --git a/moyo/src/data/point_group.rs b/moyo/src/data/point_group.rs index bdd1fe3f..91e04689 100644 --- a/moyo/src/data/point_group.rs +++ b/moyo/src/data/point_group.rs @@ -134,8 +134,8 @@ impl PointGroupRepresentative { 53 => 469, 54 => 471, 55 => 477, - 56 => 483, - 57 => 481, + 56 => 481, + 57 => 483, 58 => 485, // Cubic 59 => 489,