diff --git a/python/converters/vasp/python/inpconf.py b/python/converters/vasp/python/inpconf.py index e9dcb978..4c91db3f 100644 --- a/python/converters/vasp/python/inpconf.py +++ b/python/converters/vasp/python/inpconf.py @@ -374,7 +374,7 @@ class ConfigParameters: def find_shell_by_user_index(uindex): for ind, shell in enumerate(self.shells): if shell['user_index'] == uindex: - return shell + return ind, shell raise KeyError sh_inds = [] @@ -384,7 +384,7 @@ class ConfigParameters: try: ind, shell = find_shell_by_user_index(user_ind) except KeyError: - raise Exception("Shell %i reference in group '%s' does not exist"%(user_ind, group['index'])) + raise Exception("Shell %i referenced in group '%s' does not exist"%(user_ind, group['index'])) sh_inds.append(ind) # If [Shell] section contains (potentiall conflicting) group parameters diff --git a/python/converters/vasp/test/inpconf/test9.cfg b/python/converters/vasp/test/inpconf/test9.cfg new file mode 100644 index 00000000..d2883160 --- /dev/null +++ b/python/converters/vasp/test/inpconf/test9.cfg @@ -0,0 +1,25 @@ +[General] + +[Group 1] +SHELLS = 1 2 +EMIN = -7.6 +EMAX = 3.0 + +[Group 2] +SHELLS = 3 +EMIN = -1.6 +EMAX = 2.0 + +[Shell 1] +LSHELL = 2 +IONS = 5..8 + +[Shell 2] +LSHELL = 1 +IONS = 1..4 + +RTRANSFORM = 0.0 1.0 0.0 + 1.0 0.0 0.0 + 0.0 0.0 1.0 + + diff --git a/python/converters/vasp/test/inpconf/test_inpconf.py b/python/converters/vasp/test/inpconf/test_inpconf.py index 4eb7fa40..1e8dcfd6 100644 --- a/python/converters/vasp/test/inpconf/test_inpconf.py +++ b/python/converters/vasp/test/inpconf/test_inpconf.py @@ -311,6 +311,12 @@ class TestSpecialParsers(unittest.TestCase): with self.assertRaisesRegexp(KeyError, err_mess): conf_pars.parse_input() +# Scenario 3 + conf_pars = ConfigParameters('test9.cfg') + err_mess = "Shell 3 referenced in" + with self.assertRaisesRegexp(Exception, err_mess): + conf_pars.parse_input() +