def write_run(run, run_folder, write_vasprun=False): os.makedirs(run_folder, exist_ok=True) incar = Incar.from_dict(run['incar']) poscar = Poscar.from_dict(run['poscar']) kpoints = Kpoints.from_dict(run['kpoints']) energy = run['energy'] files = [ ('INCAR', incar), ('KPOINTS', kpoints), ('POSCAR', poscar), ] for filename, pymg_object in files: pymg_object.write_file(os.path.join(run_folder, filename)) with open(os.path.join(run_folder, 'energy.txt'), 'w') as f: f.write(str(energy)) if write_vasprun: if not os.path.exists(os.path.join(run_folder, 'vasprun.xml')): print(' Writing Vasprun') get_file(fs, run['vasprun'], new_file=os.path.join(run_folder, 'vasprun.xml'))
# if (lb_e <= cutoff and ub_e >= cutoff) or (ub_e - lb_e > max_range and lb_e <= cutoff + max_range / 2 and ub_e >= cutoff - max_range / 2): print('{} {}'.format(material,i)) material_folder = os.path.join(folder, material, str(i)) lb = ts['lb'][i - 1] ubs = ts['ub'][i-1] start = mat['start'] final = mat['finals'][i-1] #Write LB write_run(start, os.path.join(material_folder, 'start'), write_vasprun=True) write_run(final, os.path.join(material_folder, 'final'), write_vasprun=True) write_run(lb, os.path.join(material_folder, 'lb'), write_vasprun=True) write_run(mat['base'], os.path.join(material_folder, 'base'), write_vasprun=True) incar = Incar.from_dict(lb['incar']) incar['IMAGES'] = 1 incar['SPRING'] = 0 incar['LCLIMB'] = False incar['ISTART'] = 0 incar['ICHARG'] = 2 incar['IOPT'] = 1 incar['IBRION'] = 3 incar['POTIM'] = 0 incar['EDIFFG'] = -0.05 incar['EDIFF'] = 1e-5 incar['NELM'] = 100 incar['NSW'] = 5000 kpoints = Kpoints.from_dict(lb['kpoints']) potcar = lb['potcar']