Skip to content

Commit

Permalink
Improve corrputed format handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Jan 16, 2025
1 parent 0a9cf31 commit 8d2965a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions electronicparsers/quantumespresso/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3492,20 +3492,13 @@ def parse_method(self, run):
n_electrons = run.get_header('number_of_electrons', [])
if len(n_electrons) == 3:
sec_method.electronic.n_electrons = n_electrons[0]
elif len(n_electrons) == 2:
self.logger.warning('Corrupted extraction `n_electrons`. Cannot set value.')
elif len(n_electrons) == 1:
self.logger.warning(
'Corrupted extraction `n_electrons`. Will set a tentative value.'
) # ? Maybe it shouldn't set anything
sec_method.electronic.n_electrons = n_electrons[0]
elif len(n_electrons) == 0:
pass
else:
self.logger.warning(
'Corrupted extraction `n_electrons`. Cannot set value.',
n_electrons=n_electrons,
)
) # this error could be better managed if we retianed the og keys

def init_parser(self):
self.out_parser.mainfile = self.filepath
Expand Down

0 comments on commit 8d2965a

Please sign in to comment.