def test_amchar(am): # Check that converting am characters, etc, is consistent s = lut.amint_to_char([am]) assert am == lut.amchar_to_int(s)[0] combined = list(range(am + 1)) s = lut.amint_to_char(combined) assert combined == lut.amchar_to_int(s)
def test_amchar_special(): s = lut.amint_to_char([5, 6, 7]) assert s == 'hik' s = lut.amint_to_char([5, 6, 7], hij=True) assert s == 'hij' s = lut.amint_to_char([0, 1]) assert s == 'sp' s = lut.amint_to_char([0, 1], use_L=True) assert s == 'l'
def test_amint_to_char_fail(am): with pytest.raises(IndexError, match=r'Angular momentum.*(out of range|must be a positive)'): lut.amint_to_char(am)
assert el1 == el2 assert name2 == 'ANO-RCC' assert name1 in all_names el = lut.element_Z_from_sym(el1, as_str=True) assert el not in split_data[name1] cont = re.findall(r'\d+[a-z]+', cont) split_data[name1][el] = cont print(split_data) for name, el_cont_data in split_data.items(): print(name) new_basis = api.get_basis(name) for el, eldata in new_basis['elements'].items(): el_split = el_cont_data[el] am = [sh['angular_momentum'] for sh in eldata['electron_shells']] new_pattern = [] for sh in eldata['electron_shells']: new_pattern.append('{}{}'.format( len(sh['coefficients']), lut.amint_to_char(sh['angular_momentum']))) print(lut.element_sym_from_Z(el, True), ''.join(new_pattern)) assert new_pattern == el_split print()