Ejemplo n.º 1
0
def test_get_structure_max4(load_inpxml, data_regression):

    from masci_tools.util.xml.xml_getters import get_structure_data
    from masci_tools.io.common_functions import convert_to_pystd

    xmltree, schema_dict = load_inpxml(TEST_MAX4_INPXML_PATH)

    atoms, cell, pbc = get_structure_data(xmltree, schema_dict)

    data_regression.check({
        'atoms': convert_to_pystd(atoms),
        'cell': convert_to_pystd(cell),
        'pbc': pbc
    })
Ejemplo n.º 2
0
def test_hdf5_reader_jdos(data_regression):
    """
    Tests of the dos recipe (also pass opened file handle)
    """
    from masci_tools.io.parsers.hdf5 import HDF5Reader
    from masci_tools.io.parsers.hdf5.recipes import FleurJDOS

    TEST_BANDDOS_FILE = os.path.join(HDFTEST_DIR, 'banddos_spinpol_dos.hdf')

    with HDF5Reader(TEST_BANDDOS_FILE) as reader:
        data, attrs = reader.read(recipe=FleurJDOS)

    data_regression.check({
        'datasets': convert_to_pystd(data),
        'attributes': convert_to_pystd(attrs)
    })
Ejemplo n.º 3
0
def test_hdf5_reader_bands(data_regression):
    """
    Tests of the bands recipe
    """
    from masci_tools.io.parsers.hdf5 import HDF5Reader
    from masci_tools.io.parsers.hdf5.recipes import FleurBands

    TEST_BANDDOS_FILE = os.path.join(HDFTEST_DIR, 'banddos_bands.hdf')

    with HDF5Reader(TEST_BANDDOS_FILE) as reader:
        data, attrs = reader.read(recipe=FleurBands)

    data_regression.check({
        'datasets': convert_to_pystd(data),
        'attributes': convert_to_pystd(attrs)
    })
Ejemplo n.º 4
0
def test_get_cell_bulk(load_inpxml, data_regression):

    from masci_tools.util.xml.xml_getters import get_cell
    from masci_tools.io.common_functions import convert_to_pystd

    xmltree, schema_dict = load_inpxml(TEST_BULK_INPXML_PATH)

    cell, pbc = get_cell(xmltree, schema_dict)

    data_regression.check({'cell': convert_to_pystd(cell), 'pbc': pbc})
Ejemplo n.º 5
0
def test_kpoints_max4(load_inpxml, data_regression):

    from masci_tools.util.xml.xml_getters import get_kpoints_data
    from masci_tools.io.common_functions import convert_to_pystd

    xmltree, schema_dict = load_inpxml(TEST_MAX4_INPXML_PATH)

    kpoints, weights, cell, pbc = get_kpoints_data(xmltree, schema_dict)

    data_regression.check({
        'kpoints': kpoints,
        'weights': weights,
        'cell': convert_to_pystd(cell),
        'pbc': pbc
    })
Ejemplo n.º 6
0
def test_kpoints_multiple_sets_selection_index(load_inpxml, data_regression):

    from masci_tools.util.xml.xml_getters import get_kpoints_data
    from masci_tools.io.common_functions import convert_to_pystd

    xmltree, schema_dict = load_inpxml(TEST_MULTIPLE_KPOINT_SETS_PATH)

    kpoints, weights, cell, pbc = get_kpoints_data(xmltree,
                                                   schema_dict,
                                                   index=0)

    data_regression.check({
        'kpoints': kpoints,
        'weights': weights,
        'cell': convert_to_pystd(cell),
        'pbc': pbc
    })
Ejemplo n.º 7
0
def calculate_total_magnetic_moment(out_dict, logger):
    """
    Calculate the the total magnetic moment per cell

    :param out_dict: dict with the already parsed information
    """
    total_charge = out_dict.get('spin_dependent_charge_total', None)

    if total_charge is None:
        if logger is not None:
            logger.warning('calculate_total_magnetic_moment got None')
        return out_dict

    total_charge = total_charge[-1]
    if isinstance(total_charge, list):
        if 'total_magnetic_moment_cell' not in out_dict:
            out_dict['total_magnetic_moment_cell'] = []

        out_dict['total_magnetic_moment_cell'].append(
            convert_to_pystd(np.abs(total_charge[0] - total_charge[1])))

    return out_dict
