Ejemplo n.º 1
0
def gen_input():

    os.mkdir(workflow_path)
    structure = get_structure_from_pass_path(start_path)
    write_workflow_convergence_file(workflow_path, False)
    scaled_structure = structure_scaler([
        structure
    ])  # resizes structure to compare with o-vacancy calculations
    structure_list, compound_path = get_structures_with_element_removed(
        workflow_path, 'O', scaled_structure)

    batch_write_input(structure_list,
                      vasp_input_set=MPRelaxSet,
                      output_dir=compound_path,
                      make_dir_if_not_present=True)

    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                natoms = len(
                    Poscar.from_file(os.path.join(root, 'POSCAR')).structure)
                convergence_writelines = bulk_convergence(
                    kpoints1, kpoints2, natoms)
                write_vasp_convergence_file(root, convergence_writelines)
Ejemplo n.º 2
0
def read_input_files(filename, to_scale=True):

    if os.path.isdir(workflow_path) == False:
        os.mkdir(workflow_path)

    paths_list = get_paths_from_file(os.path.join(pwd, filename))
    structures = get_structures_from_paths(paths_list)

    if to_scale == True:
        scaled_structures = structure_scaler(
            structures
        )  # resizes structure to compare with o-vacancy calculations
    else:
        scaled_structures = structures  # for just regular bulk relaxations of Materials Project structures

    batch_write_input(scaled_structures,
                      vasp_input_set=MPRelaxSet,
                      output_dir=workflow_path,
                      make_dir_if_not_present=True)
    append_to_incars(pwd, tags_to_add)

    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                natoms = len(
                    Poscar.from_file(os.path.join(root, 'POSCAR')).structure)
                convergence_writelines = bulk_convergence(
                    kpoints1, kpoints2, natoms)
                write_vasp_convergence_file(root, convergence_writelines)

    write_workflow_convergence_file(workflow_path, False)

    return
Ejemplo n.º 3
0
def read_input_files(filename, scale_factors):

    if os.path.isdir(workflow_path) == False:
        os.mkdir(workflow_path)

    paths_list = get_paths_from_file(os.path.join(pwd, filename))
    base_structures = []
    sub_structures = []

    for path in paths_list:
        base = Poscar.from_file(path).structure
        structures = get_Structures(path, elements_to_ignore)

        if structures != None:
            sub_structures.append(structures)
            base_structures.append(base)
        else:
            print('No structures to append')
            continue

    for base_ind in range(len(base_structures)):
        compound_parent_directory = str(
            base_structures[base_ind].formula).replace(' ', '')
        compound_path = os.path.join(workflow_path, compound_parent_directory)

        os.mkdir(compound_path)

        for structure in sub_structures[base_ind]:
            structure_directory = str(structure.formula).replace(' ', '')
            structure_path = os.path.join(compound_path, structure_directory)

            scaled_structures = []

            for sf in scale_factors:
                copy = structure.copy()
                init_volume = copy.volume
                copy.scale_lattice(sf * init_volume)
                scaled_structures.append(copy)

            batch_write_input(scaled_structures,
                              vasp_input_set=MPRelaxSet,
                              output_dir=structure_path,
                              make_dir_if_not_present=True)

    append_to_incars(pwd, tags_to_add)

    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                natoms = len(
                    Poscar.from_file(os.path.join(root, 'POSCAR')).structure)
                convergence_writelines = volume_bulk_convergence(
                    kpoints1, kpoints2)
                write_vasp_convergence_file(root, convergence_writelines)

    write_workflow_convergence_file(workflow_path, False)

    return
Ejemplo n.º 4
0
def gen_input(scale_factors):

    os.mkdir(workflow_path)

    start_path = get_previous_pass_path(pwd, workflow_name)
    structure = get_structure_from_pass_path(start_path)
    write_workflow_convergence_file(workflow_path, False)

    init_volume = structure.volume
    scaled_structures = []
    for sf in scale_factors:
        structure.scale_lattice(sf * init_volume)
        scaled_structures.append(structure)

    batch_write_input(scaled_structures,
                      vasp_input_set=MPRelaxSet,
                      output_dir=workflow_path)

    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                convergence_writelines = volume_bulk_convergence(
                    kpoints1, kpoints2)
                write_vasp_convergence_file(root, convergence_writelines)

    return
def gen_input():

    structure = get_structure_from_pass_path(start_path)

    if check_magnetism(pwd, structure):

        os.mkdir(workflow_path)
        write_workflow_convergence_file(workflow_path, False)
        mag_structures = MagneticStructureEnumerator(structure)
        ordered_structures = mag_structures.ordered_structures[:
                                                               max_num_mag_structs]
        batch_write_input(ordered_structures,
                          vasp_input_set=MPRelaxSet,
                          output_dir=workflow_path)
        for root, dirs, files in os.walk(workflow_path):
            for file in files:
                if file == 'POTCAR':
                    kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                    kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                    natoms = len(
                        Poscar.from_file(os.path.join(root,
                                                      'POSCAR')).structure)
                    convergence_writelines = bulk_convergence(
                        kpoints1, kpoints2, natoms)
                    write_vasp_convergence_file(root, convergence_writelines)
def generate_input_files(filename, mp_key):

    if os.path.isdir(workflow_path) == False:
        os.mkdir(workflow_path)

    id_list = get_mpids_from_file(os.path.join(pwd, filename))
    structures = get_structures_from_materials_project(id_list, mp_key)

    for structure in structures:
        try:
            mag_structures_obj = MagneticStructureEnumerator(structure)
            ordered_structures = mag_structures_obj.ordered_structures[:
                                                                       max_num_mag_structs]

            compound_parent_directory = str(structure.formula).replace(' ', '')
            compound_path = os.path.join(workflow_path,
                                         compound_parent_directory)

            if os.path.isdir(compound_path) == False:
                os.mkdir(compound_path)

            batch_write_input(ordered_structures,
                              vasp_input_set=MPRelaxSet,
                              output_dir=compound_path,
                              make_dir_if_not_present=True)
        except:
            print('%s is not magnetic!' %
                  str(structure.formula).replace(' ', ''))
            continue

    append_to_incars(pwd, tags_to_add)

    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                natoms = len(
                    Poscar.from_file(os.path.join(root, 'POSCAR')).structure)
                convergence_writelines = bulk_convergence(
                    kpoints1, kpoints2, natoms)
                write_vasp_convergence_file(root, convergence_writelines)

    write_workflow_convergence_file(workflow_path, False)

    return
Ejemplo n.º 7
0
def gen_input():

    os.mkdir(workflow_path)
    structure = get_structure_from_pass_path(start_path)
    write_workflow_convergence_file(workflow_path, False)
    batch_write_input([structure],
                      vasp_input_set=MPRelaxSet,
                      output_dir=workflow_path)
    for root, dirs, files in os.walk(workflow_path):
        for file in files:
            if file == 'POTCAR':
                kpoints1 = get_kpoints(os.path.join(root, 'POSCAR'), 300)
                kpoints2 = get_kpoints(os.path.join(root, 'POSCAR'), 1000)
                natoms = len(
                    Poscar.from_file(os.path.join(root, 'POSCAR')).structure)
                convergence_writelines = bulk_convergence(
                    kpoints1, kpoints2, natoms)
                write_vasp_convergence_file(root, convergence_writelines)