示例#1
0
    def test_expand(self):
        """
        Testing helper function to extend the convergence grid
        """
        self.maxDiff = None
        spec = get_spec('GW')
        struc = AbiStructure.from_file(abidata.cif_file("si.cif"))
        struc.item = 'test'

        wdir = tempfile.mkdtemp()
        print('wdir', wdir)

        os.chdir(wdir)
        shutil.copyfile(abidata.cif_file("si.cif"), os.path.join(wdir, 'si.cif'))
        shutil.copyfile(abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'shell_manager.yml'),
                        os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'), os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir

        tests = SingleAbinitGWWork(struc, spec).convs
        tests_out = {'nscf_nbands': {'test_range': (40,),
                                     'control': 'gap', 'method': 'set_bands', 'level': 'nscf'},
                     'ecut': {'test_range': (50, 48, 46, 44),
                              'control': 'e_ks_max', 'method': 'direct', 'level': 'scf'},
                     'ecuteps': {'test_range': (4, 8, 12, 16, 20),
                                 'control': 'gap', 'method': 'direct', 'level': 'sigma'}}
        self.assertEqual(expand(tests, 1), tests_out)
        spec.data['code'] = 'VASP'

        if "VASP_PSP_DIR" in os.environ:
            spec.update_code_interface()
            tests = GWG0W0VaspInputSet(struc, spec).convs
            tests_out = {'ENCUTGW': {'test_range': (200, 400, 600, 800), 'control': 'gap', 'method': 'incar_settings'}}
            self.assertEqual(expand(tests, 1), tests_out)

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS
示例#2
0
 def test_expand(self):
     self.maxDiff = None
     spec = get_spec('GW')
     tests = SingleAbinitGWWork(structure, spec).convs
     tests_out = {'nscf_nbands': {'test_range': (40,),
                                  'control': 'gap', 'method': 'set_bands', 'level': 'nscf'},
                  'ecut': {'test_range': (50, 48, 46, 44),
                           'control': 'e_ks_max', 'method': 'direct', 'level': 'scf'},
                  'ecuteps': {'test_range': (4, 8, 12, 16, 20),
                              'control': 'gap', 'method': 'direct', 'level': 'sigma'}}
     self.assertEqual(expand(tests, 1), tests_out)
     spec.data['code'] = 'VASP'
     spec.update_code_interface()
     tests = GWG0W0VaspInputSet(structure, spec).convs
     tests_out = {'ENCUTGW': {'test_range': (200, 400, 600, 800), 'control': 'gap', 'method': 'incar_settings'}}
     self.assertEqual(expand(tests, 1), tests_out)
示例#3
0
def main(update=True):
    """
    main gw setup
    """
    spec_in = get_spec('GW')

    try:
        spec_in.read_from_file('spec.in')
    except (IOError, OSError):
        try:
            spec_in.read_from_file('$HOME/.abinit/abipy/spec.in')
        except (IOError, OSError):
            pass
        pass

    if update:
        # in testing mode there should not be interactive updating
        spec_in.update_interactive()

    spec_in.test()
    spec_in.write_to_file('spec.in')
    spec_in.loop_structures('i')

    return 0
示例#4
0
 def test_expand(self):
     self.maxDiff = None
     spec = get_spec('GW')
     tests = SingleAbinitGWWork(structure, spec).convs
     tests_out = {
         'nscf_nbands': {
             'test_range': (40, ),
             'control': 'gap',
             'method': 'set_bands',
             'level': 'nscf'
         },
         'ecut': {
             'test_range': (50, 48, 46, 44),
             'control': 'e_ks_max',
             'method': 'direct',
             'level': 'scf'
         },
         'ecuteps': {
             'test_range': (4, 8, 12, 16, 20),
             'control': 'gap',
             'method': 'direct',
             'level': 'sigma'
         }
     }
     self.assertEqual(expand(tests, 1), tests_out)
     spec.data['code'] = 'VASP'
     spec.update_code_interface()
     tests = GWG0W0VaspInputSet(structure, spec).convs
     tests_out = {
         'ENCUTGW': {
             'test_range': (200, 400, 600, 800),
             'control': 'gap',
             'method': 'incar_settings'
         }
     }
     self.assertEqual(expand(tests, 1), tests_out)
