Esempio n. 1
0
def get_symmetries(outfile_0init):
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    try:
        itmp = search_string('symmetries found for this lattice:', tmptxt)
        nsym = int(tmptxt[itmp].split(':')[1].split()[0])
    except IndexError:
        itmp = search_string('< FINDGROUP > : Finding symmetry operations',
                             tmptxt)
        tmptxt2 = tmptxt[itmp:]
        itmp = search_string('found for this lattice:', tmptxt2)
        nsym = int(tmptxt2[itmp].split(':')[1].split()[0])
    itmp = search_string('symmetries will be used', tmptxt)
    nsym_used = int(tmptxt[itmp].split()[3])
    itmp = search_string('<SYMTAUMAT>', tmptxt)
    tmpdict = {}
    for isym in range(nsym_used):
        tmpval = tmptxt[itmp + 5 + isym].replace('0-', '0 -').replace(
            '1-', '1 -').split()  # bugfix for -120 degree euler angle
        desc = tmpval[1]
        inversion = int(tmpval[2])
        euler = [float(tmpval[3]), float(tmpval[4]), float(tmpval[5])]
        unitary = int(tmpval[6].replace('T', '1').replace('F', '0'))
        tmpdict[desc] = {
            'has_inversion': inversion,
            'is_unitary': unitary,
            'euler_angles': euler
        }
    desc = tmpdict
    return nsym, nsym_used, desc
Esempio n. 2
0
    def adapt_retrieve_tmatnew(self, tempfolder, allopts, retrieve_list):
        """Add out_magneticmoments and orbitalmoments files to retrieve list"""

        # extract NSPIN value
        with tempfolder.open(self._CONFIG) as file:
            config = file.readlines()
        itmp = search_string('NSPIN', config)
        if itmp >= 0:
            nspin = int(config[itmp].split()[-1])
        else:
            raise ValueError("Could not extract NSPIN value from config.cfg")

        # change retrieve list
        if 'tmatnew' in allopts and nspin > 1:
            retrieve_list.append(self._OUT_MAGNETICMOMENTS)
            with tempfolder.open(self._CONFIG) as file:
                outorb = file.readlines()
            itmp = search_string('CALCORBITALMOMENT', outorb)
            if itmp >= 0:
                calcorb = int(outorb[itmp].split()[-1])
            else:
                calcorb = 0
            if calcorb == 1:
                retrieve_list.append(self._OUT_ORBITALMOMENTS)

        return retrieve_list
Esempio n. 3
0
 def _get_econt_info(self, out_log):
     """
     extract energy contour information from out_log file
     :param out_log: file that is parsed
     :retuns: econt (dict), dictionary containing the energy contour info
     :note: econt contains the following keys
         * 'emin', bottom of energy contour
         * 'Nepts', number of points in energy contour
         * 'epts', list of complex valued energy points
         * 'weights', list of complex valued weights for energy integration
     """
     from masci_tools.io.common_functions import search_string
     from numpy import array
     f = open_general(out_log)
     tmptxt = f.readlines()
     f.close()
     econt = {}
     itmp = search_string('[read_energy] number of energy points', tmptxt)
     if itmp >= 0: econt['Nepts'] = int(tmptxt.pop(itmp).split()[-1])
     itmp = search_string('energies and weights are:', tmptxt)
     if itmp >= 0:
         tmp = []
         for ie in range(econt['Nepts']):
             tmpline = tmptxt[itmp + 4 + ie].split()[1:]
             tmp.append([
                 float(tmpline[0]),
                 float(tmpline[1]),
                 float(tmpline[2]),
                 float(tmpline[3])
             ])
         tmp = array(tmp)
         econt['epts'] = tmp[:, :2]
         econt['weights'] = tmp[:, 2:]
         econt['emin'] = tmp[0, 0]
     return econt
