From 3b16b4b103d8f38c4348c8ceba8f6db55b8997a1 Mon Sep 17 00:00:00 2001 From: ladinesa <67910858+ladinesa@users.noreply.github.com> Date: Tue, 28 May 2024 01:54:08 +0200 Subject: [PATCH] Fix vasp (#224) --- electronicparsers/vasp/parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/electronicparsers/vasp/parser.py b/electronicparsers/vasp/parser.py index e3c08d22..4e180461 100644 --- a/electronicparsers/vasp/parser.py +++ b/electronicparsers/vasp/parser.py @@ -1667,7 +1667,9 @@ def parse_core_hole(self) -> tuple[Optional[CoreHole], Optional[AtomsGroup], int source = self.parser.incar # setup `AtomsGroup` parameters elem_id = source.get('CLNT', 1) - 1 - elem_ids = [int(x) for x in self.parser.atom_info['atomtypes']['atomspertype']] + elem_ids = [ + int(x) for x in self.parser.atom_info['atomtypes'].get('atomspertype', []) + ] lower_range = elem_ids[elem_id - 1] if elem_id > 1 else 0 atom_ids = list(range(lower_range, elem_ids[elem_id])) return ( @@ -1869,7 +1871,7 @@ def parse_method(self): for param, n_atoms in dict( zip( sec_method.atom_parameters, - self.parser.atom_info['atomtypes']['atomspertype'], + self.parser.atom_info['atomtypes'].get('atomspertype', []), ) ).items(): # correct based on core-holes