예제 #1
0
def MP_db():
    sepline(ch=" Materials Project database ", sp='=')
    print('''\
e1 >>> get band/dos by mp-ID
e2 >>> get structure from materialsproject database
e3 >>> get properties by mp-ID
e4 >>> get phase graph''')
예제 #2
0
def menu():
    """show the first class menu

    function description:

    Args:
        None

    Returns:
        None
    """

    label.input
    structural_operation()
    structural_analysis()
    vasp_inout()
    vasp_workflow()
    MP_db()
    local_db()
    sepline(ch="=", sp='=')
    print("")
    print("")
    your_choice()
    in_str = wait()
    ret = select_function(in_str)
    if ret is None:
        goto.input
예제 #3
0
def local_db():
    sepline(ch=" local database ", sp='=')
    print('''\
f1 >>> check local database
f2 >>> get entry by l-ID
f3 >>> get entry by formula
f4 >>> get entry by element
f5 >>> insert entry into database''')
예제 #4
0
def structural_analysis():
    sepline(ch=" structural analysis ", sp='=')
    print('''\
b1 >>> structure symmetry
b2 >>> structure finger print
b3 >>> structure difference
b4 >>> get primitive cell
b5 >>> get conventional cell
b6 >>> get XRD pattern''')
예제 #5
0
def structural_operation():
    sepline(ch=" structural operation ", sp='=')
    print('''\
a1 >>> random operation
a2 >>> convert operation
a3 >>> build operation
a4 >>> cleave opeartion
a5 >>> strain operation
a6 >>> 2D structure operation''')
예제 #6
0
파일: menu.py 프로젝트: wwmeng/maptool
def MP_db():
    sepline(ch=" On-line database ",sp='=')
    print('''\
e1 >>> (MP) get band/dos by mp-ID
e2 >>> (MP) get structure by mp-ID/elements/formula
e3 >>> (MP) get properties by mp-ID
e4 >>> (MP) get phase graph
e5 >>> (OQMD) get structure by ID/elements/formula''',
)
예제 #7
0
def vasp_workflow():
    sepline(ch=" vasp calclation workflow", sp='=')
    print('''\
d1 >>> optimize structure
d2 >>> calculate band structure
d3 >>> calculate band structure HSE06
d4 >>> calculate dos
d5 >>> calculate dos by HSE06
d6 >>> calculate elastic properties
d7 >>> calculate phonon
d8 >>> execute MD simulation''')
예제 #8
0
파일: mpdb.py 프로젝트: obaica/maptool-1
def get_mp_banddos():
    check_matplotlib()
    mpr = check_apikey()
    print("input the mp-ID")
    wait_sep()
    in_str = wait()
    mp_id = in_str
    step_count = 1
    proc_str = "Reading Data From " + web + " ..."
    procs(proc_str, step_count, sp='-->>')
    data = mpr.get_entry_by_material_id(mp_id)
    sepline()
    print(data)
    sepline()
    step_count += 1
    proc_str = "Reading Band Data From " + web + " ..."
    procs(proc_str, step_count, sp='-->>')

    band = mpr.get_bandstructure_by_material_id(mp_id)
    if band is None:
        print("No data obtained online, stop now!")
        os.exit(0)

    step_count += 1
    filename = mp_id + '_band.png'
    proc_str = "Writing Data to " + filename + " File..."
    bsp = BSPlotter(band)
    procs(proc_str, step_count, sp='-->>')
    bsp.save_plot(filename=filename, img_format="png")

    step_count += 1
    proc_str = "Reading DOS Data From " + web + " ..."
    procs(proc_str, step_count, sp='-->>')
    dos = mpr.get_dos_by_material_id(mp_id)
    if dos is None:
        print("No data obtained online, stop now!")

    step_count += 1
    filename = mp_id + '_dos.png'
    proc_str = "Writing Data to " + filename + " File..."
    dsp = DosPlotter()
    dsp.add_dos('Total', dos)
    procs(proc_str, step_count, sp='-->>')
    dsp.save_plot(filename=filename, img_format="png")
