Skip to content

Commit 05e2908

Browse files
committed
modify get_chemical_symbols in ModelSystem
1 parent eab43be commit 05e2908

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/nomad_simulations/schema_packages/model_system.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,18 +1001,11 @@ def get_chemical_symbols(self, logger: 'BoundLogger') -> list[str]:
10011001
chemical_symbols = []
10021002
for particle_state in self.particle_states:
10031003
if isinstance(particle_state, AtomsState):
1004-
# only collect symbols from particle entries that are instances of AtomsState
1005-
if (
1006-
not particle_state.atom_definition_ref
1007-
or not particle_state.atom_definition_ref.chemical_symbol
1008-
):
1009-
logger.warning(
1010-
'Could not find `chemical_symbol` in an AtomsState entry.'
1011-
)
1004+
# Read directly from AtomsState.chemical_symbol
1005+
if particle_state.chemical_symbol is None:
1006+
logger.warning('AtomsState has no `chemical_symbol` set.')
10121007
return []
1013-
chemical_symbols.append(
1014-
particle_state.atom_definition_ref.chemical_symbol
1015-
)
1008+
chemical_symbols.append(particle_state.chemical_symbol)
10161009
return chemical_symbols
10171010

10181011
def to_ase_atoms(self, logger: 'BoundLogger') -> 'Optional[ase.Atoms]':

0 commit comments

Comments
 (0)