コード例 #1
0
ファイル: codeinterfaces.py プロジェクト: gmrigna/abipy
 def get_conv_res_test(spec_data, structure):
     """
     return test sets for the tests in test relative to the convergence results
     """
     tests_conv = {}
     tests_prep_conv = {}
     tests_prep = GWscDFTPrepVaspInputSet(structure, spec_data).tests
     tests_prep.update(GWDFTDiagVaspInputSet(structure, spec_data).tests)
     tests = GWG0W0VaspInputSet(structure, spec_data).tests
     conv_res = is_converged(spec_data, structure, return_values=True)
     for test in conv_res.keys():
         if test in tests_prep.keys():
             rel = tests_prep[test]['test_range'][1] - tests_prep[test][
                 'test_range'][0]
             value = conv_res[test]
             tests_prep_conv.update({test: tests_prep[test]})
             tests_prep_conv[test].update(
                 {'test_range': (value, value + rel)})
         elif test in tests.keys():
             rel = tests[test]['test_range'][1] - tests[test]['test_range'][
                 0]
             value = conv_res[test]
             tests_conv.update({test: tests[test]})
             tests_conv[test].update({'test_range': (value, value + rel)})
     return {'tests': tests_conv, 'tests_prep': tests_prep_conv}
コード例 #2
0
ファイル: codeinterfaces.py プロジェクト: gmrigna/abipy
 def get_conv_res_test(spec_data, structure):
     """
     return test sets for the tests in test relative to the convergence results
     """
     tests_conv = {}
     tests_prep_conv = {}
     tests_prep = GWscDFTPrepVaspInputSet(structure, spec_data).tests
     tests_prep.update(GWDFTDiagVaspInputSet(structure, spec_data).tests)
     tests = GWG0W0VaspInputSet(structure, spec_data).tests
     conv_res = is_converged(spec_data, structure, return_values=True)
     for test in conv_res.keys():
         if test in tests_prep.keys():
             rel = tests_prep[test]['test_range'][1] - tests_prep[test]['test_range'][0]
             value = conv_res[test]
             tests_prep_conv.update({test: tests_prep[test]})
             tests_prep_conv[test].update({'test_range': (value, value + rel)})
         elif test in tests.keys():
             rel = tests[test]['test_range'][1] - tests[test]['test_range'][0]
             value = conv_res[test]
             tests_conv.update({test: tests[test]})
             tests_conv[test].update({'test_range': (value, value + rel)})
     return {'tests': tests_conv, 'tests_prep': tests_prep_conv}
コード例 #3
0
ファイル: codeinterfaces.py プロジェクト: gmrigna/abipy
    def excecute_flow(self, structure, spec_data):
        """
        excecute spec prepare input/jobfiles or submit to fw for a given structure
        for vasp the different jobs are created into a flow
        todo this should actually create and excecute a VaspGWWorkFlow(GWWorkflow)
        """
        ### general part for the base class
        grid = 0
        all_done = False
        converged = is_converged(False, structure)
        try:
            grid = read_grid_from_file(s_name(structure)+".full_res")['grid']
            all_done = read_grid_from_file(s_name(structure)+".full_res")['all_done']
        except (IOError, OSError):
            pass

        if all_done:
            print('| all is done for this material')
            return

        ### specific part

        if spec_data['mode'] == 'fw':
            fw_work_flow = VaspGWFWWorkFlow()
        else:
            fw_work_flow = []
        if spec_data['test'] or spec_data['converge']:
            if spec_data['test']:
                tests_prep = GWscDFTPrepVaspInputSet(structure, spec_data).tests
                tests_prep.update(GWDFTDiagVaspInputSet(structure, spec_data).tests)
            elif spec_data['converge'] and converged:
                tests_prep = self.get_conv_res_test(spec_data, structure)['tests_prep']
            else:
                tests_prep = GWscDFTPrepVaspInputSet(structure, spec_data).convs
                tests_prep.update(GWDFTDiagVaspInputSet(structure, spec_data).convs)
                if grid > 0:
                    tests_prep = expand(tests=tests_prep, level=grid)
                print(tests_prep)
            for test_prep in tests_prep:
                print('setting up test for: ' + test_prep)
                for value_prep in tests_prep[test_prep]['test_range']:
                    print("**" + str(value_prep) + "**")
                    option = {'test_prep': test_prep, 'value_prep': value_prep}
                    self.create_job(spec_data, structure, 'prep', fw_work_flow, converged, option)
                    for job in spec_data['jobs'][1:]:
                        if job == 'G0W0':
                            if spec_data['test']:
                                tests = GWG0W0VaspInputSet(structure, spec_data).tests
                            elif spec_data['converge'] and converged:
                                tests = self.get_conv_res_test(spec_data, structure)['tests']
                            else:
                                tests = GWG0W0VaspInputSet(structure, spec_data).convs
                                if grid > 0:
                                    tests = expand(tests=tests, level=grid)
                                print(tests)
                        if job in ['GW0', 'scGW0']:
                            input_set = GWG0W0VaspInputSet(structure, spec_data)
                            input_set.gw0_on()
                            if spec_data['test']:
                                tests = input_set.tests
                            else:
                                tests = input_set.tests
                        for test in tests:
                            print('    setting up test for: ' + test)
                            for value in tests[test]['test_range']:
                                print("    **" + str(value) + "**")
                                option.update({'test': test, 'value': value})
                                self.create_job(spec_data, structure, job, fw_work_flow, converged, option)
