Skip to content

Commit

Permalink
errors to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Dec 10, 2024
1 parent 12a446f commit 163f846
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/nomad_simulations/schema_packages/model_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 163f846

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py15287%39–41
   atoms_state.py1932189%13–15, 201–204, 228, 283–284, 352–353, 355, 537, 549–550, 620–624, 639–643, 650
   basis_set.py2402888%8–9, 122–133, 172–185, 208, 391–395, 417–418, 462–465, 584, 615, 617
   general.py90594%128, 192, 302–303, 313
   model_method.py2697871%10–12, 171–174, 177–184, 276–277, 297, 318–339, 355–381, 384–401, 587, 780, 791, 833–840, 878, 897, 977, 1034, 1109, 1223
   model_system.py3986384%46–52, 238, 257, 261, 264, 267, 293, 387–388, 415–420, 426, 429, 432–435, 454–460, 466–472, 586–587, 604–605, 632–634, 647–656, 788–791, 838–845, 1019–1020, 1244–1248, 1254–1255, 1263–1264, 1269, 1293
   numerical_settings.py2596176%12–14, 217, 219–220, 223–226, 230–231, 238–241, 250–253, 257–260, 262–265, 270–273, 279–282, 469–496, 571, 606–609, 633, 636, 681, 683–686, 690, 694, 741, 745–766, 821–822, 889
   outputs.py1201092%9–10, 252–255, 295–298, 323, 325, 362, 381
   particles_state.py321262%17–19, 104–109, 112–116
   physical_property.py102793%20–22, 202, 331–333
   variables.py861286%8–10, 98, 121, 145, 167, 189, 211, 233, 256, 276
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%8–10, 135–136
   band_structure.py1232580%9–11, 232–265, 278, 285, 321–322, 325, 372–373, 378
   energies.py42979%7–9, 36, 57, 82, 103, 119, 134
   fermi_surface.py17476%7–9, 40
   forces.py22673%7–9, 36, 56, 79
   greens_function.py991387%7–9, 210–211, 214, 235–236, 239, 260–261, 264, 400
   hopping_matrix.py29583%7–9, 58, 94
   permittivity.py48883%7–9, 97–105
   spectral_profile.py26012851%9–11, 57–60, 95–98, 199–300, 356–368, 393–396, 416, 421–424, 466–502, 526, 573–576, 592–593, 598–604
   thermodynamics.py752764%7–9, 35, 56, 72, 81, 90, 101, 110, 137, 147, 157, 172–174, 177, 193, 213–215, 218, 234, 254–256, 259
src/nomad_simulations/schema_packages/utils
   utils.py791877%8–11, 56–57, 66–75, 84–85, 90, 93, 170–171
TOTAL267555179% 

Tests Skipped Failures Errors Time
402 0 💤 1 ❌ 0 🔥 7.213s ⏱️

Please sign in to comment.