Ejemplo n.º 1
0
def get_calculation_values(type_dic):
    ti = copy.deepcopy(type_dic)
    #mbar=copy.deepcopy(type_dic)
    ti_function = TI()
    #mbar_function = MBAR()
    for ef_key in type_dic.keys():
        print(ef_key)
        ef_value = type_dic[ef_key]
        for ef_comp_sol_key in ef_value.keys():
            ef_comp_sol_value = ef_value[ef_comp_sol_key]
            for ef_cal_type_key in ef_comp_sol_value.keys():
                ef_cal_type_value = ef_comp_sol_value[ef_cal_type_key]
                ti_values = pd.concat(
                    [amber.extract_dHdl(ti) for ti in ef_cal_type_value])
                ti_function.fit(ti_values)
                ti[ef_key][ef_comp_sol_key][
                    ef_cal_type_key] = ti_function.delta_f_.loc[0.00, 0.50]
                #print (ef_key,ef_comp_sol_key,ef_cal_type_key,ti_function.delta_f_, ti_function.d_delta_f_)
                #mbar_values = pd.concat([amber.extract_u_nk(ti) for ti in ef_cal_type_value])
                #print (mbar_values)
                #print (ti_values)
                #mbar_function.fit(mbar_values)
                #print (mbar_values)
                #print (mbar_function.delta_f_)
                #print (ef_key,ef_comp_sol_key,ef_cal_type_key,mbar_function.delta_f_.loc[0.00, 0.50])
                #mbar[ef_key][ef_comp_sol_value][ef_cal_type_key] = mbar_function.delta_f_.loc[0.00, 0.50]
    return ti
Ejemplo n.º 2
0
def test_plot_ti_dhdl():
    '''Just test if the plot runs'''
    bz = load_benzene().data
    dHdl_coul = pd.concat([extract_dHdl(xvg, T=300) for xvg in bz['Coulomb']])
    ti_coul = TI()
    ti_coul.fit(dHdl_coul)
    assert isinstance(plot_ti_dhdl(ti_coul), matplotlib.axes.Axes)
    fig, ax = plt.subplots(figsize=(8, 6))
    assert isinstance(plot_ti_dhdl(ti_coul, ax=ax), matplotlib.axes.Axes)
    assert isinstance(plot_ti_dhdl(ti_coul, labels=['Coul']),
                      matplotlib.axes.Axes)
    assert isinstance(plot_ti_dhdl(ti_coul, labels=['Coul'], colors=['r']),
                      matplotlib.axes.Axes)
    dHdl_vdw = pd.concat([extract_dHdl(xvg, T=300) for xvg in bz['VDW']])
    ti_vdw = TI().fit(dHdl_vdw)
    assert isinstance(plot_ti_dhdl([ti_coul, ti_vdw]), matplotlib.axes.Axes)
    ti_coul.dhdl = pd.DataFrame.from_dict({
        'fep': range(100)
    },
                                          orient='index',
                                          columns=np.arange(100) / 100).T
    assert isinstance(plot_ti_dhdl(ti_coul), matplotlib.axes.Axes)