Skip to content

Commit b4df654

Browse files
author
jrudz
committed
errors to warnings
1 parent 85ff9f1 commit b4df654

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/nomad_simulations/schema_packages/model_system.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,16 +450,26 @@ def to_ase_atoms(self, logger: 'BoundLogger') -> 'Optional[ase.Atoms]':
450450

451451
labels = self.get('labels', logger)
452452
if labels is None:
453-
logger.error('Could not find `Cell.state.labels`.')
453+
# ! Check the scope of this message
454+
logger.error(
455+
'Could not find `Cell.state.labels`.'
456+
'Using ase functionalities with `X` as labels.'
457+
'This is normal for non-atomic particles,'
458+
'but no particle labels will be stored.'
459+
)
454460
labels = ['X'] * len(self.positions) if self.positions is not None else None
455461
# Initialize ase.Atoms object with labels
456462
# ! We need to make sure that the labels from ase.Atoms are not being used downstream!
457-
458-
try:
459-
symbols2numbers(labels)
460-
except KeyError:
461-
logger.error('Non chemical symbols in `Cell.state.labels`.')
462-
labels = ['X'] * len(labels)
463+
else:
464+
try:
465+
symbols2numbers(labels)
466+
except KeyError:
467+
logger.warning(
468+
'Non chemical symbols in `Cell.state.labels`.'
469+
'Using ase functionalities with `X` as labels.'
470+
'This is normal for non-atomic particles.'
471+
)
472+
labels = ['X'] * len(labels)
463473
ase_atoms = ase.Atoms(symbols=labels)
464474

465475
# PBC

0 commit comments

Comments
 (0)