Skip to content

bsym 2.2.0

Latest

Choose a tag to compare

@bjmorgan bjmorgan released this 21 Feb 13:18
3c96806

bsym v2.2.0

Bug fixes, correctness improvements, and performance optimisations.


Bug Fixes

  • Mutable default argument in SymmetryGroup.__init__: all instances shared the same list, risking cross-contamination between groups.
  • Stale caches after extend()/append(): unique_index_mappings and stacked_index_mappings are now invalidated when operations are added.
  • Infinite loop risk in random_unique_configurations: added a max_attempts parameter (default 1000) with RuntimeError when the configuration space appears exhausted.
  • Uniform sampling failure counter: rejection by the acceptance test no longer counts as a failure to find a novel configuration, preventing spurious RuntimeError for highly degenerate configurations.
  • Wrong class_str in SpaceGroup: was 'SymmetryGroup' instead of 'SpaceGroup'.
  • bsym.bsym called sys.exit() on import; replaced with raise ImportError(...).
  • SymmetryGroup.__mul__ lost subclass type: SpaceGroup * SpaceGroup returned a plain SymmetryGroup; now preserves the left operand's type.

Performance Optimisations

  • Matrix transpose for permutation inversion instead of np.linalg.inv.
  • np.argmax for index_mapping and as_vector instead of Python loops.
  • Set-based deduplication of symmetry operation vectors in the pymatgen interface.
  • Vectorised apply_species_mapping using numpy fancy indexing.
  • End-to-end: 3.9x speedup on ternary composition enumeration, 2.4x on random sampling.

Code Hygiene

  • Fixed type annotations for cache fields and labels property in SymmetryGroup.
  • Updated SymmetryOperation.__init__ docstring to document deprecated np.matrix acceptance.
  • Removed outdated docstrings referencing numpy.matrix subclassing.
  • Removed unused imports and duplicate permutation_as_config_number function.
  • Simplified SymmetryOperation.__init__ type checking.
  • Replaced deprecated tqdm_notebook with tqdm.auto.

CI

  • Build workflow now triggers only on pull requests (main is a protected branch).

Breaking Changes

  • permutation_as_config_number (module-level function in configuration_space) has been removed.
  • Importing bsym.bsym now raises ImportError instead of calling sys.exit().