Skip to content

Refactored the code#22

Merged
kousuke-nakano merged 6 commits into
mainfrom
devel-refactor
Feb 12, 2026
Merged

Refactored the code#22
kousuke-nakano merged 6 commits into
mainfrom
devel-refactor

Conversation

@kousuke-nakano

Copy link
Copy Markdown
Contributor
  • CIF reader backend update: Replaced CIF read path from pymatgen.io.cif to PyCifRW (CifFile) for CIF parsing.

  • Refactored symmetry detection: Changed from pymatgen's internal SpacegroupAnalyzer to direct spglib calls for improved transparency and control over symmetry operations.

    • Added helper functions: structure_to_spglib_cell(), get_symmetry_operations_from_spglib(), and get_symmetrized_structure_from_spglib()
    • Removed dependency on PatchedSpacegroupAnalyzer class
    • Symmetry information is now obtained directly from spglib's dataset
  • Parallel tree search: Tree search now supports dynamic parallel execution using Python multiprocessing.

    • Added n_jobs parameter to Substitutor and PatternMaker classes (default: -1, uses all CPU cores)
    • Parallelization is applied at subtree level for both _invarless_search and _invar_search
    • Adaptive depth expansion: subtree seeds are expanded until enough splits are prepared (target = max(n_cores * 8, 32)) or depth limit is reached (max_depth <= 10, and bounded by stop)
    • Dynamic load balancing: worker tasks are scheduled with multiprocessing.Pool(...).imap_unordered(..., chunksize=1)
    • Progress reporting: parallel mode reports subtree processing progress (Processing subtrees), while sequential mode reports pattern generation progress (Making patterns)
    • Logging includes expansion and mode details, e.g. Expanding to depth ... and Parallel search (dynamic): ...

@kousuke-nakano
kousuke-nakano merged commit 77b50a7 into main Feb 12, 2026
3 checks passed
@kousuke-nakano
kousuke-nakano deleted the devel-refactor branch February 13, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant