コード例 #1
0
def _write_kappa(lbte, filename=None, log_level=0):
    temperatures = lbte.get_temperatures()
    sigmas = lbte.get_sigmas()
    gamma = lbte.get_gamma()
    mesh = lbte.get_mesh_numbers()
    frequencies = lbte.get_frequencies()
    gv = lbte.get_group_velocities()
    ave_pp = lbte.get_averaged_pp_interaction()
    qpoints = lbte.get_qpoints()
    kappa = lbte.get_kappa()
    mode_kappa = lbte.get_mode_kappa()
    
    coleigs = lbte.get_collision_eigenvalues()

    for i, sigma in enumerate(sigmas):
        write_kappa_to_hdf5(temperatures,
                            mesh,
                            frequency=frequencies,
                            group_velocity=gv,
                            kappa=kappa[i],
                            mode_kappa=mode_kappa[i],
                            gamma=gamma[i],
                            averaged_pp_interaction=ave_pp,
                            qpoint=qpoints,
                            sigma=sigma,
                            filename=filename,
                            verbose=log_level)
        write_collision_eigenvalues_to_hdf5(temperatures,
                                            mesh,
                                            coleigs[i],
                                            sigma=sigma,
                                            filename=filename,
                                            verbose=log_level)
コード例 #2
0
def _write_kappa(br, volume, compression="gzip", filename=None, log_level=0):
    temperatures = br.get_temperatures()
    sigmas = br.get_sigmas()
    sigma_cutoff = br.get_sigma_cutoff_width()
    gamma = br.get_gamma()
    gamma_isotope = br.get_gamma_isotope()
    gamma_N, gamma_U = br.get_gamma_N_U()
    mesh = br.get_mesh_numbers()
    mesh_divisors = br.get_mesh_divisors()
    frequencies = br.get_frequencies()
    gv = br.get_group_velocities()
    gv_by_gv = br.get_gv_by_gv()
    mode_cv = br.get_mode_heat_capacities()
    ave_pp = br.get_averaged_pp_interaction()
    qpoints = br.get_qpoints()
    weights = br.get_grid_weights()
    kappa = br.get_kappa()
    mode_kappa = br.get_mode_kappa()

    for i, sigma in enumerate(sigmas):
        kappa_at_sigma = kappa[i]
        if gamma_isotope is not None:
            gamma_isotope_at_sigma = gamma_isotope[i]
        else:
            gamma_isotope_at_sigma = None
        if gamma_N is None:
            gamma_N_at_sigma = None
        else:
            gamma_N_at_sigma = gamma_N[i]
        if gamma_U is None:
            gamma_U_at_sigma = None
        else:
            gamma_U_at_sigma = gamma_U[i]

        write_kappa_to_hdf5(temperatures,
                            mesh,
                            frequency=frequencies,
                            group_velocity=gv,
                            gv_by_gv=gv_by_gv,
                            heat_capacity=mode_cv,
                            kappa=kappa_at_sigma,
                            mode_kappa=mode_kappa[i],
                            gamma=gamma[i],
                            gamma_isotope=gamma_isotope_at_sigma,
                            gamma_N=gamma_N_at_sigma,
                            gamma_U=gamma_U_at_sigma,
                            averaged_pp_interaction=ave_pp,
                            qpoint=qpoints,
                            weight=weights,
                            mesh_divisors=mesh_divisors,
                            sigma=sigma,
                            sigma_cutoff=sigma_cutoff,
                            kappa_unit_conversion=unit_to_WmK / volume,
                            compression=compression,
                            filename=filename,
                            verbose=log_level)
コード例 #3
0
def _write_kappa(br, volume, filename=None, log_level=0):
    temperatures = br.get_temperatures()
    sigmas = br.get_sigmas()
    sigma_cutoff = br.get_sigma_cutoff_width()
    gamma = br.get_gamma()
    gamma_isotope = br.get_gamma_isotope()
    gamma_N, gamma_U = br.get_gamma_N_U()
    mesh = br.get_mesh_numbers()
    mesh_divisors = br.get_mesh_divisors()
    frequencies = br.get_frequencies()
    gv = br.get_group_velocities()
    gv_by_gv = br.get_gv_by_gv()
    mode_cv = br.get_mode_heat_capacities()
    ave_pp = br.get_averaged_pp_interaction()
    qpoints = br.get_qpoints()
    weights = br.get_grid_weights()
    kappa = br.get_kappa()
    mode_kappa = br.get_mode_kappa()
    num_ignored_phonon_modes = br.get_number_of_ignored_phonon_modes()
    num_band = br.get_frequencies().shape[1]
    num_phonon_modes = br.get_number_of_sampling_grid_points() * num_band

    for i, sigma in enumerate(sigmas):
        kappa_at_sigma = kappa[i]
        if gamma_isotope is not None:
            gamma_isotope_at_sigma = gamma_isotope[i]
        else:
            gamma_isotope_at_sigma = None
        if gamma_N is None:
            gamma_N_at_sigma = None
        else:
            gamma_N_at_sigma = gamma_N[i]
        if gamma_U is None:
            gamma_U_at_sigma = None
        else:
            gamma_U_at_sigma = gamma_U[i]
        if log_level:
            text = "----------- Thermal conductivity (W/m-k) "
            if sigma:
                text += "for sigma=%s -----------" % sigma
            else:
                text += "with tetrahedron method -----------"
            print(text)
            if log_level > 1:
                print(("#%6s       " + " %-10s" * 6 + "#ipm") %
                      ("T(K)", "xx", "yy", "zz", "yz", "xz", "xy"))
                for j, (t, k) in enumerate(zip(temperatures, kappa_at_sigma)):
                    print(("%7.1f" + " %10.3f" * 6 + " %d/%d") %
                          ((t, ) + tuple(k) +
                           (num_ignored_phonon_modes[i, j], num_phonon_modes)))
            else:
                print(("#%6s       " + " %-10s" * 6) %
                      ("T(K)", "xx", "yy", "zz", "yz", "xz", "xy"))
                for j, (t, k) in enumerate(zip(temperatures, kappa_at_sigma)):
                    print(("%7.1f " + " %10.3f" * 6) % ((t, ) + tuple(k)))
            print('')

        write_kappa_to_hdf5(temperatures,
                            mesh,
                            frequency=frequencies,
                            group_velocity=gv,
                            gv_by_gv=gv_by_gv,
                            heat_capacity=mode_cv,
                            kappa=kappa_at_sigma,
                            mode_kappa=mode_kappa[i],
                            gamma=gamma[i],
                            gamma_isotope=gamma_isotope_at_sigma,
                            gamma_N=gamma_N_at_sigma,
                            gamma_U=gamma_U_at_sigma,
                            averaged_pp_interaction=ave_pp,
                            qpoint=qpoints,
                            weight=weights,
                            mesh_divisors=mesh_divisors,
                            sigma=sigma,
                            sigma_cutoff=sigma_cutoff,
                            kappa_unit_conversion=unit_to_WmK / volume,
                            filename=filename,
                            verbose=log_level)
