Пример #1
0
def process_gw_calculation(path: str, gaps: List[Gap]) -> dict:
    """
    Process GW calculation results for VB and CB points specified in gaps

    :param str path: Path to GW files
    :param List[Gap] gaps: List of VB and CB points

    :return: dict gw_results: Processed GW data for QP and KS energies for specified gaps
    """
    print('Reading data from ', path)
    gw_data = parse_gw_info(path)
    qp_data = parse_gw_evalqp(path)

    gw_results = {}

    for gap in gaps:
        results = process_gw_gap(gw_data, qp_data, gap.v, gap.c)
        gap_label = gap.v_label + '_' + gap.c_label
        try:
            gw_results['E_qp_' + gap_label] = np.array(results['E_qp'])
            gw_results['E_ks_' + gap_label] = np.array(results['E_ks'])
            gw_results['delta_E_qp_' + gap_label] = np.array(results['E_qp'] - results['E_ks'])
        except KeyError:
            return gw_results

    return gw_results
Пример #2
0
def parse_gw_results_two(gw_root: str, directories: list) -> dict:
    """

    QP direct-gap (relative to the KS gap)
    and self-energies of the band edges at Gamma.

    Almost easier to just path full directive strings.

    :return: dictionary containing the above.
    """

    # Data to parse and return
    delta_E_qp = np.empty(shape=(len(directories)))
    re_self_energy_VBM = np.empty(shape=delta_E_qp.shape)
    re_self_energy_CBm = np.empty(shape=delta_E_qp.shape)

    # Directory extension
    for ienergy, directory in enumerate(directories):
        file_path = gw_root + '/' + directory
        gw_data = parse_gw_info(file_path)
        qp_data = parse_gw_evalqp(file_path)
        print('Reading data from ', file_path)
        results = process_gw_gamma_point(gw_data, qp_data)
        delta_E_qp[ienergy] = results['E_qp'] - results['E_ks']
        re_self_energy_VBM[ienergy] = results['re_sigma_VBM']
        re_self_energy_CBm[ienergy] = results['re_sigma_CBm']

    return {
        'delta_E_qp': delta_E_qp,
        're_self_energy_VBM': re_self_energy_VBM,
        're_self_energy_CBm': re_self_energy_CBm
    }
Пример #3
0
def process_gw_calculation(path: str) -> dict:
    """
    :param str path: Path to GW files
    :return: dict Processed GW data
    """
    print('Reading data from ', path)
    gw_data = parse_gw_info(path)
    qp_data = parse_gw_evalqp(path)
    results = process_gw_gamma_point(gw_data, qp_data)

    if not results:
        return {
            'delta_E_qp': [],
            're_self_energy_VBM': [],
            're_self_energy_CBm': []
        }

    X_point = [0., 0.5, 0.5]
    Gamma_point = [0., 0., 0.]

    # Specific to the A1 system X (valence) -> Gamma (conduction)
    results_x_gamma = process_gw_gap(gw_data, qp_data, X_point, Gamma_point)
    results_x_x = process_gw_gap(gw_data, qp_data, X_point, X_point)

    return {
        'E_qp': np.array(results['E_qp']),
        'E_ks': np.array(results['E_ks']),
        'E_qp_X_Gamma': np.array(results_x_gamma['E_qp']),
        'E_ks_X_Gamma': np.array(results_x_gamma['E_ks']),
        'E_qp_X_X': np.array(results_x_x['E_qp']),
        'E_ks_X_X': np.array(results_x_x['E_ks']),
        'delta_E_qp': np.array(results['E_qp'] - results['E_ks']),
        're_self_energy_VBM': np.array(results['re_sigma_VBM']),
        're_self_energy_CBm': np.array(results['re_sigma_CBm'])
    }
Пример #4
0
def process_gw_calculation(path: str, gaps: List[Gap]) -> dict:
    """
    Process GW calculation results for VB and CB points specified in gaps

    :param str path: Path to GW files
    :param List[Gap] gaps: List of VB and CB points

    :return: dict gw_results: Processed GW data for QP and KS energies for specified gaps
    """
    print('Reading data from ', path)
    gw_data = parse_gw_info(path)
    qp_data = parse_gw_evalqp(path)

    gw_results = {}

    for gap in gaps:
        results = process_gw_gap(gw_data, qp_data, gap.v, gap.c)
        gap_label = gap.v_label + '_' + gap.c_label
        try:
            gw_results['E_qp_' + gap_label] = np.array(results['E_qp'])
            gw_results['E_ks_' + gap_label] = np.array(results['E_ks'])
            gw_results['delta_E_qp_' + gap_label] = np.array(results['E_qp'] -
                                                             results['E_ks'])
        except KeyError:
            return gw_results

    # Haven't tested these, but assume same irrespective of k-point?:
    #gw_results['re_self_energy_VBM_' + gap.v_label] = np.array(results['re_sigma_VBM'])
    #gw_results['re_self_energy_CBm' + gap.c_label] = np.array(results['re_sigma_CBm'])

    return gw_results
