Beispiel #1
0
random_int = 'test2'

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]
Beispiel #2
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))
#!/home/quan/anaconda3/bin/python

import math
import matplotlib.pyplot as plt
import numpy as np

# import modules from the effmass package
from effmass import inputs, analysis, extrema, outputs, dos, ev_to_hartree

file = open("../all_effmass.txt", 'a')

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

for i in range(0, 7):

    data = inputs.DataAims("./mode{}".format(i))
    #use  .format()  can add variable in string

    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('{}th effective mass\n'.format(i))
    file.write(table.get_string())
    file.write('\n')
#plt.show()
import numpy as np
from random import randint

# import modules from the effmass package
from effmass import inputs, analysis, extrema, outputs, dos, ev_to_hartree


#random_int= randint(10000,99999)
random_int = 'VBCB'

file=open("effmass_data.txt",'a')

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

data = inputs.DataAims("./mode0")
    #use  .format()  can add variable in string

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(table.get_string())
file.write('\n')



#print(segments[-1].band)
cbm_index = segments[-1].band
'''
Here I use band index to determine CBM and VBM. Band index stored in function: segments.band
Beispiel #5
0
def Ge_soc_aims_data_object(
):  # Ge spin-orbit coupling calculation done with FHI-Aims
    return inputs.DataAims(
        os.path.join(os.path.dirname(__file__), 'data_aims/Ge_soc_aims'))
Beispiel #6
0
def Ge_sp_aims_data_object(
):  # Ge spin-polarised calculation done with FHI-Aims
    return inputs.DataAims(
        os.path.join(os.path.dirname(__file__), 'data_aims/Ge_sp_aims'))