Пример #1
0
def init_ff(forcefield):
    if forcefield in ff_cache:
        return
    init_caflisch()
    ff_cache[forcefield] = {}
    res = ff_cache[forcefield]

    ifname = forcefield + "-caflisch.dat"
    ifile = pkg_resources.resource_stream(__name__, ifname)

    for line in tools.conffile(ifile):
        ff_type, cal_type = (int(x) for x in line.split())
        if ff_type in res:
            raise RuntimeError("duplicate type")
        if cal_type != 0:
            res[ff_type] = caflisch_dat[cal_type]
        else:
            res[ff_type] = None
Пример #2
0
def read_corr(ifile):
    res = []
    for line in conffile(ifile):
        res.append([int(x)-1 for x in line.split()])
        assert len(res[-1]) == 2
    return res