Exemplo n.º 1
0
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)
Exemplo n.º 2
0
        am = [a[0] for a in am]

        if len(set(am)) != len(am):
            raise RuntimeError("Duplicate AM?")

        # Now loop over the shells and trim
        old_shells = sorted(eldata.pop('electron_shells'),
                            key=lambda x: x['angular_momentum'][0])

        for idx2, sh in enumerate(old_shells):
            if idx2 >= len(el_split):
                continue

            shell_split = el_split[idx2]
            n = int(shell_split[:-1])
            amchar = shell_split[-1]

            assert lut.amchar_to_int(amchar) == sh['angular_momentum']

            sh['coefficients'] = sh['coefficients'][:n]
            new_shells.append(sh)

        eldata['electron_shells'] = new_shells

    # Remove elements that aren't in the new contraction
    for el in missing_el:
        new_basis['elements'].pop(el)

    new_basis = manip.prune_basis(new_basis)
    fileio.write_json_basis(name + '.1.json', new_basis)