From 8a718ea90661ace25a0ec719c8584bcd970dd913 Mon Sep 17 00:00:00 2001 From: "Oleg E. Peil" Date: Fri, 13 Nov 2015 13:54:26 +0100 Subject: [PATCH] Fixed 'inpconf' tests after the recent changes Some of the options of the config-file has been modified. The tests have been adapted accordingly. --- python/vasp/test/_inpconf/example.cfg | 13 ++++++------- python/vasp/test/_inpconf/example_nogroup.cfg | 3 +-- python/vasp/test/_inpconf/input_test_3.cfg | 12 +++++------- python/vasp/test/_inpconf/input_test_4.cfg | 9 ++++----- python/vasp/test/_inpconf/test_general.py | 3 ++- python/vasp/test/_inpconf/test_groups.py | 4 ++-- python/vasp/test/_inpconf/test_inpconf.py | 3 ++- python/vasp/test/_inpconf/test_input.py | 8 +++----- python/vasp/test/_inpconf/test_shells.py | 2 +- 9 files changed, 26 insertions(+), 31 deletions(-) diff --git a/python/vasp/test/_inpconf/example.cfg b/python/vasp/test/_inpconf/example.cfg index 1919bc23..ee24948e 100644 --- a/python/vasp/test/_inpconf/example.cfg +++ b/python/vasp/test/_inpconf/example.cfg @@ -1,16 +1,15 @@ [General] BASENAME = test_base EFERMI = 0.1 +DOSMESH = -8.0 4.0 101 [Group 1] SHELLS = 1 2 -EMIN = -7.6 -EMAX = 3.0 +EWINDOW = -7.6 3.0 [Group 2] SHELLS = 3 -EMIN = -1.6 -EMAX = 2.0 +EWINDOW = -1.6 2.0 [Shell 1] LSHELL = 2 @@ -20,9 +19,9 @@ IONS = 5..8 LSHELL = 1 IONS = 1..4 -RTRANSFORM = 0.0 1.0 0.0 - 1.0 0.0 0.0 - 0.0 0.0 1.0 +TRANSFORM = 0.0 1.0 0.0 + 1.0 0.0 0.0 + 0.0 0.0 1.0 [Shell 3] LSHELL = 3 diff --git a/python/vasp/test/_inpconf/example_nogroup.cfg b/python/vasp/test/_inpconf/example_nogroup.cfg index fa4905c5..1a06ef81 100644 --- a/python/vasp/test/_inpconf/example_nogroup.cfg +++ b/python/vasp/test/_inpconf/example_nogroup.cfg @@ -1,7 +1,6 @@ [Shell 1] LSHELL = 2 IONS = 5..8 -EMIN = -7.6 -EMAX = 3.0 +EWINDOW = -7.6 3.0 diff --git a/python/vasp/test/_inpconf/input_test_3.cfg b/python/vasp/test/_inpconf/input_test_3.cfg index d2883160..31d404b4 100644 --- a/python/vasp/test/_inpconf/input_test_3.cfg +++ b/python/vasp/test/_inpconf/input_test_3.cfg @@ -2,13 +2,11 @@ [Group 1] SHELLS = 1 2 -EMIN = -7.6 -EMAX = 3.0 +EWINDOW = -7.6 3.0 [Group 2] SHELLS = 3 -EMIN = -1.6 -EMAX = 2.0 +EWINDOW = -1.6 2.0 [Shell 1] LSHELL = 2 @@ -18,8 +16,8 @@ IONS = 5..8 LSHELL = 1 IONS = 1..4 -RTRANSFORM = 0.0 1.0 0.0 - 1.0 0.0 0.0 - 0.0 0.0 1.0 +TRANSFORM = 0.0 1.0 0.0 + 1.0 0.0 0.0 + 0.0 0.0 1.0 diff --git a/python/vasp/test/_inpconf/input_test_4.cfg b/python/vasp/test/_inpconf/input_test_4.cfg index f8ae6295..cabc3634 100644 --- a/python/vasp/test/_inpconf/input_test_4.cfg +++ b/python/vasp/test/_inpconf/input_test_4.cfg @@ -2,8 +2,7 @@ [Group 1] SHELLS = 1 2 -EMIN = -7.6 -EMAX = 3.0 +EWINDOW = -7.6 3.0 [Shell 1] LSHELL = 2 @@ -13,9 +12,9 @@ IONS = 5..8 LSHELL = 1 IONS = 1..4 -RTRANSFORM = 0.0 1.0 0.0 - 1.0 0.0 0.0 - 0.0 0.0 1.0 +TRANSFORM = 0.0 1.0 0.0 + 1.0 0.0 0.0 + 0.0 0.0 1.0 [Shell 3] LSHELL = 3 diff --git a/python/vasp/test/_inpconf/test_general.py b/python/vasp/test/_inpconf/test_general.py index f52495cf..c388c95e 100644 --- a/python/vasp/test/_inpconf/test_general.py +++ b/python/vasp/test/_inpconf/test_general.py @@ -29,7 +29,8 @@ class TestParseGeneral(arraytest.ArrayTestCase): conf_pars = ConfigParameters(_rpath + 'example.cfg') conf_pars.parse_general() res = conf_pars.general - expected = {'basename': 'test_base', 'efermi': 0.1} + expected = {'basename': 'test_base', 'efermi': 0.1, + 'dosmesh': {'n_points': 101, 'emin': -8.0, 'emax': 4.0}} self.assertDictEqual(res, expected) diff --git a/python/vasp/test/_inpconf/test_groups.py b/python/vasp/test/_inpconf/test_groups.py index 3ebc3670..4ffe80a7 100644 --- a/python/vasp/test/_inpconf/test_groups.py +++ b/python/vasp/test/_inpconf/test_groups.py @@ -38,9 +38,9 @@ class TestParseGroups(arraytest.ArrayTestCase): conf_pars = ConfigParameters(_rpath + 'example.cfg') conf_pars.parse_groups() res = conf_pars.groups - expected = [{'index': 1, 'shells': [1, 2], 'emin': -7.6, 'emax': 3.0, + expected = [{'index': 1, 'shells': [1, 2], 'ewindow': (-7.6, 3.0), 'normalize': True, 'normion': False}, - {'index': 2, 'shells': [3], 'emin': -1.6, 'emax': 2.0, + {'index': 2, 'shells': [3], 'ewindow': (-1.6, 2.0), 'normalize': True, 'normion': False}] self.assertListEqual(res, expected) diff --git a/python/vasp/test/_inpconf/test_inpconf.py b/python/vasp/test/_inpconf/test_inpconf.py index 9700a765..323cbd93 100644 --- a/python/vasp/test/_inpconf/test_inpconf.py +++ b/python/vasp/test/_inpconf/test_inpconf.py @@ -4,6 +4,7 @@ Test suite for module `inpconf.py`. import unittest if __name__ == '__main__': - suite = unittest.TestLoader().discover('./') +# suite = unittest.TestLoader().discover('./') + suite = unittest.TestLoader().discover('./', pattern='test_shells.py') unittest.TextTestRunner(verbosity=2, buffer=True).run(suite) diff --git a/python/vasp/test/_inpconf/test_input.py b/python/vasp/test/_inpconf/test_input.py index eca74ea8..404ceeb6 100644 --- a/python/vasp/test/_inpconf/test_input.py +++ b/python/vasp/test/_inpconf/test_input.py @@ -77,12 +77,10 @@ class TestParseInput(arraytest.ArrayTestCase): res += conf_pars.groups.__repr__() expected = r"""Shells: -[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}, {'tmatrix': array([[ 0., 1., 0.], - [ 1., 0., 0.], - [ 0., 0., 1.]]), 'ion_list': array([0, 1, 2, 3]), 'user_index': 2, 'lshell': 1}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 3, 'lshell': 3}] +[{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 2, 'lshell': 1}, {'ion_list': array([0, 1, 2, 3]), 'user_index': 3, 'lshell': 3}] Groups: -[{'normalize': True, 'index': 1, 'shells': [0, 1], 'normion': False, 'emax': 3.0, 'emin': -7.6}, {'normalize': True, 'index': 2, 'shells': [2], 'normion': False, 'emax': 2.0, 'emin': -1.6}]""" +[{'normalize': True, 'index': 1, 'ewindow': (-7.6, 3.0), 'normion': False, 'shells': [0, 1]}, {'normalize': True, 'index': 2, 'ewindow': (-1.6, 2.0), 'normion': False, 'shells': [2]}]""" self.assertEqual(res, expected) @@ -104,7 +102,7 @@ Groups: [{'ion_list': array([4, 5, 6, 7]), 'user_index': 1, 'lshell': 2}] Groups: -[{'normalize': True, 'index': '1', 'emin': -7.6, 'emax': 3.0, 'normion': False, 'shells': [0]}]""" +[{'normalize': True, 'index': '1', 'ewindow': (-7.6, 3.0), 'shells': [0], 'normion': False}]""" self.assertEqual(res, expected) diff --git a/python/vasp/test/_inpconf/test_shells.py b/python/vasp/test/_inpconf/test_shells.py index 062fb28d..15848fad 100644 --- a/python/vasp/test/_inpconf/test_shells.py +++ b/python/vasp/test/_inpconf/test_shells.py @@ -58,7 +58,7 @@ class TestParseShells(arraytest.ArrayTestCase): conf_pars.parse_shells() res = conf_pars.shells expected = [{'user_index': 1, 'lshell': 2, 'ion_list': np.array([4, 5, 6, 7])}, - {'user_index': 2, 'lshell': 1, 'ion_list': np.array([0, 1, 2, 3]), + {'user_index': 2, 'lshell': 1, 'ion_list': np.array([0, 1, 2, 3]), 'tmatrix': np.array([[ 0., 1., 0.], [ 1., 0., 0.], [ 0., 0., 1.]])}] # ...lousy way to test equality of two dictionaries containing numpy arrays self.assertEqual(len(res), len(expected))