Esempio n. 1
0
workpath = './'

allfile = os.listdir(workpath)

for files in allfile:

    filepath = "./" + files
    if os.path.isdir(filepath):

        material = files.split('_')[2]  # get material name by split dir name

        effmass_path = filepath + "/02_calc_q_ZPR/q1/mode0"

        data = inputs.DataAims(effmass_path)
        segments = extrema.generate_segments(settings, data)
        outputs.plot_segments(data, settings, segments)
        table = outputs.make_table(segments, which_values)
        outputs.print_terminal_table(table)
        #        file.write(segment)
        #        file.write('\n')
        cbm_index = segments[-1].band

        # calculate effective mass at Gamma Point
        # in order to specify the k-position of effmass(such as Gamma point), we need to set argument 'bk'
        # such as bk=[[4, 0],[4, 100],[4, 200]] at 'extrema.generate_segments()'
        # Here I write a loop to generate this bk array
        vbm_index = cbm_index - 1
        k_point = 0  # Gamma-point
        seg_position = []  # array of one single segment e.g. [4, 0]
        all_segs = []  # array of all segments e.g. [[4, 0],[4, 100],[4, 200]]
Esempio n. 2
0
workpath = './'

allfile = os.listdir(workpath)

for files in allfile:

    filepath = "./" + files
    if os.path.isdir(filepath):

        material = files.split('_')[2]

        effmass_path = filepath + "/02_calc_q_ZPR/q1/mode0"

        data = inputs.DataAims(effmass_path)
        segments = extrema.generate_segments(settings, data)
        outputs.plot_segments(data, settings, segments)
        table = outputs.make_table(segments, which_values)
        outputs.print_terminal_table(table)
        #        file.write(segment)
        #        file.write('\n')
        cbm_index = segments[-1].band
        plot_segments = []
        for seg in segments:
            if seg.band == (cbm_index):
                if seg.band_type == 'conduction_band':
                    particle = "electron"
                if seg.band_type == 'valence_band':
                    particle = "hole"
                plot_segments.append(seg)
Esempio n. 3
0
def cli():

    print("Welcome to effmass 2.0.0 \U0001F388")

    ignore, seedname, fermi_level = None, None, None
    random_int = randint(10000, 99999)

    DFT_code = questionary.select(
        "Which DFT code have you used to generate the bandstructure?",
        choices=['Vasp', 'FHI-aims', 'Castep']).ask()

    pathname = questionary.path(
        "What's the path to your {} output files?".format(DFT_code),
        default="./",
        only_directories=True).ask()

    if DFT_code == 'Vasp':
        ignore = questionary.text(
            "How many k-points should I ignore at the start of the file? (useful for hybrid calculations)",
            default="0").ask()

    if DFT_code == 'Castep':

        seedname = questionary.text(
            "What's the seedname of your Castep files? (e.g. Si.bands and Si.castep have the seedname Si)",
        ).ask()
        fermi_level = questionary.text(
            "I will infer the position of the CBM and VBM from the calculated Fermi level."
            +
            " If you know this value to be incorrect, please input a more accurate value:",
        ).ask()

    extrema_search_depth = questionary.text(
        "How far (in eV) from the CBM (VBM) would you like me to search for minima (maxima)?",
        default="0.05").ask()

    energy_range = questionary.text(
        "What would you like the energy range (in eV) of each segment to be?",
        default="0.5").ask()

    which_values = questionary.checkbox(
        "Which values would you like me to calculate?",
        choices=[
            questionary.Choice("parabolic m* (least squares)", checked=True),
            questionary.Choice("parabolic m* (finite difference)",
                               checked=True)
        ]).ask()  # need to select oe

    save_plot = questionary.confirm(
        "Would you like me to save a plot of the band segments?",
        default=True,
        auto_enter=False).ask()

    save_summary = questionary.confirm(
        "Would you like me to save a summary file?",
        default=True,
        auto_enter=False).ask()

    settings = inputs.Settings(
        extrema_search_depth=float(extrema_search_depth),
        energy_range=float(energy_range))
    print("Reading in data...")

    if DFT_code == "Vasp":
        data = inputs.DataVasp(pathname + "/OUTCAR",
                               pathname + "/PROCAR",
                               ignore=int(ignore))

    elif DFT_code == "FHI-aims":
        data = inputs.DataAims(pathname)

    else:
        data = inputs.DataCastep(pathname + "/", seedname)
        if fermi_level:
            data.fermi_level = fermi_level
            data.find_cbm_vbm()

    print("Finding extrema...")
    print("Generating segments...")
    segments = extrema.generate_segments(settings, data)

    print("Calculating effective masses...")
    table = outputs.make_table(segments, which_values)
    outputs.print_terminal_table(table)

    if save_plot:
        print("Plotting segments...")
        outputs.plot_segments(data,
                              settings,
                              segments,
                              savefig=True,
                              random_int=random_int)
        print("Plot of segments saved to effmass_{}.png".format(random_int))

    if save_summary:
        print("Writing summary file...")

        outputs.print_summary_file(random_int, DFT_code, pathname, ignore,
                                   seedname, fermi_level, extrema_search_depth,
                                   energy_range, table)

        print("Summary file saved as effmass_{}.txt".format(random_int))
Esempio n. 4
0
#random_int= randint(10000,99999)
random_int = 'test3' # use this command to specific fig name

#file=open("effmass_test2.txt",'a')

settings = inputs.Settings(extrema_search_depth=0.05, energy_range=0.6)
which_values = ["parabolic m* (least squares)","parabolic m* (finite difference)"]

data = inputs.DataAims("./mode0")
    #use  .format()  can add variable in string
ttt = extrema.find_extrema_indices(data, settings)
my_array=np.concatenate((ttt[0],ttt[1]))
print(my_array)
#print(ttt)
#segments = extrema.generate_segments(settings,data,bk=[[6, 99],[6, 199],[6, 299]])
segments = extrema.generate_segments(settings,data,bk=[[6, 0],[6, 100],[6, 200],[7, 0],[7, 100],[7, 200]])
#print(extrema_array)
for seg in segments:

    print(seg)
#outputs.plot_segments(data,settings,segments)
table=outputs.make_table(segments,which_values)
outputs.print_terminal_table(table)
outputs.plot_segments(data,settings,segments,savefig=True,random_int=random_int)
plt.show()
#file.write(table.get_string())
#file.write('\n')



#print(segments[-1].band)