Esempio n. 4
0
    def test_set_rmtcore(self):
        #test rmtcore
        from numpy import array
        from masci_tools.io.common_functions import search_string

        para_dict = dict([
            (u'INS', 0), (u'RCLUSTZ', 1.69), (u'LMAX', 2), (u'GMAX', 65.0),
            (u'<RMTCORE>',
             [0.3535533906, 0.3535533906, 0.3535533906, 0.3535533906]),
            (u'RMAX', 7.0), (u'NSPIN', 1)
        ])
        zatom = array([47., 47., 47., 47.])
        alat = 7.8692316414074615
        natom = 4
        positions = array([[0., 0., 0.], [0., 0.5, 0.5], [0.5, 0., 0.5],
                           [0.5, 0.5, 0.]])
        bravais = array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
        k = kkrparams(**para_dict)
        k.set_multiple_values(ZATOM=zatom,
                              NAEZ=natom,
                              ALATBASIS=alat,
                              RBASIS=positions,
                              BRAVAIS=bravais)
        k.fill_keywords_to_inputfile()

        txt = open('inputcard').readlines()
        naez = int(txt[search_string('NAEZ', txt)].split()[-1])
        rmtcore = []
        l_offset = search_string('RMTCORE', txt)
        for iatom in range(naez):
            rmtcore_at = float(txt[l_offset + 1 + iatom].split()[-1])
            rmtcore.append(rmtcore_at)
        maxdiff = (max(abs(array(para_dict['<RMTCORE>']) - array(rmtcore))))
        assert maxdiff < 10**-6
Esempio n. 5
0
 def test_search_string(self):
     txt = open('files/kkr/kkr_run_dos_output/output.0.txt',
                'r').readlines()
     alatline = search_string('ALAT', txt)
     noline = search_string('ALT', txt)
     assert alatline == 23
     assert noline == -1
def get_alat(inpfile):
    f = open_general(inpfile)
    with f:  # make sure the file is properly closed
        txt = f.readlines()
    itmp = search_string('ALATBASIS', txt)
    result = float(txt[itmp].split('ALATBASIS')[1].split('=')[1].split()[0])
    return result
Esempio n. 7
0
def extract_timings(outfile):
    f = open_general(outfile)
    tmptxt = f.readlines()
    f.close()
    itmp = 0
    res = []
    search_keys = [
        'main0',
        'main1a - tbref',
        'main1a  ',  # two spaces to differentiate from following key
        'main1b - calctref13',
        'main1b  ',  # two spaces!
        'main1c - serial part',
        'main1c  ',  # two spaces!
        'main2',
        'Time in Iteration'
    ]
    while itmp >= 0:
        tmpvals = []
        for isearch in search_keys:
            itmp = search_string(isearch, tmptxt)
            if itmp >= 0:
                tmpval = [isearch, float(tmptxt.pop(itmp).split()[-1])]
                tmpvals.append(tmpval)
        if len(tmpvals) > 0:
            res.append(tmpvals)
    res = res[0]
    return dict(res)
Esempio n. 8
0
def get_lattice_vectors(outfile_0init):
    """
    read direct and reciprocal lattice vectors in internal units (useful for qdos generation)
    """
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    vecs, rvecs = [], []
    tmpvecs = []
    for search_txt in ['a_1: ', 'a_2: ', 'a_3: ', 'b_1: ', 'b_2: ', 'b_3: ']:
        itmp = search_string(search_txt, tmptxt)
        if itmp >= 0:
            tmpvec = tmptxt[itmp].split(':')[1].split()
            tmpvecs.append(
                [float(tmpvec[0]),
                 float(tmpvec[1]),
                 float(tmpvec[1])])
        if search_txt in ['a_3: ', 'b_3: '] and itmp < 0:
            # reset vecs for 2D case
            tmpvecs[0] = tmpvecs[0][:2]
            tmpvecs[1] = tmpvecs[1][:2]
        if search_txt == 'a_3: ':
            vecs = tmpvecs
            tmpvecs = []
        elif search_txt == 'b_3: ':
            rvecs = tmpvecs
    return vecs, rvecs
