Skip to content

Fixed: empty structure container crashes when writing to file

Just a minor change to prevent StructureContainer.write crash when saving an empty container.

Users are allowed to save an empty structure container to file, which StructureContainer.read is able to read:

from icet import ClusterSpace, StructureContainer
from ase.build import bulk


prim = bulk("Al")
cs = ClusterSpace(prim, cutoffs=[5], chemical_symbols=['Al', 'Ge'])
sc = StructureContainer(cs)
sc.write('whatever.sc')

sc_read = StructureContainer.read('whatever.sc')
print(sc)
>>> python3 above_script.py
>>> Empty StructureContainer

Closes #254 (closed)

Merge request reports