def expand(tests, level): from abipy.gw.codeinterfaces import get_all_ecuteps, get_all_nbands new_tests = copy.deepcopy(tests) for test in tests.keys(): if test in get_all_ecuteps(): ec = str(test) ec_range = tests[ec]['test_range'] ec_step = ec_range[-1] - ec_range[-2] if int(level / 2) == level / 2: print('new ec wedge') # even level of grid extension > new ec wedge new_ec_range = (ec_range[-1] + int(level / 2 * ec_step),) else: print('new nb wedge') # odd level of grid extension > new nb wedge extension = tuple(range(ec_range[-1] + ec_step, ec_range[-1] + (1 + int((level - 1) / 2)) * ec_step, ec_step)) new_ec_range = ec_range + extension new_tests[ec].update({'test_range': new_ec_range}) if test in get_all_nbands(): nb = str(test) nb_range = tests[nb]['test_range'] nb_step = nb_range[-1] - nb_range[-2] print(nb_step) if int(level / 2) == level / 2: # even level of grid extension > new ec wedge extension = tuple(range(nb_range[-1] + nb_step, nb_range[-1] + (1 + int(level / 2)) * nb_step, nb_step)) new_nb_range = nb_range + extension else: # odd level of grid extension > new nb wedge new_nb_range = (nb_range[-1] + int((level + 1) / 2 * nb_step),) new_tests[nb].update({'test_range': new_nb_range}) print(new_tests) return new_tests
def expand(tests, level): from abipy.gw.codeinterfaces import get_all_ecuteps, get_all_nbands new_tests = copy.deepcopy(tests) for test in tests.keys(): if test in get_all_ecuteps(): ec = str(test) ec_range = tests[ec]['test_range'] ec_step = ec_range[-1] - ec_range[-2] if int(level / 2) == level / 2: print('new ec wedge') # even level of grid extension > new ec wedge new_ec_range = (ec_range[-1] + int(level / 2 * ec_step), ) else: print('new nb wedge') # odd level of grid extension > new nb wedge extension = tuple( range(ec_range[-1] + ec_step, ec_range[-1] + (1 + int( (level - 1) / 2)) * ec_step, ec_step)) new_ec_range = ec_range + extension new_tests[ec].update({'test_range': new_ec_range}) if test in get_all_nbands(): nb = str(test) nb_range = tests[nb]['test_range'] nb_step = nb_range[-1] - nb_range[-2] print(nb_step) if int(level / 2) == level / 2: # even level of grid extension > new ec wedge extension = tuple( range(nb_range[-1] + nb_step, nb_range[-1] + (1 + int(level / 2)) * nb_step, nb_step)) new_nb_range = nb_range + extension else: # odd level of grid extension > new nb wedge new_nb_range = (nb_range[-1] + int( (level + 1) / 2 * nb_step), ) new_tests[nb].update({'test_range': new_nb_range}) print(new_tests) return new_tests
def test_get_all_nbands(self): """ Testing functions related to code independed actions, number of bands """ self.assertEqual(set(get_all_nbands()), set(['nscf_nbands', 'NBANDS', 'new_code_nbands']))
def test_get_all_nbands(self): self.assertEqual(set(get_all_nbands()), set(['nscf_nbands', 'NBANDS', 'new_code_nbands']))