Esempio n. 9
0
def get_spinmom_per_atom(outfile, natom, nonco_out_file=None):
    """
    Extract spin moment information from outfile and nonco_angles_out (if given)
    """
    f = open_general(outfile)
    tmptxt = f.readlines()
    f.close()
    itmp = 0
    result = []
    while itmp >= 0:
        itmp = search_string('m_spin', tmptxt)
        if itmp >= 0:
            tmpline = tmptxt.pop(itmp)
            tmparray = []
            for iatom in range(natom):
                tmpline = tmptxt.pop(itmp)
                tmparray.append(float(tmpline.split()[3]))
            result.append(tmparray)

    # if the file is there, i.e. NEWSOSOL is used, then extract also direction of spins (angles theta and phi)
    if nonco_out_file is not None and result != []:
        angles = loadtxt(nonco_out_file)
        if len(shape(angles)) == 1:
            angles = array([angles])
        vec = angles_to_vec(result[-1], angles[:, 0], angles[:, 1])
    else:
        vec, angles = [], []

    return array(result), vec, angles
    def _extract_timings(self, outfile):
        """
        Extract timings for the different parts in the KKRimp code
        :param outfile: timing file of the KKRimp run
        :returns: res (dict) timings in seconds, averaged over iterations
        """
        f = open_general(outfile)
        tmptxt = f.readlines()
        f.close()
        search_keys = [
            'time until scf starts', 'vpot->tmat', 'gref->gmat',
            'gonsite->density', 'energyloop', 'Iteration number',
            'Total running time'
        ]

        res = {}
        for isearch in search_keys:
            tmpval = []
            itmp = 0
            while itmp >= 0:
                itmp = search_string(isearch, tmptxt)
                if itmp >= 0:
                    tmpval.append(float(tmptxt.pop(itmp).split()[-1]))
            if len(tmpval) > 0:
                res[isearch] = tmpval
        # average over iterations
        niter = len(res.get(search_keys[-2], []))
        if niter > 0:
            for key in search_keys[1:6]:
                if key in list(res.keys()):
                    res[key] = sum(res[key]) / niter
            for key in [search_keys[0], search_keys[-1]]:
                if key in list(res.keys()):
                    res[key] = res[key][0]
        return res
def get_cls_info(outfile):
    f = open_general(outfile)
    with f:  # make sure the file is properly closed
        tmptxt = f.readlines()
        f.close()
        itmp = 0
        Ncls = 0
        Natom = 0
        cls_all = []
        results = []
        while itmp >= 0:
            itmp = search_string('CLSGEN_TB: Atom', tmptxt)
            if itmp >= 0:
                tmpstr = tmptxt.pop(itmp)
                tmpstr = tmpstr.split()
                tmp = [
                    int(tmpstr[2]),
                    int(tmpstr[4]),
                    float(tmpstr[6]),
                    int(tmpstr[8]),
                    int(tmpstr[10])
                ]
                results.append(tmp)
                if int(tmpstr[8]) not in cls_all:
                    Ncls += 1
                    cls_all.append(int(tmpstr[8]))
                Natom += 1
    return Ncls, Natom, results
Esempio n. 12
0
def get_alatinfo(outfile_0init):
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('Lattice constants :', tmptxt)
    alat = float(tmptxt[itmp].split(':')[1].split('=')[1].split()[0])
    twopialat = float(tmptxt[itmp].split(':')[1].split('=')[2].split()[0])
    return alat, twopialat
def startpot_jellium(outfile):
    f = open_general(outfile)
    with f:  # make sure the file is properly closed
        tmptxt = f.readlines()
    itmp = search_string('JELLSTART POTENTIALS', tmptxt)
    if itmp == -1:
        return False
    else:
        return True
def get_shape_array(outfile, atominfo):
    f = open_general(outfile)
    with f:  # make sure the file is properly closed
        txt = f.readlines()
    #naez/natyp number of items either one number (=ishape without cpa or two =[iatom, ishape] with CPA)
    # read in naez and/or natyp and then find ishape array (1..natyp[=naez without CPA])
    itmp = search_string('NAEZ= ', txt)
    if itmp >= 0:
        tmp = txt[itmp]
        ipos = tmp.find('NAEZ=')
        naez = int(tmp[ipos + 5:].split()[0])
    else:
        naez = -1
    itmp = search_string('NATYP= ', txt)
    if itmp >= 0:
        tmp = txt[itmp]
        ipos = tmp.find('NATYP=')
        natyp = int(tmp[ipos + 6:].split()[0])
    else:
        natyp = -1

    # consistency check
    if naez == -1 and natyp > 0:
        naez = natyp
    elif natyp == -1 and naez > 0:
        natyp = naez
    elif natyp == -1 and naez == -1:
        raise ValueError('Neither NAEZ nor NATYP found in %s' % outfile)

    # read shape index from atominfo file
    f = open_general(atominfo)
    with f:  # make sure the file is properly closed
        tmptxt = f.readlines()

    itmp = search_string('<SHAPE>', tmptxt) + 1
    ishape = []
    for iatom in range(natyp):
        txt = tmptxt[itmp + iatom]
        if natyp > naez:  #CPA option
            ishape.append(int(txt.split()[1]))
        else:
            ishape.append(int(txt.split()[0]))

    return natyp, naez, ishape