示例#5
0
 def test_GWget_spec(self):
     spec = get_spec('GW')
     self.assertIsInstance(spec, GWSpecs)
示例#6
0
#!/usr/bin/env python
"""
Script process the GW output generated by GWsetup using VASP or ABINIT.
"""
from __future__ import unicode_literals, division, print_function

__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel van Setten"
__email__ = "*****@*****.**"
__date__ = "May 2014"

import os
import os.path

from abipy.gw.datastructures import get_spec

MODULE_DIR = os.path.dirname(os.path.abspath(__file__))

if __name__ == "__main__":
    if os.path.isfile('plots'):
        os.remove('plots')
    if os.path.isfile('plot-fits'):
        os.remove('plot-fits')
    spec = get_spec('GW')
    spec.read_from_file('spec.in')
    print('Found setup for ', spec.get_code())
    spec.loop_structures('o')
示例#7
0
__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel van Setten"
__email__ = "*****@*****.**"
__date__ = "May 2014"

import os
import os.path

from abipy.gw.datastructures import get_spec

MODULE_DIR = os.path.dirname(os.path.abspath(__file__))

if __name__ == "__main__":
    counter = 0
    #load_ps()
    spec_in = get_spec('GW')
    try:
        spec_in.read_from_file('spec.in')
    except (IOError, OSError):
        try:
            spec_in.read_from_file('$HOME/.abinit/abipy/spec.in')
        except (IOError, OSError):
            pass
        pass
    spec_in.update_interactive()
    spec_in.test()
    spec_in.write_to_file('spec.in')
    spec_in.loop_structures('i')