コード例 #4
0
ファイル: codeinterfaces.py プロジェクト: gmrigna/abipy
    def excecute_flow(self, structure, spec_data):
        """
        excecute spec prepare input/jobfiles or submit to fw for a given structure
        for vasp the different jobs are created into a flow
        todo this should actually create and excecute a VaspGWWorkFlow(GWWorkflow)
        """
        ### general part for the base class
        grid = 0
        all_done = False
        converged = is_converged(False, structure)
        try:
            grid = read_grid_from_file(s_name(structure) + ".full_res")['grid']
            all_done = read_grid_from_file(s_name(structure) +
                                           ".full_res")['all_done']
        except (IOError, OSError):
            pass

        if all_done:
            print('| all is done for this material')
            return

        ### specific part

        if spec_data['mode'] == 'fw':
            fw_work_flow = VaspGWFWWorkFlow()
        else:
            fw_work_flow = []
        if spec_data['test'] or spec_data['converge']:
            if spec_data['test']:
                tests_prep = GWscDFTPrepVaspInputSet(structure,
                                                     spec_data).tests
                tests_prep.update(
                    GWDFTDiagVaspInputSet(structure, spec_data).tests)
            elif spec_data['converge'] and converged:
                tests_prep = self.get_conv_res_test(spec_data,
                                                    structure)['tests_prep']
            else:
                tests_prep = GWscDFTPrepVaspInputSet(structure,
                                                     spec_data).convs
                tests_prep.update(
                    GWDFTDiagVaspInputSet(structure, spec_data).convs)
                if grid > 0:
                    tests_prep = expand(tests=tests_prep, level=grid)
                print(tests_prep)
            for test_prep in tests_prep:
                print('setting up test for: ' + test_prep)
                for value_prep in tests_prep[test_prep]['test_range']:
                    print("**" + str(value_prep) + "**")
                    option = {'test_prep': test_prep, 'value_prep': value_prep}
                    self.create_job(spec_data, structure, 'prep', fw_work_flow,
                                    converged, option)
                    for job in spec_data['jobs'][1:]:
                        if job == 'G0W0':
                            if spec_data['test']:
                                tests = GWG0W0VaspInputSet(
                                    structure, spec_data).tests
                            elif spec_data['converge'] and converged:
                                tests = self.get_conv_res_test(
                                    spec_data, structure)['tests']
                            else:
                                tests = GWG0W0VaspInputSet(
                                    structure, spec_data).convs
                                if grid > 0:
                                    tests = expand(tests=tests, level=grid)
                                print(tests)
                        if job in ['GW0', 'scGW0']:
                            input_set = GWG0W0VaspInputSet(
                                structure, spec_data)
                            input_set.gw0_on()
                            if spec_data['test']:
                                tests = input_set.tests
                            else:
                                tests = input_set.tests
                        for test in tests:
                            print('    setting up test for: ' + test)
                            for value in tests[test]['test_range']:
                                print("    **" + str(value) + "**")
                                option.update({'test': test, 'value': value})
                                self.create_job(spec_data, structure, job,
                                                fw_work_flow, converged,
                                                option)