Пример #1
0
def test_read_write_basis(file_path):
    # needed to be tested to make sure something isn't left
    # out of the sort lists, etc
    full_path = os.path.join(_data_dir, file_path)
    full_path_new = full_path + '.new'
    data = fileio.read_json_basis(full_path)
    fileio.write_json_basis(full_path_new, data)
    os.remove(full_path_new)
Пример #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)