Repository navigation
bsym 2.1.1
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
excludeparameter forConfigurationSpace.random_unique_configurations()to exclude previously generated configurationsexclude_fileandoutput_fileparameters forrandom_unique_structure_substitutions()to support batch workflowsexclude_fileaccepts a single path or list of paths
Configuration Serialisation
Configuration.to_dict()andConfiguration.from_dict()methodssave_configurations()andload_configurations()utility functions for JSON file I/O
Documentation
- Updated
random_sampling.ipynbwith batch generation workflow example