Пример #5
0
def parse_gw_results(root:str, settings:dict) -> dict:
    """

    QP direct-gap (relative to the KS gap)
    and self-energies of the band edges at Gamma.

    Almost easier to just path full directive strings.

    :return: dictionary containing the above.
    """

    # Basis settings
    rgkmax = settings['rgkmax']
    l_max_values = settings['l_max_values']
    max_energy_exts = settings['max_energy_cutoffs']

    # GW settings
    n_empty_ext = settings['n_empty_ext']
    q_grid = settings['q_grid']
    n_img_freq = settings['n_img_freq']

    # Data to parse and return
    delta_E_qp = np.empty(shape=(len(max_energy_exts), len(l_max_values)))
    re_self_energy_VBM = np.empty(shape=delta_E_qp.shape)
    re_self_energy_CBm = np.empty(shape=delta_E_qp.shape)
    q_str = "".join(str(q) for q in q_grid)

    # Lmax in LO basis
    for i, l_max in enumerate(l_max_values):
        basis_root = root + '/' + directory_string(l_max) + 'rgkmax' + str(rgkmax)
        gw_root = basis_root + "/gw_q" + q_str + "_omeg" + str(n_img_freq) + "_nempty" + str(n_empty_ext[i])

        # Max energy cut-off of LOs in each l-channel
        for ienergy, energy in enumerate(max_energy_exts):
            file_path = gw_root + '/max_energy_' + str(energy)

            gw_data = parse_gw_info(file_path)
            qp_data = parse_gw_evalqp(file_path)

            print('Reading data from ', file_path)
            results = process_gw_gamma_point(gw_data, qp_data)
            delta_E_qp[ienergy, i] = results['E_qp'] - results['E_ks']
            re_self_energy_VBM[ienergy, i] = results['re_sigma_VBM']
            re_self_energy_CBm[ienergy, i] = results['re_sigma_CBm']

    return {'delta_E_qp': delta_E_qp,
            're_self_energy_VBM': re_self_energy_VBM,
            're_self_energy_CBm': re_self_energy_CBm
            }
Пример #6
0
def process_gw_calculation(path: str) -> dict:
    """
    This could be a more generic routine

    # TODO(Alex) Check parse_gw_evalqp parser is valid (and replace with one from exciting tools)

    :param str path: Path to GW files
    :return: dict Processed GW data
    """
    print('Reading data from ', path)
    gw_data = parse_gw_info(path)
    qp_data = parse_gw_evalqp(path)
    results = process_gw_gamma_point(gw_data, qp_data)

    if not results:
        return {
            'delta_E_qp': [],
            're_self_energy_VBM': [],
            're_self_energy_CBm': []
        }

    X_point = [0., 0.5, 0.5]
    Gamma_point = [0., 0., 0.]

    # Specific to the A1 system X (valence) -> Gamma (conduction)
    results_x_gamma = process_gw_gap(gw_data, qp_data, X_point, Gamma_point)
    results_x_x = process_gw_gap(gw_data, qp_data, X_point, X_point)

    return {
        'E_qp': np.array(results['E_qp']),
        'E_ks': np.array(results['E_ks']),
        'E_qp_X_Gamma': np.array(results_x_gamma['E_qp']),
        'E_ks_X_Gamma': np.array(results_x_gamma['E_ks']),
        'E_qp_X_X': np.array(results_x_x['E_qp']),
        'E_ks_X_X': np.array(results_x_x['E_ks']),
        'delta_E_qp': np.array(results['E_qp'] - results['E_ks']),
        're_self_energy_VBM': np.array(results['re_sigma_VBM']),
        're_self_energy_CBm': np.array(results['re_sigma_CBm'])
    }
Пример #7
0
from parse.parse_gw import parse_gw_evalqp, parse_gw_info, parse_gw_timings

gw_data = parse_gw_info(file_path="./parse")
qp_data = parse_gw_evalqp("./parse", nempty=600, nkpts=3)
gw_timings = parse_gw_timings(file_path="./parse")

# qp - ks at gamma
process_gw_gamma_point(gw_data, qp_data)

# TODOs
# 	⁃	parse lorecommendations.
# 	⁃	    The main thing to do with avoiding low n states, is to know the nodal structure associated with the functions of a given l, already in the basis
# 	⁃	    See question to Andris ==> CORRECTLY SET UP OPTIMISED BASIS
# 	⁃	Label basis not with trial energies but with number of los per l-channel
# 	⁃	    See the downloaded paper and then ask
# 	⁃	Generate slurm or pbs input
# 	⁃	    Write my own or do with Aiida?
# 	⁃	GW input from ground state
# 	⁃	Parse ground state, change ground state fromscratch to fromfile, add GW options
# 	⁃	Some post-processing to get the data formats for plotting