コード例 #4
0
def _write_gamma(br, interaction, i, filename=None, verbose=True):
    grid_points = br.get_grid_points()
    group_velocities = br.get_group_velocities()
    gv_by_gv = br.get_gv_by_gv()
    mode_heat_capacities = br.get_mode_heat_capacities()
    ave_pp = br.get_averaged_pp_interaction()
    mesh = br.get_mesh_numbers()
    mesh_divisors = br.get_mesh_divisors()
    temperatures = br.get_temperatures()
    gamma = br.get_gamma()
    gamma_isotope = br.get_gamma_isotope()
    sigmas = br.get_sigmas()
    sigma_cutoff = br.get_sigma_cutoff_width()
    volume = interaction.get_primitive().get_volume()
    gamma_N, gamma_U = br.get_gamma_N_U()

    gp = grid_points[i]
    if all_bands_exist(interaction):
        if ave_pp is None:
            ave_pp_i = None
        else:
            ave_pp_i = ave_pp[i]
        frequencies = interaction.get_phonons()[0][gp]
        for j, sigma in enumerate(sigmas):
            if gamma_isotope is not None:
                gamma_isotope_at_sigma = gamma_isotope[j, i]
            else:
                gamma_isotope_at_sigma = None
            if gamma_N is None:
                gamma_N_at_sigma = None
            else:
                gamma_N_at_sigma = gamma_N[j, :, i]
            if gamma_U is None:
                gamma_U_at_sigma = None
            else:
                gamma_U_at_sigma = gamma_U[j, :, i]

            write_kappa_to_hdf5(temperatures,
                                mesh,
                                frequency=frequencies,
                                group_velocity=group_velocities[i],
                                gv_by_gv=gv_by_gv[i],
                                heat_capacity=mode_heat_capacities[:, i],
                                gamma=gamma[j, :, i],
                                gamma_isotope=gamma_isotope_at_sigma,
                                gamma_N=gamma_N_at_sigma,
                                gamma_U=gamma_U_at_sigma,
                                averaged_pp_interaction=ave_pp_i,
                                mesh_divisors=mesh_divisors,
                                grid_point=gp,
                                sigma=sigma,
                                sigma_cutoff=sigma_cutoff,
                                kappa_unit_conversion=unit_to_WmK / volume,
                                filename=filename,
                                verbose=verbose)
    else:
        for j, sigma in enumerate(sigmas):
            for k, bi in enumerate(interaction.get_band_indices()):
                if ave_pp is None:
                    ave_pp_ik = None
                else:
                    ave_pp_ik = ave_pp[i, k]
                frequencies = interaction.get_phonons()[0][gp, bi]
                if gamma_isotope is not None:
                    gamma_isotope_at_sigma = gamma_isotope[j, i, k]
                else:
                    gamma_isotope_at_sigma = None
                if gamma_N is None:
                    gamma_N_at_sigma = None
                else:
                    gamma_N_at_sigma = gamma_N[j, :, i, k]
                if gamma_U is None:
                    gamma_U_at_sigma = None
                else:
                    gamma_U_at_sigma = gamma_U[j, :, i, k]
                write_kappa_to_hdf5(temperatures,
                                    mesh,
                                    frequency=frequencies,
                                    group_velocity=group_velocities[i, k],
                                    gv_by_gv=gv_by_gv[i, k],
                                    heat_capacity=mode_heat_capacities[:, i,
                                                                       k],
                                    gamma=gamma[j, :, i, k],
                                    gamma_isotope=gamma_isotope_at_sigma,
                                    gamma_N=gamma_N_at_sigma,
                                    gamma_U=gamma_U_at_sigma,
                                    averaged_pp_interaction=ave_pp_ik,
                                    mesh_divisors=mesh_divisors,
                                    grid_point=gp,
                                    band_index=bi,
                                    sigma=sigma,
                                    sigma_cutoff=sigma_cutoff,
                                    kappa_unit_conversion=unit_to_WmK / volume,
                                    filename=filename,
                                    verbose=verbose)