Exemplo n.º 1
0
def tc_from_a2f_allen_dynes(filename, mu_stars=[0.1, 0.15],
    attenuation_freq=None, get_lambda=False):

    # Parse the a2f file, ignore negative frequencies/elishberg function
    out = parser.a2f_dos_out(filename)

    return tc_allen_dynes(out["frequencies"], out["a2f"], 
        mu_stars=mu_stars, attenuation_freq=attenuation_freq, get_lambda=get_lambda)
Exemplo n.º 2
0
def tc_from_a2f_file_eliashberg(filename, mu_stars=[0.1, 0.15], force=False):
    out = parser.a2f_dos_out(filename)
    wa  = [[w,max(a,0)] for w,a in zip(out["frequencies"], out["a2f"]) if w > 0]
    ws  = [w for w,a in wa]
    a2f = [a for w,a in wa]
    dosn = filename.split("dos")[-1]
    basedir = "/".join(filename.split("/")[0:-1])
    tc_dir = basedir + "/tc_dos_" + dosn
    return tc_from_a2f_eliashberg(tc_dir, ws, a2f, mu_stars=mu_stars, force=force)
Exemplo n.º 3
0
Arquivo: plots.py Projeto: miicck/qet
def plot_a2fs(filenames=[]):
    import matplotlib.pyplot as plt

    for f in filenames:
        out = parser.a2f_dos_out(f)
        ws = out["frequencies"]
        ws = [w * constants.RY_TO_CMM1 for w in ws]
        a2f = out["a2f"]
        was = [[w, a] if (w > 0 and a > 0) else [w, 0]
               for w, a in zip(ws, a2f)]
        ws, a2fs = zip(*was)

        plt.fill_between(ws, 0, a2fs, alpha=0.5, label=f)

    plt.ylabel("$\\alpha^2F(\\omega)$")
    plt.xlabel("Phonon frequency $(\\omega, cm^{-1})$")
    plt.legend()
    plt.show()
Exemplo n.º 4
0
import sys
import numpy as np
import matplotlib.pyplot as plt
from qet import parser
from qet.calculations import tc_allen_dynes
from qet.constants import RY_TO_CMM1

modes = parser.phonon_interp_modes("ph_interp.modes")
a2f = parser.a2f_dos_out("a2F.dos10")
a2f_freqs = a2f["frequencies"]
mode_freqs = modes["frequencies"]
mode_evecs = modes["eigenvectors"]
mode_qpts = modes["q-points"]
mode_count = int(len(mode_freqs) / len(mode_qpts))
atom_count = int(mode_count / 3)
CMM_SCALE = 10


def tc_from_a2f(a2f):
    return tc_allen_dynes(a2f_freqs, a2f, mu_stars=[0.125])[0.125]


# Work out the Tc contribution from each frequency
tc_contribs = []
tc_with_all = tc_from_a2f(a2f["a2f"])
for i in range(len(a2f_freqs)):
    a2fi = list(a2f["a2f"])
    a2fi[i] = 0
    tc_i = tc_with_all - tc_from_a2f(a2fi)
    if tc_i < 0: tc_i = 0
    tc_contribs.append(tc_i)
Exemplo n.º 5
0
Arquivo: plots.py Projeto: miicck/qet
def plot_a2f(filename="./a2F.dos1", safe=False):
    import matplotlib.pyplot as plt
    from qet.calculations import tc_from_a2f_allen_dynes, tc_allen_dynes

    out = parser.a2f_dos_out(filename)
    tc = tc_from_a2f_allen_dynes(filename)

    # Convert frequencies to Cm^-1
    ws = out["frequencies"]
    ws = [w * constants.RY_TO_CMM1 for w in ws]

    # Start first plot (a2f)
    plt.subplot(211)

    # Run over mode-resolved eliashberg functions
    total = None
    i_mode = 1
    while "a2f_mode_{0}".format(i_mode) in out:

        # Get this constribution and the cumulative total
        a2f_mode = out["a2f_mode_{0}".format(i_mode)]
        if total is None: total = [0.0 for a in a2f_mode]
        ta_func = lambda t, a: t + a
        if safe: ta_func = lambda t, a: max(t + a, 0)
        new_total = [ta_func(t, a) for t, a in zip(total, a2f_mode)]

        if safe:
            for i in range(0, len(ws)):
                if ws[i] < 0:
                    new_total[i] = 0

        # Fill in this contribution
        plt.fill_between(ws, total, new_total)

        # Move to next node
        total = new_total
        i_mode += 1

    plt.suptitle("$Tc \in [{0}, {1}]$".format(round(tc[0.15]), round(tc[0.1])))
    plt.xlabel("Frequency $\\omega$ (cm$^{-1}$)")
    plt.ylabel("$\\alpha^2F(\\omega)$\n(colored by mode)")

    # Start second plot (d(Tc)/d(a2f))
    plt.subplot(212)

    a2f = out["a2f"]
    epsilon = max(a2f) / 1000.0
    tc_0 = tc[0.1]
    dtc_da2f = [0.0] * len(a2f)

    for i in range(len(a2f)):
        a2f_tmp = list(a2f)
        a2f_tmp[i] += epsilon
        tc_1 = tc_allen_dynes(out["frequencies"], a2f_tmp, mu_stars=[0.1])[0.1]
        dtc_da2f[i] = (tc_1 - tc_0) / epsilon

    plt.plot(ws, dtc_da2f)
    plt.axhline(0, color="black")
    plt.xlabel("Frequency $\\omega$ (cm$^{-1}$)")
    plt.ylabel("$d(T_c)/d(\\alpha^2F)(\\omega)$")

    # Show the plot
    plt.show()