Esempio n. 15
0
def get_nspin(outfile_0init):
    """
    extract NSPIN value from output.0.txt
    """
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('NSPIN', tmptxt)
    nspin = int(tmptxt[itmp + 1].split()[0])
    return nspin
def get_volumes(outfile):
    f = open_general(outfile)
    with f:  # make sure the file is properly closed
        tmptxt = f.readlines()

    itmp = search_string('Total volume (alat^3)', tmptxt)
    if itmp >= 0:
        Vtot = float(tmptxt.pop(itmp).split()[-1])

    itmp = 0
    results = []
    while itmp >= 0:
        itmp = search_string(' Volume(alat^3)  :', tmptxt)
        if itmp >= 0:
            tmpstr = tmptxt.pop(itmp)
            tmpstr = tmpstr.split()
            tmpstr = [int(tmpstr[2]), float(tmpstr[5])]
            results.append(tmpstr)
    return Vtot, results
Esempio n. 17
0
def get_natom(outfile_0init):
    """
    extract NATYP value from output.0.txt
    """
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('NATYP', tmptxt)
    natom = int(tmptxt[itmp + 1].split()[0])
    return natom
Esempio n. 18
0
def use_newsosol(outfile_0init):
    """
    extract NEWSOSOL info from output.0.txt
    """
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    newsosol = False
    # old style (RUNOPT output)
    itmp = search_string('NEWSOSOL', tmptxt)
    if itmp >= 0 and 'NEWSOSOL' in tmptxt[itmp].upper():
        newsosol = True
    itmp = search_string('<use_Chebychev_solver>=', tmptxt)
    # new style: check for output of runoptions
    if itmp >= 0:
        if tmptxt[itmp].split()[1][:1].upper() == 'T':
            newsosol = True
        if tmptxt[itmp].split()[1][:1].upper() == 'F':
            newsosol = False
    return newsosol
Esempio n. 19
0
def get_scfinfo(outfile_0init, outfile_000, outfile):
    f = open_general(outfile_000)
    tmptxt = f.readlines()
    f.close()

    itmp = search_string('ITERATION :', tmptxt)
    tmpval = tmptxt[itmp].split(':')[1].split()
    niter = int(tmpval[0])
    nitermax = int(tmpval[3])

    f = open_general(outfile)
    tmptxt = f.readlines()
    f.close()
    itmp1 = search_string('SCF ITERATION CONVERGED', tmptxt)
    itmp2 = search_string('NUMBER OF SCF STEPS EXHAUSTED', tmptxt)
    if itmp1 >= 0:
        converged = True
    else:
        converged = False
    if itmp2 >= 0:
        nmax_reached = True
    else:
        nmax_reached = False

    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('STRMIX        FCM       QBOUND', tmptxt)
    tmpval = tmptxt[itmp + 1].split()
    strmix = float(tmpval[0])
    fcm = float(tmpval[1])
    qbound = float(tmpval[2])
    tmpval = tmptxt[itmp + 4].split()
    brymix = float(tmpval[0])
    itmp = search_string('IMIX    IGF    ICC', tmptxt)
    imix = int(tmptxt[itmp + 1].split()[0])
    idtbry = int(tmptxt[itmp + 4].split()[0])

    mixinfo = [imix, strmix, qbound, fcm, idtbry, brymix]

    return niter, nitermax, converged, nmax_reached, mixinfo
 def _get_nspin(self, file):
     """
     Extract nspin from file
     :param file: file that is parsed
     :returns: 1 if calculation is paramagnetic, 2 otherwise
     """
     f = open_general(file)
     tmptxt = f.readlines()
     f.close()
     itmp = search_string('NSPIN', tmptxt)
     nspin = int(tmptxt.pop(itmp).split()[-1])
     return nspin
def get_fpradius(naez, atominfo):
    f = open_general(atominfo)
    with f:  # make sure the file is properly closed
        txt = f.readlines()
    itmp = search_string('<FPRADIUS>', txt) + 1
    results = []
    for iatom in range(naez):
        #ZAT   LMXC  KFG   <CLS> <REFPOT> <NTC>  FAC  <IRNS> <RMTREF>   <FPRADIUS>
        # 0.00 1 3 3 0 0      1      1      1    1.     199   2.3166000   0.4696902
        tmpline = float(txt[itmp + iatom].split()[-1])
        results.append(tmpline)
    return results
 def _get_natom(self, file):
     """
     Extract number of atoms in impurity cluster
     :param file: file that is parsed to find number of atoms
     :returns: natom (int), number of atoms in impurity cluster
     """
     f = open_general(file)
     tmptxt = f.readlines()
     f.close()
     itmp = search_string('NATOM is', tmptxt)
     natom = int(tmptxt.pop(itmp).split()[-1])
     return natom