예제 #9
0
def structure_symmetry():
    structs, fnames = read_structures()
    multi_structs(structs, fnames)
    for struct, fname in zip(structs, fnames):
        if isinstance(struct, Structure):
            sa = SpacegroupAnalyzer(struct)
            print("file name: {}".format(fname))
            print("{} : {}".format('Structure Type', 'periodicity'))
            print("{} : {}".format('Lattice Type', sa.get_lattice_type()))
            print("{} : {}".format('Space Group ID',
                                   sa.get_space_group_number()))
            print("{} : {}".format('International Symbol',
                                   sa.get_space_group_symbol()))
            print("{} : {}".format('Hall Symbol', sa.get_hall()))
            sepline()
        if isinstance(struct, Molecule):
            print("file name: {}".format(fname))
            sa = PointGroupAnalyzer(struct)
            print("{} : {}".format('Structure Type', 'non-periodicity'))
            print("{} : {}".format('International Symbol',
                                   ast.get_pointgroup()))
    return True
예제 #10
0
def get_conventional_cell():
    structs, fnames = read_structures()
    multi_structs(structs, fnames)
    for struct, fname in zip(structs, fnames):
        sepline(ch='conventional  cell', sp='-')
        ast = SpacegroupAnalyzer(struct)
        conv_st = ast.get_conventional_standard_structure()
        print(conv_st)
        sepline()
        print('save to ' + NAME + '_convention_' + fname + '.vasp')
        conv_st.to(filename=NAME + '_conventional_' + fname + '.vasp',
                   fmt='poscar')
        sepline()
    return True
예제 #11
0
def get_primitive_cell():
    structs, fnames = read_structures()
    multi_structs(structs, fnames)
    for struct, fname in zip(structs, fnames):
        sepline(ch='Primitive Cell', sp='-')
        ast = SpacegroupAnalyzer(struct)
        prim_st = ast.find_primitive()
        print(prim_st)
        sepline()
        print('save to ' + NAME + '_primitive_' + fname + '.vasp')
        prim_st.to(filename=NAME + '_primitive_' + fname + '.vasp',
                   fmt='poscar')
        sepline()
    return True
예제 #12
0
def vasp_inout():
    sepline(ch=" vasp in/out tools ", sp='=')
    print('''\
c1 >>> prepare input files
c2 >>> analysis output files
c3 >>> summary output files''')
예제 #13
0
파일: submenu.py 프로젝트: wwmeng/maptool
def select_function(choice):
    r"""
    submenu for selecting function
    """
    # structure operation
    if choice == "a1":
        print('{} >>> {}'.format('1', 'random structure generating'))
        print('{} >>> {}'.format('2', 'random perturbation for atom index'))
        print('{} >>> {}'.format('3', 'random disturbing for lattice matrix'))
        print('{} >>> {}'.format('4', 'random disturbing for atom position'))
        your_choice()
        in_str = wait()
        if in_str == "0":
            return None
        return random_operation(in_str)

    elif choice == "a2":
        return covert_operation()

    elif choice == "a3":
        print('{} >>> {}'.format('1', 'build supercell'))
        print('{} >>> {}'.format('2', 'build nanotube'))
        print('{} >>> {}'.format('3', 'build absorption configuration'))
        your_choice()
        in_str = wait()
        if in_str == "0":
            return None
        return build_operation(in_str)

    elif choice == "a4":
        print('{} >>> {}'.format('1', 'cleave surface'))
        print('{} >>> {}'.format('2', 'cleave sphere cluster'))
        print('{} >>> {}'.format('3', 'cleave shell structure'))
        your_choice()
        in_str = wait()
        if in_str == "0":
            return None
        return cleave_operation(in_str)

    elif choice == "a5":
        return strain_operation()

    elif choice == 'a6':
        print('{} >>> {}'.format('1', 'build rippled structure'))
        print('{} >>> {}'.format('2', 'build multi-layered structure'))
        print('{} >>> {}'.format('3', 'split multi-layered structure'))
        print('{} >>> {}'.format('4', 'resize vacuum layer'))
        print('{} >>> {}'.format('5', 'center atomic-layer along z direction'))
        print('{} >>> {}'.format('6',
                                 'apply strain along different direction'))
        print('{} >>> {}'.format('7', 'constrain atom in specific range'))
        print('{} >>> {}'.format(
            '8', 'get a substrate for 2D material (online!!!)'))
        your_choice()
        in_str = wait()
        if in_str == "0":
            return None
        return twod_operation(in_str)

