From b4df65417d6fd0cc3303ead420c7efeacc18fa86 Mon Sep 17 00:00:00 2001 From: jrudz Date: Tue, 10 Dec 2024 09:32:38 +0100 Subject: [PATCH] errors to warnings --- .../schema_packages/model_system.py | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/nomad_simulations/schema_packages/model_system.py b/src/nomad_simulations/schema_packages/model_system.py index 1c311b66..eecc1afb 100644 --- a/src/nomad_simulations/schema_packages/model_system.py +++ b/src/nomad_simulations/schema_packages/model_system.py @@ -450,16 +450,26 @@ def to_ase_atoms(self, logger: 'BoundLogger') -> 'Optional[ase.Atoms]': labels = self.get('labels', logger) if labels is None: - logger.error('Could not find `Cell.state.labels`.') + # ! Check the scope of this message + logger.error( + 'Could not find `Cell.state.labels`.' + 'Using ase functionalities with `X` as labels.' + 'This is normal for non-atomic particles,' + 'but no particle labels will be stored.' + ) labels = ['X'] * len(self.positions) if self.positions is not None else None # Initialize ase.Atoms object with labels # ! We need to make sure that the labels from ase.Atoms are not being used downstream! - - try: - symbols2numbers(labels) - except KeyError: - logger.error('Non chemical symbols in `Cell.state.labels`.') - labels = ['X'] * len(labels) + else: + try: + symbols2numbers(labels) + except KeyError: + logger.warning( + 'Non chemical symbols in `Cell.state.labels`.' + 'Using ase functionalities with `X` as labels.' + 'This is normal for non-atomic particles.' + ) + labels = ['X'] * len(labels) ase_atoms = ase.Atoms(symbols=labels) # PBC