Esempio n. 23
0
def use_newsosol(outfile_0init):
    """
    extract NEWSOSOL info from output.0.txt
    """
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('NEWSOSOL', tmptxt)
    newsosol = False
    if itmp >= 0:
        newsosol = True
    return newsosol
Esempio n. 24
0
def get_econt_info(outfile_0init):
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()

    itmp = search_string('E min', tmptxt)
    emin = float(tmptxt[itmp].split('min')[1].split('=')[1].split()[0])

    itmp = search_string('Temperature', tmptxt)
    tempr = float(
        tmptxt[itmp].split('Temperature')[1].split('=')[1].split()[0])

    itmp = search_string('Number of energy points', tmptxt)
    Nepts = int(tmptxt[itmp].split(':')[1].split()[0])

    doscalc = search_string('Density-of-States calculation', tmptxt)
    if doscalc == -1:
        # npol
        itmp = search_string('poles =', tmptxt)
        Npol = int(tmptxt[itmp].split('=')[1].split()[0])
        # npt1, npt2, npt3
        itmp = search_string('contour:', tmptxt)
        tmp = tmptxt[itmp].replace(',', '').split(':')[1].split()
        N1 = int(tmp[2])
        N2 = int(tmp[5])
        N3 = int(tmp[8])
    else:
        Npol, N1, N2, N3 = 0, 0, Nepts, 0

    return emin, tempr, Nepts, Npol, N1, N2, N3
def get_radial_meshpoints(potfile):
    f = open_general(potfile)
    with f:  # make sure the file is properly closed
        txt = f.readlines()
    itmp = 0
    result = []
    while itmp >= 0:
        itmp = search_string('exc:', txt)
        if itmp >= 0:
            txt.pop(itmp)  # remove header line
            tmp = txt.pop(itmp + 3)  # extract meshpoints
            result.append(float(tmp))
    return result
Esempio n. 26
0
    def add_lmdos_files_to_retrieve(self, tempfolder, allopts, retrieve_list):
        """Add DOS files to retrieve list"""

        if 'lmdos' in allopts or 'ldos' in allopts:
            # extract NSPIN
            with tempfolder.open(self._CONFIG) as file:
                config = file.readlines()
            itmp = search_string('NSPIN', config)
            if itmp >= 0:
                nspin = int(config[itmp].split()[-1])
            else:
                raise ValueError(
                    "Could not extract NSPIN value from config.cfg")

            # extract NATOM from atominfo file
            with tempfolder.open(self._KKRFLEX_ATOMINFO) as file:
                atominfo = file.readlines()
            itmp = search_string('NATOM', atominfo)
            if itmp >= 0:
                natom = int(atominfo[itmp + 1].split()[0])
            else:
                raise ValueError(
                    "Could not extract NATOM value from kkrflex_atominfo")

            # loop over atoms and spins to add DOS output files accordingly
            for iatom in range(1, natom + 1):
                for ispin in range(1, nspin + 1):
                    retrieve_list.append(
                        (self._OUT_LDOS_BASE % (iatom, ispin)).replace(
                            ' ', '0'))
                    retrieve_list.append((self._OUT_LDOS_INTERPOL_BASE %
                                          (iatom, ispin)).replace(' ', '0'))
                    retrieve_list.append(
                        (self._OUT_LMDOS_BASE % (iatom, ispin)).replace(
                            ' ', '0'))
                    retrieve_list.append((self._OUT_LMDOS_INTERPOL_BASE %
                                          (iatom, ispin)).replace(' ', '0'))

        return retrieve_list