# structure analysis
    elif choice == "b1":
        return structure_symmetry()
    elif choice == "b2":
        return structure_finger_print()
    elif choice == "b3":
        return structures_difference()
    elif choice == "b4":
        return get_primitive_cell()
    elif choice == "b5":
        return get_conventional_cell()
    elif choice == "b6":
        return get_xrd()

# vasp in/out tools
    elif choice == "c1":
        structs, fnames = read_structures()
        if structs is None:
            return None
        multi_structs(structs, fnames)
        sepline(ch=' prepare intput files ', sp='-')
        your_choice()
        print('{} >>> {}'.format('1', 'prepare all files automatically'))
        print('{} >>> {}'.format('2', 'prepare INCAR file'))
        print('{} >>> {}'.format('3', 'prepare KPOINTS file'))
        print('{} >>> {}'.format('4', 'prepare POTCAR file'))
        label.input1
        wait_sep()
        choice = wait()

        if choice == "0":
            return None
        elif choice == "1":
            return generate_all_input(structs, fnames)
        elif choice == "2":
            return generate_incar(structs, fnames)
        elif choice == "3":
            return generate_kpoint(structs, fnames)
        elif choice == "4":
            return generate_potcar(structs, fnames)
        else:
            print("unknown choice, check the input")
            goto.input1

    elif choice == "cxx":
        sepline(ch=' summary output files ', sp='=')
        print('{} >>> {}'.format('1', 'describe OUCAR file'))
        print('{} >>> {}'.format('2', 'describe OSICAR file'))
        print('{} >>> {}'.format('3', 'describe vasprun.xml file'))
        label.input2
        wait_sep()
        choice = wait()
        if choice == "0":
            return None
        if choice == "1":
            return describe_OUTCAR()
        elif choice == "2":
            return describe_OSICAR()
        elif choice == "3":
            return describe_vasprun()
        else:
            print("unknown choice, check the input")
            goto.input2

    elif choice == "c2":
        sepline(ch=' vasp output analysis ', sp='-')
        print('{} >>> {}'.format('1 ', 'total density of states'))
        print('{} >>> {}'.format('2 ', 'projected density of states'))
        print('{} >>> {}'.format('3 ', 'band structure'))
        print('{} >>> {}'.format('4 ', 'projected band structure'))
        print('{} >>> {}'.format('5 ', 'select one band structure'))
        print('{} >>> {}'.format('6 ', 'charge density'))
        print('{} >>> {}'.format('7 ', 'spin density'))
        print('{} >>> {}'.format('8 ', 'charge density difference'))
        print('{} >>> {}'.format('9 ', 'spin density component: up/down'))
        print('{} >>> {}'.format('10', 'average charge density/potential'))
        print('{} >>> {}'.format('11', 'optics analysis'))
        print('{} >>> {}'.format('12', 'mechanical analysis'))
        print('{} >>> {}'.format('13',
                                 'ab initio molecular dynamics analysis'))
        label.input3
        wait_sep()
        choice = wait()
        if choice == "0":
            return None
        if choice == "1":
            return total_dos()
        elif choice == "2":
            return projected_dos()
        elif choice == "3":
            return band_structure()
        elif choice == "4":
            return projected_band_structure()
        elif choice == "5":
            return select_one_band_structure()
        elif choice == "6":
            return charge_density()
        elif choice == "7":
            return spin_density()
        elif choice == "8":
            return charge_density_diff()
        elif choice == "9":
            return spin_density_component()
        elif choice == "10":
            return chg_locp_average()
        elif choice == "11":
            return optics_analysis()
        elif choice == "12":
            return elastic_analysis()
        elif choice == "13":
            return aimd_analysis()
        else:
            print("unknown choice, check the input")
            goto.input3

# online exctraction
    elif choice == "e1":
        return get_mp_banddos()
    elif choice == "e2":
        return get_mp_structure()
    elif choice == "e3":
        return get_mp_properties()
    elif choice == "e4":
        return get_mp_phase_graph()
    elif choice == "e5":
        return get_oqmd_structure()
    elif choice == "88":
        os._exit(0)
    else:
        print("unknown choice, return now")
        return None