Esempio n. 1
0
def parse_kkr_outputfile(out_dict,
                         outfile,
                         outfile_0init,
                         outfile_000,
                         timing_file,
                         potfile_out,
                         nonco_out_file,
                         outfile_2='output.2.txt',
                         skip_readin=False):
    """
    Parser method for the kkr outfile. It returns a dictionary with results
    """
    # scaling factors etc. defined globally
    Ry2eV = get_Ry2eV()
    doscalc = False

    # collection of parsing error messages
    msg_list = []

    try:
        code_version, compile_options, serial_number = get_version_info(
            outfile)
        tmp_dict = {}
        tmp_dict['code_version'] = code_version
        tmp_dict['compile_options'] = compile_options
        tmp_dict['calculation_serial_number'] = serial_number
        out_dict['code_info_group'] = tmp_dict
    except:
        msg = "Error parsing output of KKR: Version Info"
        msg_list.append(msg)

    try:
        nspin = get_nspin(outfile_0init)
        natom = get_natom(outfile_0init)
        newsosol = use_newsosol(outfile_0init)
        out_dict['nspin'] = nspin
        out_dict['number_of_atoms_in_unit_cell'] = natom
        out_dict['use_newsosol'] = newsosol
    except:
        msg = "Error parsing output of KKR: nspin/natom"
        msg_list.append(msg)

    try:
        result = find_warnings(outfile)
        tmp_dict = {}
        tmp_dict['number_of_warnings'] = len(result)
        tmp_dict['warnings_list'] = result
        out_dict['warnings_group'] = tmp_dict
    except:
        msg = "Error parsing output of KKR: search for warnings"
        msg_list.append(msg)

    try:
        result = extract_timings(timing_file)
        out_dict['timings_group'] = result
        out_dict['timings_unit'] = 'seconds'
    except:
        msg = "Error parsing output of KKR: timings"
        msg_list.append(msg)

    try:
        emin, tempr, Nepts, Npol, N1, N2, N3 = get_econt_info(outfile_0init)
        tmp_dict = {}
        tmp_dict['emin'] = emin
        tmp_dict['emin_unit'] = 'Rydberg'
        tmp_dict['number_of_energy_points'] = Nepts
        tmp_dict['temperature'] = tempr
        tmp_dict['temperature_unit'] = 'Kelvin'
        tmp_dict['npol'] = Npol
        tmp_dict['n1'] = N1
        tmp_dict['n2'] = N2
        tmp_dict['n3'] = N3
        out_dict['energy_contour_group'] = tmp_dict
        if Npol == 0:
            doscalc = True
    except:
        msg = "Error parsing output of KKR: energy contour"
        msg_list.append(msg)

    try:
        alat, twopioveralat = get_alatinfo(outfile_0init)
        out_dict['alat_internal'] = alat
        out_dict['two_pi_over_alat_internal'] = twopioveralat
        out_dict['alat_internal_unit'] = 'a_Bohr'
        out_dict['two_pi_over_alat_internal_unit'] = '1/a_Bohr'
    except:
        msg = "Error parsing output of KKR: alat, 2*pi/alat"
        msg_list.append(msg)

    try:
        nkmesh, kmesh_ie = get_kmeshinfo(outfile_0init, outfile_000)
        tmp_dict = {}
        tmp_dict['number_different_kmeshes'] = nkmesh[0]
        tmp_dict['number_kpoints_per_kmesh'] = nkmesh[1]
        tmp_dict['kmesh_energypoint'] = kmesh_ie
        out_dict['kmesh_group'] = tmp_dict
    except:
        msg = "Error parsing output of KKR: kmesh"
        msg_list.append(msg)

    try:
        nsym, nsym_used, desc = get_symmetries(outfile_0init)
        tmp_dict = {}
        tmp_dict['number_of_lattice_symmetries'] = nsym
        tmp_dict['number_of_used_symmetries'] = nsym_used
        tmp_dict['symmetry_description'] = desc
        out_dict['symmetries_group'] = tmp_dict
    except:
        msg = "Error parsing output of KKR: symmetries"
        msg_list.append(msg)

    if not doscalc:  # in case of dos calculation no ewald summation is done
        try:
            rsum, gsum, info = get_ewald(outfile_0init)
            tmp_dict = {}
            tmp_dict['ewald_summation_mode'] = info
            tmp_dict['rsum_cutoff'] = rsum[0]
            tmp_dict['rsum_number_of_vectors'] = rsum[1]
            tmp_dict['rsum_number_of_shells'] = rsum[2]
            tmp_dict['rsum_cutoff_unit'] = 'a_Bohr'
            tmp_dict['gsum_cutoff'] = gsum[0]
            tmp_dict['gsum_number_of_vectors'] = gsum[1]
            tmp_dict['gsum_number_of_shells'] = gsum[2]
            tmp_dict['gsum_cutoff_unit'] = '1/a_Bohr'
            out_dict['ewald_sum_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: ewald summation for madelung poterntial"
            msg_list.append(msg)

    try:
        bv, recbv = get_lattice_vectors(outfile_0init)
        out_dict['direct_bravais_matrix'] = bv
        out_dict['reciprocal_bravais_matrix'] = recbv
        out_dict['direct_bravais_matrix_unit'] = 'alat'
        out_dict['reciprocal_bravais_matrix_unit'] = '2*pi / alat'
    except:
        msg = "Error parsing output of KKR: lattice vectors (direct/reciprocal)"
        msg_list.append(msg)

    # this is skipped for qdos run for example
    if not skip_readin:
        try:
            ncore, emax, lmax, descr_max = get_core_states(potfile_out)
            tmp_dict = {}
            tmp_dict['number_of_core_states_per_atom'] = ncore
            tmp_dict['energy_highest_lying_core_state_per_atom'] = emax
            tmp_dict[
                'energy_highest_lying_core_state_per_atom_unit'] = 'Rydberg'
            tmp_dict['descr_highest_lying_core_state_per_atom'] = descr_max
            out_dict['core_states_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: core_states"
            msg_list.append(msg)

        tmp_dict = {
        }  # used to group convergence info (rms, rms per atom, charge neutrality)
        # also initialize convegence_group where all info stored for all iterations is kept
        out_dict['convergence_group'] = tmp_dict
        try:
            result, result_atoms_last = get_rms(outfile, outfile_000)
            tmp_dict['rms'] = result[-1]
            tmp_dict['rms_all_iterations'] = result
            tmp_dict['rms_per_atom'] = result_atoms_last
            tmp_dict['rms_unit'] = 'unitless'
            out_dict['convergence_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: rms-error"
            msg_list.append(msg)

        try:
            result = get_neutr(outfile)
            tmp_dict['charge_neutrality'] = result[-1]
            out_dict['convergence_group'][
                'charge_neutrality_all_iterations'] = result
            tmp_dict['charge_neutrality_unit'] = 'electrons'
            out_dict['convergence_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: charge neutrality"
            msg_list.append(msg)

        tmp_dict = {
        }  # used to group magnetism info (spin and orbital moments)
        try:
            result = get_magtot(outfile)
            if len(result) > 0:
                tmp_dict['total_spin_moment'] = result[-1]
                out_dict['convergence_group'][
                    'total_spin_moment_all_iterations'] = result
                tmp_dict['total_spin_moment_unit'] = 'mu_Bohr'
                out_dict['magnetism_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: total magnetic moment"
            msg_list.append(msg)

        try:
            if nspin > 1:
                if not newsosol:
                    #reset automatically to None to turn off reading of nonco angles file
                    nonco_out_file = None

                result, vec, angles = get_spinmom_per_atom(
                    outfile, natom, nonco_out_file)
                if len(result) > 0:
                    tmp_dict['spin_moment_per_atom'] = result[-1, :]
                    if newsosol:
                        tmp_dict['spin_moment_vector_per_atom'] = vec[:]
                        tmp_dict['spin_moment_angles_per_atom'] = angles[:]
                        tmp_dict['spin_moment_angles_per_atom_unit'] = 'degree'
                    out_dict['convergence_group'][
                        'spin_moment_per_atom_all_iterations'] = result[:, :]
                    tmp_dict['spin_moment_unit'] = 'mu_Bohr'
                    out_dict['magnetism_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: spin moment per atom"
            msg_list.append(msg)

        # add orbital moments to magnetis group in parser output
        try:
            if nspin > 1 and newsosol:
                #TODO orbital moment full vectors
                # so far the KKR code writes only the component of the orbital moment
                # parallel to the spin moment, thus vec and angles are returned empty
                # by construction. This might change in the future
                #result, vec, angles = get_orbmom(outfile, natom, nonco_angles_orbmom)
                # so for now return only result= array containing all iterations, all atoms, orbital moment parallel to spin quantization axis
                result = get_orbmom(outfile, natom)
                if len(result) > 0:
                    tmp_dict['total_orbital_moment'] = sum(result[-1, :])
                    tmp_dict['orbital_moment_per_atom'] = result[-1, :]
                    #tmp_dict['orbital_moment_vector_per_atom'] = vec[-1,:]
                    #tmp_dict['orbital_moment_angles_per_atom'] = angles[-1,:]
                    out_dict['convergence_group'][
                        'orbital_moment_per_atom_all_iterations'] = result[:, :]
                    tmp_dict['orbital_moment_unit'] = 'mu_Bohr'
                    #tmp_dict['orbital_moment_angles_per_atom_unit'] = 'degree'
                    out_dict['magnetism_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKR: orbital moment"
            msg_list.append(msg)

        try:
            result = get_EF(outfile)
            out_dict['fermi_energy'] = result[-1]
            out_dict['fermi_energy_units'] = 'Ry'
            out_dict['convergence_group'][
                'fermi_energy_all_iterations'] = result
            out_dict['convergence_group'][
                'fermi_energy_all_iterations_units'] = 'Ry'
        except:
            msg = "Error parsing output of KKR: EF"
            msg_list.append(msg)

        try:
            result = get_DOS_EF(outfile)
            out_dict['dos_at_fermi_energy'] = result[-1]
            out_dict['convergence_group'][
                'dos_at_fermi_energy_all_iterations'] = result
        except:
            msg = "Error parsing output of KKR: DOS@EF"
            msg_list.append(msg)

        try:
            result = get_Etot(outfile)
            out_dict['energy'] = result[-1] * Ry2eV
            out_dict['energy_unit'] = 'eV'
            out_dict['total_energy_Ry'] = result[-1]
            out_dict['total_energy_Ry_unit'] = 'Rydberg'
            out_dict['convergence_group'][
                'total_energy_Ry_all_iterations'] = result
        except:
            msg = "Error parsing output of KKR: total energy"
            msg_list.append(msg)

        try:
            result = get_single_particle_energies(outfile_000)
            out_dict['single_particle_energies'] = result * Ry2eV
            out_dict['single_particle_energies_unit'] = 'eV'
        except:
            msg = "Error parsing output of KKR: single particle energies"
            msg_list.append(msg)

        try:
            result_WS, result_tot, result_C = get_charges_per_atom(outfile_000)
            niter = len(out_dict['convergence_group']['rms_all_iterations'])
            natyp = int(len(result_tot) // niter)
            out_dict['total_charge_per_atom'] = result_tot[-natyp:]
            out_dict['charge_core_states_per_atom'] = result_C[-natyp:]
            # this check deals with the DOS case where output is slightly different
            if len(result_WS) == len(result_C):
                out_dict['charge_valence_states_per_atom'] = result_WS[
                    -natyp:] - result_C[-natyp:]
            out_dict['total_charge_per_atom_unit'] = 'electron charge'
            out_dict['charge_core_states_per_atom_unit'] = 'electron charge'
            out_dict['charge_valence_states_per_atom_unit'] = 'electron charge'
        except:
            msg = "Error parsing output of KKR: charges"
            msg_list.append(msg)

        try:
            try:
                niter, nitermax, converged, nmax_reached, mixinfo = get_scfinfo(
                    outfile_0init, outfile_000, outfile)
            except IndexError:
                niter, nitermax, converged, nmax_reached, mixinfo = get_scfinfo(
                    outfile_0init, outfile_2, outfile)
            out_dict['convergence_group']['number_of_iterations'] = niter
            out_dict['convergence_group'][
                'number_of_iterations_max'] = nitermax
            out_dict['convergence_group']['calculation_converged'] = converged
            out_dict['convergence_group']['nsteps_exhausted'] = nmax_reached
            out_dict['convergence_group']['imix'] = mixinfo[0]
            out_dict['convergence_group']['strmix'] = mixinfo[1]
            out_dict['convergence_group']['qbound'] = mixinfo[2]
            out_dict['convergence_group']['fcm'] = mixinfo[3]
            out_dict['convergence_group']['idtbry'] = mixinfo[4]
            out_dict['convergence_group']['brymix'] = mixinfo[5]
        except:
            msg = "Error parsing output of KKR: scfinfo"
            msg_list.append(msg)

    #convert numpy arrays to standard python lists
    out_dict = convert_to_pystd(out_dict)

    # return output with error messages if there are any
    if len(msg_list) > 0:
        return False, msg_list, out_dict
    else:
        return True, [], out_dict
Esempio n. 2
0
    def parse_kkrimp_outputfile(self, out_dict, file_dict):
        """
        Main parser function for kkrimp, read information from files in file_dict and fills out_dict
        :param out_dict: dictionary that is filled with parsed output of the KKRimp calculation
        :param file_dict: dictionary of files that are parsed
        :returns: success (bool), msg_list(list of error/warning messages of parser), out_dict (filled dict of parsed output)
        :note: file_dict should contain the following keys
            * 'outfile', the std_out of the KKRimp calculation
            * 'out_log', the out_log.000.txt file
            * 'out_pot', the output potential
            * 'out_enersp_at', the out_energysp_per_atom_eV file
            * 'out_enertot_at', the out_energytotal_per_atom_eV file
            * 'out_timing', the timing file
            * 'kkrflex_llyfac', the file for the Lloyd factor
            * 'kkrflex_angles', the nonco_angles file for the KKRimp calculation
            * 'out_spinmoms', the output spin moments file
            * 'out_orbmoms', the output orbital moments file
        """
        from masci_tools.io.parsers.kkrparser_functions import get_rms, find_warnings, get_charges_per_atom, get_core_states
        from masci_tools.io.common_functions import get_version_info, get_Ry2eV

        Ry2eV = get_Ry2eV()
        msg_list = []
        files = file_dict

        try:
            code_version, compile_options, serial_number = get_version_info(
                files['out_log'])
            tmp_dict = {}
            tmp_dict['code_version'] = code_version
            tmp_dict['compile_options'] = compile_options
            tmp_dict['calculation_serial_number'] = serial_number
            out_dict['code_info_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: Version Info"
            msg_list.append(msg)

        tmp_dict = {
        }  # used to group convergence info (rms, rms per atom, charge neutrality)
        # also initialize convegence_group where all info stored for all iterations is kept
        out_dict['convergence_group'] = tmp_dict
        try:
            result, result_atoms_last = get_rms(files['outfile'],
                                                files['out_log'])
            tmp_dict['rms'] = result[-1]
            tmp_dict['rms_all_iterations'] = result
            tmp_dict['rms_per_atom'] = result_atoms_last
            tmp_dict['rms_unit'] = 'unitless'
            out_dict['convergence_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: rms-error"
            msg_list.append(msg)

        try:
            natom = self._get_natom(files['out_log'])
            nspin = self._get_nspin(files['out_log'], natom)
            newsosol = self._get_newsosol(files['out_log'])
            out_dict['nspin'] = nspin
            out_dict['number_of_atoms_in_unit_cell'] = natom
            out_dict['use_newsosol'] = newsosol
        except:
            msg = "Error parsing output of KKRimp: nspin/natom"
            msg_list.append(msg)

        tmp_dict = {
        }  # used to group magnetism info (spin and orbital moments)
        try:
            if nspin > 1 and newsosol:
                spinmom_vec, spinmom_vec_all, magtot = self._get_spinmom_per_atom(
                    files['out_spinmoms'], natom)
                tmp_dict['total_spin_moment'] = magtot
                out_dict['convergence_group'][
                    'spin_moment_per_atom'] = spinmom_vec
                out_dict['convergence_group'][
                    'spin_moment_per_atom_all_iterations'] = spinmom_vec_all
                tmp_dict['total_spin_moment_unit'] = 'mu_Bohr'
                out_dict['magnetism_group'] = tmp_dict
            elif nspin > 1:
                spinmom_vec, spinmom_vec_all, magtot = self._get_magtot(
                    files['out_log'], natom)
                tmp_dict['total_spin_moment'] = magtot
                out_dict['convergence_group'][
                    'spin_moment_per_atom'] = spinmom_vec
                out_dict['convergence_group'][
                    'spin_moment_per_atom_all_iterations'] = spinmom_vec_all
                tmp_dict['total_spin_moment_unit'] = 'mu_Bohr'
                out_dict['magnetism_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: spin moment per atom"
            msg_list.append(msg)

        # add orbital moments to magnetism group in parser output
        try:
            if nspin > 1 and newsosol and files['out_orbmoms'] is not None:
                orbmom_atom, orbmom_atom_all = self._get_orbmom_per_atom(
                    files['out_orbmoms'], natom)
                tmp_dict['orbital_moment_per_atom'] = orbmom_atom
                out_dict['convergence_group'][
                    'orbital_moment_per_atom_all_iterations'] = orbmom_atom_all
                tmp_dict['orbital_moment_unit'] = 'mu_Bohr'
                out_dict['magnetism_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: orbital moment"
            msg_list.append(msg)

        try:
            result = self._get_EF_potfile(files['out_pot'])
            out_dict['fermi_energy'] = result
            out_dict['fermi_energy_units'] = 'Ry'
        except:
            msg = "Error parsing output of KKRimp: EF"
            msg_list.append(msg)

        try:
            result = self._get_Etot(files['out_log'])
            out_dict['energy'] = result[-1] * Ry2eV
            out_dict['energy_unit'] = 'eV'
            out_dict['total_energy_Ry'] = result[-1]
            out_dict['total_energy_Ry_unit'] = 'Rydberg'
            out_dict['convergence_group'][
                'total_energy_Ry_all_iterations'] = result
        except:
            msg = "Error parsing output of KKRimp: total energy"
            msg_list.append(msg)

        try:
            result = find_warnings(files['outfile'])
            tmp_dict = {}
            tmp_dict['number_of_warnings'] = len(result)
            tmp_dict['warnings_list'] = result
            out_dict['warnings_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: search for warnings"
            msg_list.append(msg)

        try:
            result = self._extract_timings(files['out_timing'])
            out_dict['timings_group'] = result
            out_dict['timings_unit'] = 'seconds'
        except:
            msg = "Error parsing output of KKRimp: timings"
            msg_list.append(msg)

        try:
            esp_at, etot_at = self._get_energies_atom(files['out_enersp_at'],
                                                      files['out_enertot_at'],
                                                      natom)
            out_dict['single_particle_energies'] = esp_at * Ry2eV
            out_dict['single_particle_energies_unit'] = 'eV'
            out_dict['total_energies_atom'] = etot_at * Ry2eV
            out_dict['total_energies_atom_unit'] = 'eV'
        except:
            msg = "Error parsing output of KKRimp: single particle energies"
            msg_list.append(msg)

        try:
            result_WS, result_tot, result_C = get_charges_per_atom(
                files['out_log'])
            niter = len(out_dict['convergence_group']['rms_all_iterations'])
            natyp = int(len(result_tot) / niter)
            out_dict['total_charge_per_atom'] = result_WS[-natyp:]
            out_dict['charge_core_states_per_atom'] = result_C[-natyp:]
            # this check deals with the DOS case where output is slightly different
            if len(result_WS) == len(result_C):
                out_dict['charge_valence_states_per_atom'] = result_WS[
                    -natyp:] - result_C[-natyp:]
            out_dict['total_charge_per_atom_unit'] = 'electron charge'
            out_dict['charge_core_states_per_atom_unit'] = 'electron charge'
            out_dict['charge_valence_states_per_atom_unit'] = 'electron charge'
        except:
            msg = "Error parsing output of KKRimp: charges"
            msg_list.append(msg)

        try:
            econt = self._get_econt_info(files['out_log'])
            tmp_dict = {}
            tmp_dict['emin'] = econt.get('emin')
            tmp_dict['emin_unit'] = 'Rydberg'
            tmp_dict['number_of_energy_points'] = econt.get('Nepts')
            tmp_dict['epoints_contour'] = econt.get('epts')
            tmp_dict['epoints_contour_unit'] = 'Rydberg'
            tmp_dict['epoints_weights'] = econt.get('weights')
            out_dict['energy_contour_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: energy contour"
            msg_list.append(msg)

        try:
            ncore, emax, lmax, descr_max = get_core_states(files['out_pot'])
            tmp_dict = {}
            tmp_dict['number_of_core_states_per_atom'] = ncore
            tmp_dict['energy_highest_lying_core_state_per_atom'] = emax
            tmp_dict[
                'energy_highest_lying_core_state_per_atom_unit'] = 'Rydberg'
            tmp_dict['descr_highest_lying_core_state_per_atom'] = descr_max
            out_dict['core_states_group'] = tmp_dict
        except:
            msg = "Error parsing output of KKRimp: core_states"
            msg_list.append(msg)

        try:
            niter, nitermax, converged, nmax_reached, mixinfo = self._get_scfinfo(
                files['out_log'])
            out_dict['convergence_group']['number_of_iterations'] = niter
            out_dict['convergence_group'][
                'number_of_iterations_max'] = nitermax
            out_dict['convergence_group']['calculation_converged'] = converged
            out_dict['convergence_group']['nsteps_exhausted'] = nmax_reached
            out_dict['convergence_group']['imix'] = mixinfo[0]
            out_dict['convergence_group']['strmix'] = mixinfo[1]
            out_dict['convergence_group']['qbound'] = mixinfo[2]
            out_dict['convergence_group']['fcm'] = mixinfo[3]
            out_dict['convergence_group']['brymix'] = mixinfo[1]
        except:
            msg = "Error parsing output of KKRimp: scfinfo"
            msg_list.append(msg)

        #convert arrays to lists
        from numpy import ndarray
        for key in list(out_dict.keys()):
            if type(out_dict[key]) == ndarray:
                out_dict[key] = list(out_dict[key])
            elif type(out_dict[key]) == dict:
                for subkey in list(out_dict[key].keys()):
                    if type(out_dict[key][subkey]) == ndarray:
                        out_dict[key][subkey] = (
                            out_dict[key][subkey]).tolist()

        # return output with error messages if there are any
        if len(msg_list) > 0:
            return False, msg_list, out_dict
        else:
            return True, [], out_dict
def parse_voronoi_output(out_dict, outfile, potfile, atominfo, radii,
                         inputfile):
    """
    Parse output of voronoi calculation and return (success, error_messages_list, out_dict)
    """
    # for collection of error messages:
    msg_list = []

    try:
        code_version, compile_options, serial_number = get_version_info(
            outfile)
        tmp_dict = {}
        tmp_dict['code_version'] = code_version
        tmp_dict['compile_options'] = compile_options
        tmp_dict['calculation_serial_number'] = serial_number
        out_dict['code_info_group'] = tmp_dict
    except:
        msg = "Error parsing output of voronoi: Version Info"
        msg_list.append(msg)

    try:
        emin, e_core_max = check_voronoi_output(potfile, outfile)
        out_dict['emin'] = emin
        out_dict['emin_units'] = 'Ry'
        diff_emin_ef = emin - get_ef_from_potfile(potfile)
        out_dict['emin_minus_efermi_Ry'] = diff_emin_ef
        out_dict['emin_minus_efermi'] = diff_emin_ef * get_Ry2eV()
        out_dict['emin_minus_efermi_Ry_units'] = 'Ry'
        out_dict['emin_minus_efermi_units'] = 'eV'
    except:
        msg = "Error parsing output of voronoi: 'EMIN'"
        msg_list.append(msg)

    # parse
    try:
        ncore, emax, lmax, descr_max = get_core_states(potfile)
        tmp_dict = {}
        tmp_dict['number_of_core_states_per_atom'] = ncore
        tmp_dict['energy_highest_lying_core_state_per_atom'] = emax
        tmp_dict['energy_highest_lying_core_state_per_atom_unit'] = 'Rydberg'
        tmp_dict['descr_highest_lying_core_state_per_atom'] = descr_max
        out_dict['core_states_group'] = tmp_dict
    except:
        msg = "Error parsing output of voronoi: core_states"
        msg_list.append(msg)

    try:
        Ncls, natom, results = get_cls_info(outfile)
        clsinfo = []
        tmpdict_all = {}
        for icls in range(natom):
            tmpdict = {}
            tmpdict['iatom'] = results[icls][0]
            tmpdict['refpot'] = results[icls][1]
            tmpdict['rmt_ref'] = results[icls][2]
            tmpdict['tb_cluster_id'] = results[icls][3]
            tmpdict['sites'] = results[icls][4]
            clsinfo.append(tmpdict)
        tmpdict_all['cluster_info_atoms'] = clsinfo
        tmpdict_all['number_of_clusters'] = Ncls
        out_dict['cluster_info_group'] = tmpdict_all
    except:
        msg = "Error parsing output of voronoi: Cluster Info"
        msg_list.append(msg)

    try:
        out_dict['start_from_jellium_potentials'] = startpot_jellium(outfile)
    except:
        msg = "Error parsing output of voronoi: Jellium startpot"
        msg_list.append(msg)

    try:
        natyp, naez, shapes = get_shape_array(outfile, atominfo)
        out_dict['shapes'] = shapes
    except:
        msg = "Error parsing output of voronoi: SHAPE Info"
        msg_list.append(msg)

    try:
        Vtot, results = get_volumes(outfile)
        tmp_dict = {}
        tmp_dict['volume_total'] = Vtot
        tmpdict_all = []
        for icls in range(naez):
            tmpdict = {}
            tmpdict['iatom'] = results[icls][0]
            tmpdict['v_atom'] = results[icls][1]
            tmpdict_all.append(tmpdict)
        tmp_dict['volume_atoms'] = tmpdict_all
        tmp_dict['volume_unit'] = 'alat^3'
        out_dict['volumes_group'] = tmp_dict
    except:
        msg = "Error parsing output of voronoi: Volume Info"
        msg_list.append(msg)

    try:
        results = get_radii(naez, radii)
        tmpdict_all = []
        for icls in range(naez):
            tmpdict = {}
            tmpdict['iatom'] = results[icls][0]
            tmpdict['rmt0'] = results[icls][1]
            tmpdict['rout'] = results[icls][2]
            tmpdict['dist_nn'] = results[icls][4]
            tmpdict['rmt0_over_rout'] = results[icls][3]
            tmpdict['rout_over_dist_nn'] = results[icls][5]
            tmpdict_all.append(tmpdict)
        tmpdict_all.append({'radii_units': 'alat'})
        out_dict['radii_atoms_group'] = tmpdict_all
    except:
        msg = "Error parsing output of voronoi: radii.dat Info"
        msg_list.append(msg)

    try:
        results = get_fpradius(naez, atominfo)
        out_dict['fpradius_atoms'] = results
        out_dict['fpradius_atoms_unit'] = 'alat'
    except:
        msg = "Error parsing output of voronoi: full potential radius"
        msg_list.append(msg)

    try:
        result = get_alat(inputfile)
        out_dict['alat'] = result
        out_dict['alat_unit'] = 'a_Bohr'
    except:
        msg = "Error parsing output of voronoi: alat"
        msg_list.append(msg)

    try:
        result = get_radial_meshpoints(potfile)
        out_dict['radial_meshpoints'] = result
    except:
        msg = "Error parsing output of voronoi: radial meshpoints"
        msg_list.append(msg)

    # some consistency checks comparing lists with natyp/naez numbers
    #TODO implement checks

    #convert numpy arrays to standard python lists
    out_dict = convert_to_pystd(out_dict)

    # return output with error messages if there are any
    if len(msg_list) > 0:
        return False, msg_list, out_dict
    else:
        return True, [], out_dict
Esempio n. 4
0
 def test_get_version_info(self):
     version = get_version_info('files/kkr/kkr_run_dos_output/output.0.txt')
     assert version == ('v2.2-22-g4f8f5ff', 'openmp-mac',
                        'kkrjm_v2.2-22-g4f8f5ff_openmp-mac_20171214102522')