Ejemplo n.º 8
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
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
Ejemplo n.º 10
0
    def test_convert_to_pystd(self):
        test = {
            'list': [0, 1, 2],
            'nparray': np.array([0, 1, 2]),
            'nparray_conv_list': list(np.array([0, 1, 2])),
            'int': 9,
            'float': 0.9,
            'np.int': np.int64(8),
            'np.float': np.float128(9),
            'dict': {
                'list': [0, 1, 2],
                'nparray': np.array([0, 1, 2]),
                'nparray_conv_list': list(np.array([0, 1, 2])),
                'int': 9,
                'float': 0.9,
                'np.int': np.int64(8),
                'np.float': np.float128(9),
                'dict': {
                    'list': [0, 1, 2],
                    'nparray': np.array([0, 1, 2]),
                    'nparray_conv_list': list(np.array([0, 1, 2])),
                    'int': 9,
                    'float': 0.9,
                    'np.int': np.int64(8),
                    'np.float': np.float128(9)
                }
            }
        }

        # make a copy and convert the dict
        test1 = test.copy()
        test1 = convert_to_pystd(test1)

        print('original ', test)
        print('converted', test1)

        # extract datatypes for comparison
        for i in [
                'list', 'nparray', 'nparray_conv_list', 'int', 'float',
                'np.int', 'np.float'
        ]:
            ii = test[i]
            if i == 'list':
                out0 = []
            print(i, type(ii))
            out0.append(type(ii))
            if i in ['list', 'nparray', 'nparray_conv_list']:
                for j in ii:
                    print(j, type(j))
                    out0.append(type(j))
            # converted datatypes:
            ii = test1[i]
            if i == 'list':
                out = []
            print(i, type(ii))
            out.append(type(ii))
            if i in ['list', 'nparray', 'nparray_conv_list']:
                for j in ii:
                    print(j, type(j))
                    out.append(type(j))

        # now compare datatypes:
        assert out0 == [
            list, int, int, int, np.ndarray, np.int64, np.int64, np.int64,
            list, int, int, int, int, float, np.int64, np.float128
        ]
        assert out == [
            list, int, int, int, list, int, int, int, list, int, int, int, int,
            float, int, float
        ]
    def parse_kkrimp_outputfile(self, out_dict, file_dict, debug=False):
        """
        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

        """

        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)
            if debug:
                traceback.print_exc()

        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:
            rms_charge, rms_spin, result_atoms_last_charge, result_atoms_last_spin = get_rms(
                files['outfile'], files['out_log'], debug=debug)
            tmp_dict['rms'] = rms_charge[-1]
            tmp_dict['rms_all_iterations'] = rms_charge
            tmp_dict['rms_per_atom'] = result_atoms_last_charge
            if len(rms_spin) > 0:
                tmp_dict['rms_spin'] = rms_spin[-1]
            else:
                tmp_dict['rms_spin'] = None
            tmp_dict['rms_spin_all_iterations'] = rms_spin
            tmp_dict['rms_spin_per_atom'] = result_atoms_last_spin
            tmp_dict['rms_unit'] = 'unitless'
            out_dict['convergence_group'] = tmp_dict
        except:
            msg = 'Error parsing output of KKRimp: rms-error'
            msg_list.append(msg)
            if debug:
                traceback.print_exc()

        try:
            nspin = self._get_nspin(files['out_log'])
            natom = self._get_natom(files['out_log'])
            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)
            if debug:
                traceback.print_exc()

        tmp_dict = {
        }  # used to group magnetism info (spin and orbital moments)
        try:
            result = self._get_magtot(files['out_log'], natom, debug=debug)
            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 KKRimp: total magnetic moment'
            msg_list.append(msg)
            if debug:
                traceback.print_exc()

        try:
            if nspin > 1 and newsosol:
                #result, vec, angles = get_spinmom_per_atom(outfile, natom, nonco_out_file)
                spinmom_atom, spinmom_atom_vec_all_iter, spin_tot_abs = self._get_spinmom_per_atom(
                    files['out_spinmoms'], natom)
                if len(result) > 0:
                    tmp_dict['total_abs_spin_moment'] = spin_tot_abs
                    tmp_dict['spin_moment_per_atom'] = spinmom_atom
                    out_dict['convergence_group'][
                        'spin_moment_per_atom_all_iterations'] = spinmom_atom_vec_all_iter
                    tmp_dict['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)
            if debug:
                traceback.print_exc()

        # add orbital moments to magnetis group in parser output
        try:
            if nspin > 1 and newsosol:
                orbmom_atom, orbmom_atom_all_iter = self._get_orbmom_per_atom(
                    files['out_orbmoms'], natom)
                if len(result) > 0:
                    tmp_dict['total_orbital_moment'] = sum(orbmom_atom)
                    tmp_dict['orbital_moment_per_atom'] = orbmom_atom
                    out_dict['convergence_group'][
                        'orbital_moment_per_atom_all_iterations'] = orbmom_atom_all_iter
                    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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        try:
            result = self._get_Etot(files['out_log'])
            out_dict['energy'] = result[-1] * get_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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        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 * get_Ry2eV()
            out_dict['single_particle_energies_unit'] = 'eV'
            out_dict['total_energies_atom'] = etot_at * get_Ry2eV()
            out_dict['total_energies_atom_unit'] = 'eV'
        except:
            msg = 'Error parsing output of KKRimp: single particle energies'
            msg_list.append(msg)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        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)
            if debug:
                traceback.print_exc()

        #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