示例#8
0
    def test_setup(self):
        """
        Testing the main functions called in the abiGWsetup script
        """

        spec_in = get_spec('GW')
        self.assertIsInstance(spec_in, GWSpecs)

        self.assert_equal(spec_in.test(), 0)
        self.assert_equal(len(spec_in.to_dict()), 10)
        self.assert_equal(spec_in.get_code(), 'ABINIT')

        spec_in.data['source'] = 'cif'

        self.assert_equal(
            spec_in.hash_str(),
            "code:ABINIT;source:cifjobs:[u'prep', u'G0W0'];mode:ceci;functional:PBE;kp_grid_dens:500prec:m;tol:0.0001;test:False;converge:False"
        )

        wdir = tempfile.mkdtemp()
        base = os.getcwd()
        print('wdir', wdir)

        os.chdir(wdir)

        shutil.copyfile(abidata.cif_file("si.cif"),
                        os.path.join(wdir, 'si.cif'))
        shutil.copyfile(
            abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers', 'shell_manager.yml'),
            os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'),
            os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir

        spec_in.data['source'] = 'cif'
        print('dirpath', abidata.dirpath)

        spec_in.write_to_file('spec.in')
        self.assertTrue(os.path.isfile(os.path.join(wdir, 'spec.in')))

        # broken due to strategy refactoring
        # spec_in.loop_structures('i')

        os.chdir(base)

        shutil.rmtree(wdir)

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS
示例#9
0
#!/usr/bin/env python
"""
Script to store GW results for VASP and ABINIT in a database.
"""
from __future__ import unicode_literals, division, print_function

__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel van Setten"
__email__ = "*****@*****.**"
__date__ = "May 2014"

import os
import os.path

from abipy.gw.datastructures import get_spec

MODULE_DIR = os.path.dirname(os.path.abspath(__file__))

if __name__ == "__main__":
    counter = 0
    spec_in = get_spec('GW')
    spec_in.read_from_file('spec.in')
    spec_in.loop_structures('s')
示例#10
0
 def test_GWget_spec(self):
     """
     Testing the factory function get_specs()
     """
     spec = get_spec('GW')
     self.assertIsInstance(spec, GWSpecs)
示例#11
0
    def test_SingleAbinitGWWork(self):
        """
        Testing the concrete SingelAbinitGWWork class
        """
        struc = AbiStructure.from_file(abidata.cif_file("si.cif"))
        struc.item = 'test'

        wdir = tempfile.mkdtemp()
        #wdir = '.'
        shutil.copyfile(abidata.cif_file("si.cif"),
                        os.path.join(wdir, 'si.cif'))
        shutil.copyfile(
            abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers',
                         'shell_manager_nompi.yml'),
            os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'),
            os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir
        self.assertIsInstance(struc, AbiStructure)
        spec = get_spec('GW')
        spec.data['kp_grid_dens'] = 100
        spec.data['kp_in'] = -100
        with open(os.path.join(wdir, 'extra_abivars'), 'w') as f:
            f.write('{"ecut": 8, "ecutsigx": 8}')

        work = SingleAbinitGWWork(struc, spec)
        self.assertEqual(len(work.CONVS), 3)

        conv_strings = ['method', 'control', 'level']
        for test in work.CONVS:
            self.assertIsInstance(work.CONVS[test]['test_range'], tuple)
            for item in conv_strings:
                self.assertIsInstance(work.CONVS[test][item], unicode)
        self.assertEqual(work.work_dir, 'Si_test')
        self.assertEqual(len(work.pseudo_table), 1)
        self.assertEqual(work.bands_fac, 1)

        self.assertEqual(work.get_electrons(struc), 8)
        self.assertEqual(work.get_bands(struc), 6)
        self.assertGreater(work.get_bands(struc),
                           work.get_electrons(struc) / 2,
                           'More electrons than bands, very bad.')

        flow = work.create()
        print(work.work_dir)
        print(flow.workdir)
        print(flow[0].workdir)
        self.assertIsInstance(flow, Flow)
        self.assertEqual(len(flow), 1)  # one work
        self.assertEqual(len(flow[0]), 4)  # with 4 tasks
        # self.assertEqual(flow.workdir, 'Si')

        self.assertEqual(flow.build_and_pickle_dump(), 0)
        # some more tests
        flow.rmtree()

        spec = get_spec('GW')
        spec.data['converge'] = True
        struc.item = 'converge'
        work = SingleAbinitGWWork(struc, spec)
        flow = work.create()
        self.assertEqual(len(flow[0]), 45)
        self.assertEqual(flow[0][0].__class__, ScfTask)
        self.assertEqual(flow[0][1].__class__, ScfTask)
        self.assertEqual(flow[0][2].__class__, ScfTask)
        self.assertEqual(flow[0][3].__class__, ScfTask)
        self.assertEqual(flow[0][4].__class__, NscfTask)
        self.assertEqual(flow[0][5].__class__, ScrTask)
        self.assertEqual(flow[0][6].__class__, SigmaTask)

        ecuts = [
            dict(task.input.as_dict()['abi_args'])['ecut'] for task in flow[0]
        ]
        print('ecuts:', ecuts)
        # it is essential that the first four are diffent, this is for the convergence study of ecut, and that
        # after that is stays the same
        self.assertEqual(ecuts, [
            50, 48, 46, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
            44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
            44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44
        ])

        nbands = [
            dict(task.input.as_dict()['abi_args'])['nband'] for task in flow[0]
        ]
        print('nbands:', nbands)
        # the firs 4 should be 'low' these are self consistent
        # the fifth should be the maximum of what follows
        # the 6th and on should always be pairs that are the same, they are combinations of scr and sigma tasks
        self.assertEqual(nbands, [
            26, 26, 26, 26, 180, 30, 30, 60, 60, 120, 120, 180, 180, 30, 30,
            60, 60, 120, 120, 180, 180, 30, 30, 60, 60, 120, 120, 180, 180, 30,
            30, 60, 60, 120, 120, 180, 180, 30, 30, 60, 60, 120, 120, 180, 180
        ])

        ecuteps = [
            dict(task.input.as_dict()['abi_args']).get('ecuteps', None)
            for task in flow[0]
        ]
        print('ecuteps:', ecuteps)
        self.assertEqual(ecuteps, [
            None, None, None, None, None, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8,
            8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16,
            16, 16, 20, 20, 20, 20, 20, 20, 20, 20
        ])

        inplens = [len(task.input.as_dict()['abi_args']) for task in flow[0]]
        print(inplens)
        self.assertEqual(inplens, [
            17, 17, 17, 17, 18, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30,
            27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27,
            30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30
        ])

        ngkpts = [
            dict(task.input.as_dict()['abi_args'])['ngkpt'] for task in flow[0]
        ]

        for ngkpt in ngkpts:
            self.assertEqual(ngkpt, [2, 2, 2])

        self.assertEqual(flow.build_and_pickle_dump(), 0)

        # some more tests
        flow.rmtree()

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS
示例#12
0
#!/usr/bin/env python
# coding: utf-8
"""
Script process the GW output generated by GWsetup using VASP or ABINIT.
"""
from __future__ import unicode_literals, division, print_function

__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel van Setten"
__email__ = "*****@*****.**"
__date__ = "May 2014"

import os
import os.path

from abipy.gw.datastructures import get_spec

MODULE_DIR = os.path.dirname(os.path.abspath(__file__))

if __name__ == "__main__":
    if os.path.isfile('plots'):
        os.remove('plots')
    if os.path.isfile('plot-fits'):
        os.remove('plot-fits')
    spec = get_spec('GW')
    spec.read_from_file('spec.in')
    print('Found setup for ', spec.get_code())
    spec.loop_structures('o')
示例#13
0
 def test_GWget_spec(self):
     """
     Testing the factory function get_specs()
     """
     spec = get_spec('GW')
     self.assertIsInstance(spec, GWSpecs)
示例#14
0
    def test_SingleAbinitGWWork(self):
        """
        Testing the concrete SingelAbinitGWWork class
        """
        struc = AbiStructure.from_file(abidata.cif_file("si.cif"))
        struc.item = 'test'

        wdir = '.'
        shutil.copyfile(abidata.cif_file("si.cif"), os.path.join(wdir, 'si.cif'))
        shutil.copyfile(abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'shell_manager_nompi.yml'),
                        os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'), os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir
        self.assertIsInstance(struc, AbiStructure)
        spec = get_spec('GW')
        spec.data['kp_grid_dens'] = 100
        spec.data['kp_in'] = -100
        with open('extra_abivars', 'w') as f:
            f.write('{"ecut": 8, "ecutsigx": 8}')

        work = SingleAbinitGWWork(struc, spec)
        self.assertEqual(len(work.CONVS), 3)

        conv_strings = ['method', 'control', 'level']
        for test in work.CONVS:
            self.assertIsInstance(work.CONVS[test]['test_range'], tuple)
            for item in conv_strings:
                self.assertIsInstance(work.CONVS[test][item], unicode)
        self.assertEqual(work.work_dir, 'Si_test')
        self.assertEqual(len(work.pseudo_table), 1)
        self.assertEqual(work.bands_fac, 1)

        self.assertEqual(work.get_electrons(struc), 8)
        self.assertEqual(work.get_bands(struc), 6)
        self.assertGreater(work.get_bands(struc), work.get_electrons(struc) / 2, 'More electrons than bands, very bad.')

        flow = work.create()
        print(work.work_dir)
        print(flow.workdir)
        print(flow[0].workdir)
        self.assertIsInstance(flow, Flow)
        self.assertEqual(len(flow), 1)      # one work
        self.assertEqual(len(flow[0]), 4)   # with 4 tasks
        # self.assertEqual(flow.workdir, 'Si')

        self.assertEqual(flow.build_and_pickle_dump(), 0)
        # some more tests
        flow.rmtree()

        spec = get_spec('GW')
        spec.data['converge'] = True
        struc.item = 'converge'
        work = SingleAbinitGWWork(struc, spec)
        flow = work.create()
        self.assertEqual(len(flow[0]), 45)
        self.assertEqual(flow.build_and_pickle_dump(), 0)
        # some more tests
        flow.rmtree()

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS
示例#15
0
    def test_expand(self):
        """
        Testing helper function to extend the convergence grid
        """
        self.maxDiff = None
        spec = get_spec('GW')
        struc = AbiStructure.from_file(abidata.cif_file("si.cif"))
        struc.item = 'test'

        wdir = tempfile.mkdtemp()
        print('wdir', wdir)

        os.chdir(wdir)
        shutil.copyfile(abidata.cif_file("si.cif"),
                        os.path.join(wdir, 'si.cif'))
        shutil.copyfile(
            abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers', 'shell_manager.yml'),
            os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(
            os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'),
            os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir

        tests = SingleAbinitGWWork(struc, spec).convs
        tests_out = {
            'nscf_nbands': {
                'test_range': (40, ),
                'control': 'gap',
                'method': 'set_bands',
                'level': 'nscf'
            },
            'ecut': {
                'test_range': (50, 48, 46, 44),
                'control': 'e_ks_max',
                'method': 'direct',
                'level': 'scf'
            },
            'ecuteps': {
                'test_range': (4, 8, 12, 16, 20),
                'control': 'gap',
                'method': 'direct',
                'level': 'sigma'
            }
        }
        self.assertEqual(expand(tests, 1), tests_out)
        spec.data['code'] = 'VASP'

        if "VASP_PSP_DIR" in os.environ:
            spec.update_code_interface()
            tests = GWG0W0VaspInputSet(struc, spec).convs
            tests_out = {
                'ENCUTGW': {
                    'test_range': (200, 400, 600, 800),
                    'control': 'gap',
                    'method': 'incar_settings'
                }
            }
            self.assertEqual(expand(tests, 1), tests_out)

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS
示例#16
0
    def test_SingleAbinitGWWork(self):
        """
        Testing the concrete SingelAbinitGWWork class
        """
        struc = AbiStructure.from_file(abidata.cif_file("si.cif"))
        struc.item = 'test'

        wdir = tempfile.mkdtemp()
        #wdir = '.'
        shutil.copyfile(abidata.cif_file("si.cif"), os.path.join(wdir, 'si.cif'))
        shutil.copyfile(abidata.pseudo("14si.pspnc").path, os.path.join(wdir, 'Si.pspnc'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'shell_manager_nompi.yml'),
                        os.path.join(wdir, 'manager.yml'))
        shutil.copyfile(os.path.join(abidata.dirpath, 'managers', 'scheduler.yml'), os.path.join(wdir, 'scheduler.yml'))

        try:
            temp_ABINIT_PS_EXT = os.environ['ABINIT_PS_EXT']
            temp_ABINIT_PS = os.environ['ABINIT_PS']
        except KeyError:
            temp_ABINIT_PS_EXT = None
            temp_ABINIT_PS = None

        os.environ['ABINIT_PS_EXT'] = '.pspnc'
        os.environ['ABINIT_PS'] = wdir
        self.assertIsInstance(struc, AbiStructure)
        spec = get_spec('GW')
        spec.data['kp_grid_dens'] = 100
        spec.data['kp_in'] = -100
        with open(os.path.join(wdir, 'extra_abivars'), 'w') as f:
            f.write('{"ecut": 8, "ecutsigx": 8}')

        work = SingleAbinitGWWork(struc, spec)
        self.assertEqual(len(work.CONVS), 3)

        conv_strings = ['method', 'control', 'level']
        for test in work.CONVS:
            self.assertIsInstance(work.CONVS[test]['test_range'], tuple)
            for item in conv_strings:
                self.assertIsInstance(work.CONVS[test][item], unicode)
        self.assertEqual(work.work_dir, 'Si_test')
        self.assertEqual(len(work.pseudo_table), 1)
        self.assertEqual(work.bands_fac, 1)

        self.assertEqual(work.get_electrons(struc), 8)
        self.assertEqual(work.get_bands(struc), 6)
        self.assertGreater(work.get_bands(struc), work.get_electrons(struc) / 2, 'More electrons than bands, very bad.')

        flow = work.create()
        print(work.work_dir)
        print(flow.workdir)
        print(flow[0].workdir)
        self.assertIsInstance(flow, Flow)
        self.assertEqual(len(flow), 1)      # one work
        self.assertEqual(len(flow[0]), 4)   # with 4 tasks
        # self.assertEqual(flow.workdir, 'Si')

        self.assertEqual(flow.build_and_pickle_dump(), 0)
        # some more tests
        flow.rmtree()

        spec = get_spec('GW')
        spec.data['converge'] = True
        struc.item = 'converge'
        work = SingleAbinitGWWork(struc, spec)
        flow = work.create()
        self.assertEqual(len(flow[0]), 45)
        self.assertEqual(flow.build_and_pickle_dump(), 0)
        # some more tests
        flow.rmtree()

        if temp_ABINIT_PS is not None:
            os.environ['ABINIT_PS_EXT'] = temp_ABINIT_PS_EXT
            os.environ['ABINIT_PS'] = temp_ABINIT_PS