Exemple #1
0
def action():
    import os
    import pickle
    if os.path.exists('var.pkl'):
        with open('var.pkl', 'rb') as f:
            return pickle.load(f)

    if os.path.exists('input.fdf'):
        soft = 'tdap'
    elif os.path.exists('input.in'):
        soft = 'tdpw'
        input = 'input.in'
        output = 'result'
    elif os.path.exists('tdap.in'):
        soft = 'tdpw'
        input = 'tdap.in'
        output = 'tdap.out'

    if soft == 'tdap':
        from py3ramids.io.SIESTA_interface import TdapVarible
        var = TdapVarible()
    else:
        from py3ramids.io.ESPRESSO_interface import TdpwVarible
        var = TdpwVarible(inputFile=input, outputFile=output)

    with open('var.pkl', 'wb') as f:
        pickle.dump(var, f)

    return var
Exemple #2
0
        ax[0],
        ylabel='Re $\epsilon$ (a.u.)',
        xlabel='Energy (eV)',
        ylimits=[-0.02, 0.02],
        #xlimits=[0,10]
    )


if __name__ == '__main__':
    import os
    if os.path.exists('input.fdf'):
        soft = 'tdap'
    elif os.path.exists('input.in'):
        soft = 'tdpw'

    if soft == 'tdap':
        from py3ramids.io.SIESTA_interface import TdapVarible
        var = TdapVarible()
    else:
        from py3ramids.io.ESPRESSO_interface import TdpwVarible
        var = TdpwVarible()

    import matplotlib.pyplot as plt
    fig, ax = plt.subplots(2, 1, figsize=(8, 8), sharex=True)

    plot(ax, var)

    plt.tight_layout()
    SaveName = __file__.split('/')[-1].split('.')[0]
    plt.savefig(SaveName + '.pdf')