Skip to content

bsym 2.1.1

Choose a tag to compare

@bjmorgan bjmorgan released this 28 Nov 09:48
· 20 commits to main since this release
738f21a

bsym v2.1.1

bsym 2.1.1 adds support for generating random unique structures in batches, allowing workflows where structures are generated across multiple runs without duplicates.

Highlights

Batch Generation Workflow

Generate structures in batches while ensuring no duplicates across runs:

from bsym.interface.pymatgen import random_unique_structure_substitutions

# Batch 1
structures_1 = random_unique_structure_substitutions(
    parent_structure, 'Li', {'Na': 4, 'Li': 12},
    n=10,
    seed=42,
    output_file='batch_1.json',
)

# Batch 2 - excludes all structures from batch 1
structures_2 = random_unique_structure_substitutions(
    parent_structure, 'Li', {'Na': 4, 'Li': 12},
    n=10,
    seed=43,
    exclude_file='batch_1.json',
    output_file='batch_2.json',
)

# Batch 3 - excludes structures from both previous batches
structures_3 = random_unique_structure_substitutions(
    parent_structure, 'Li', {'Na': 4, 'Li': 12},
    n=10,
    seed=44,
    exclude_file=['batch_1.json', 'batch_2.json'],
    output_file='batch_3.json',
)

Configuration files are portable JSON, so batches can be generated on different machines as long as the number of sites to substitute is the same.


New Features

Batch Generation Support

  • exclude parameter for ConfigurationSpace.random_unique_configurations() to exclude previously generated configurations
  • exclude_file and output_file parameters for random_unique_structure_substitutions() to support batch workflows
  • exclude_file accepts a single path or list of paths

Configuration Serialisation

  • Configuration.to_dict() and Configuration.from_dict() methods
  • save_configurations() and load_configurations() utility functions for JSON file I/O

Documentation

  • Updated random_sampling.ipynb with batch generation workflow example