Esempio n. 27
0
def get_ewald(outfile_0init):
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    itmp = search_string('setting bulk Madelung coefficients', tmptxt)
    if itmp >= 0:
        info = '3D'
    else:
        info = '2D'
    if info == '3D':
        itmp = search_string('< LATTICE3D >', tmptxt)
        tmpval = tmptxt[itmp + 7].split()[2:]
        rsum = float(tmpval[2]), int(tmpval[0]), int(tmpval[1])
        tmpval = tmptxt[itmp + 8].split()[2:]
        gsum = float(tmpval[2]), int(tmpval[0]), int(tmpval[1])
    else:
        itmp = search_string('< LATTICE2D >', tmptxt)
        tmpval = tmptxt[itmp + 13].split()[2:]
        rsum = float(tmpval[2]), int(tmpval[0]), int(tmpval[1])
        tmpval = tmptxt[itmp + 14].split()[2:]
        gsum = float(tmpval[2]), int(tmpval[0]), int(tmpval[1])
    return rsum, gsum, info
Esempio n. 28
0
def find_warnings(outfile):
    f = open_general(outfile)
    tmptxt = f.readlines()
    tmptxt_caps = [txt.upper() for txt in tmptxt]
    f.close()
    itmp = 0
    res = []
    while itmp >= 0:
        itmp = search_string('WARNING', tmptxt_caps)
        if itmp >= 0:
            tmpval = tmptxt_caps.pop(itmp)
            tmpval = tmptxt.pop(itmp)
            res.append(tmpval.strip())
    return array(res)
Esempio n. 29
0
def get_econt_info(outfile_0init):
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()

    itmp = search_string('E min', tmptxt)
    emin = float(tmptxt[itmp].split('min')[1].split('=')[1].split()[0])

    itmp = search_string('Temperature', tmptxt)
    tempr = float(
        tmptxt[itmp].split('Temperature')[1].split('=')[1].split()[0])

    itmp = search_string('Number of energy points', tmptxt)
    Nepts = int(tmptxt[itmp].split(':')[1].split()[0])

    doscalc = search_string('Density-of-States calculation', tmptxt)
    semi_circ = search_string('integration on semi-circle contour', tmptxt)

    # dummy values
    N1, N2, N3, Npol = None, None, None, None
    Nsemi_circ, im_e_min = None, None

    # for DOS contour
    if doscalc == -1:
        # scf contour
        if semi_circ == -1:
            # npol
            itmp = search_string('poles =', tmptxt)
            Npol = int(tmptxt[itmp].split('=')[1].split()[0])
            # npt1, npt2, npt3
            itmp = search_string('contour:', tmptxt)
            tmp = tmptxt[itmp].replace(',',
                                       '').replace('=',
                                                   '= ').split(':')[1].split()
            N1 = int(tmp[2])
            N2 = int(tmp[5])
            N3 = int(tmp[8])
        else:
            # semi-circular contour
            Nsemi_circ = Nepts
            itmp = search_string('smallest imaginary part ', tmptxt)
            im_e_min = tmptxt[itmp].split('=')[1].split()[0]
    else:
        # DOS contour
        Npol, N1, N2, N3 = 0, 0, Nepts, 0

    return emin, tempr, Nepts, Npol, N1, N2, N3, Nsemi_circ, im_e_min
Esempio n. 30
0
def get_kmeshinfo(outfile_0init, outfile_000):
    """
    Extract kmesh info from output.0.txt and output.000.txt
    """
    # first get info from output.0.txt
    f = open_general(outfile_0init)
    tmptxt = f.readlines()
    f.close()
    nkmesh = []
    itmp = search_string('number of different k-meshes', tmptxt)
    nkmesh.append(int(tmptxt[itmp].split(':')[1].split()[0]))
    itmp = search_string('NofKs', tmptxt)
    nofks, nkx, nky, nkz = [], [], [], []
    if itmp >= 0:
        for ik in range(nkmesh[0]):
            tmpval = tmptxt[itmp + 2 + ik].split()
            nofks.append(int(tmpval[1]))
            nkx.append(int(tmpval[2]))
            nky.append(int(tmpval[3]))
            nkz.append(int(tmpval[4]))

    tmpdict = {'number_of_kpts': nofks, 'n_kx': nkx, 'n_ky': nky, 'n_kz': nkz}
    nkmesh.append(tmpdict)

    #next get kmesh_ie from output.000.txt
    f = open_general(outfile_000)
    tmptxt = f.readlines()
    f.close()
    kmesh_ie = []
    itmp = 0
    while itmp >= 0:
        itmp = search_string('KMESH =', tmptxt)
        if itmp >= 0:
            tmpval = int(tmptxt.pop(itmp).split()[-1])
            kmesh_ie.append(tmpval)

    return nkmesh, kmesh_ie