From 9bbd71afb95ec1a88ec0b214cffb8afa8a8b1914 Mon Sep 17 00:00:00 2001 From: "Oleg E. Peil" Date: Thu, 19 Feb 2015 17:25:03 +0100 Subject: [PATCH] Fixed a bug in 'inpconf.py' The problem was that when one shell was specified without an explicit group the created automatic group was lacking the default values for parameters 'normalize' and 'normion'. The current design, however, assumes that they must always be set. --- python/converters/vasp/python/inpconf.py | 2 ++ python/converters/vasp/test/inpconf/test_input.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/converters/vasp/python/inpconf.py b/python/converters/vasp/python/inpconf.py index b0680048..685f9b65 100644 --- a/python/converters/vasp/python/inpconf.py +++ b/python/converters/vasp/python/inpconf.py @@ -366,6 +366,8 @@ class ConfigParameters: value = self.shells[0].pop(key) self.groups[0][key] = value except KeyError: + if len(self.gr_optional[par]) > 2: + self.groups[0][key] = self.gr_optional[par][2] continue # Add the index of the single shell into the group self.groups[0].update({'shells': [1]}) diff --git a/python/converters/vasp/test/inpconf/test_input.py b/python/converters/vasp/test/inpconf/test_input.py index 59de1523..365b96f2 100644 --- a/python/converters/vasp/test/inpconf/test_input.py +++ b/python/converters/vasp/test/inpconf/test_input.py @@ -95,13 +95,12 @@ Groups: res += conf_pars.shells.__repr__() + '\n\n' res += "Groups:\n" res += conf_pars.groups.__repr__() - print res expected = r"""Shells: [{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}] Groups: -[{'index': '1', 'emin': -7.6, 'shells': [0], 'emax': 3.0}]""" +[{'normalize': True, 'index': '1', 'emin': -7.6, 'emax': 3.0, 'normion': False, 'shells': [0]}]""" self.assertEqual(res, expected)