3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 04:13:47 +01:00

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.
This commit is contained in:
Oleg E. Peil 2015-02-19 17:25:03 +01:00 committed by Michel Ferrero
parent 5c3b3d0b8d
commit 9bbd71afb9
2 changed files with 3 additions and 2 deletions

View File

@ -366,6 +366,8 @@ class ConfigParameters:
value = self.shells[0].pop(key) value = self.shells[0].pop(key)
self.groups[0][key] = value self.groups[0][key] = value
except KeyError: except KeyError:
if len(self.gr_optional[par]) > 2:
self.groups[0][key] = self.gr_optional[par][2]
continue continue
# Add the index of the single shell into the group # Add the index of the single shell into the group
self.groups[0].update({'shells': [1]}) self.groups[0].update({'shells': [1]})

View File

@ -95,13 +95,12 @@ Groups:
res += conf_pars.shells.__repr__() + '\n\n' res += conf_pars.shells.__repr__() + '\n\n'
res += "Groups:\n" res += "Groups:\n"
res += conf_pars.groups.__repr__() res += conf_pars.groups.__repr__()
print res
expected = r"""Shells: expected = r"""Shells:
[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}] [{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}]
Groups: 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) self.assertEqual(res, expected)