def read_record_results(path, jobs): energy_dict = {} for job in jobs: if job.layertype == 'bilayer': energy, unit = get_energy(job) energy = [energy, unit] energy_dict['bilayer'] = energy elif job.layertype == 'upperlayer': energy, unit = get_energy(job) energy = [energy, unit] energy_dict['upperlayer'] = energy elif job.layertype == 'underlayer': energy, unit = get_energy(job) energy = [energy, unit] energy_dict['underlayer'] = energy layer_energy = cal_layer_energy(energy_dict['bilayer'], energy_dict['upperlayer'], energy_dict['underlayer']) energy_dict['layer_energy'] = layer_energy record_data_json(path, 'energy', energy_dict, section='hf2') record_data_csv( path, 'hf2', [ energy_dict['bilayer'][0], energy_dict['upperlayer'][0], energy_dict['underlayer'][0], energy_dict['layer_energy'][0] ], layer='whole layer') rec = 'Results readed.\n' rec += '---' * 25 print(rec) record(path, rec)
def read_all_results(path, jobs): Results = [Result(job) for job in jobs] for res in Results: res.get_energy() res.unit_transform() energy_dict = {res.method: [res.energy, res.unit] for res in Results} record_data_json(path, 'energy', energy_dict, section='correction') for res in Results: record_data_csv(path, res.method, res.energy, layer='interlayer') rec = 'Results readed.\n' rec += '---' * 25 print(rec) record(path, rec)
def read_record_result(job, path): job_path = job.path out_file = os.path.join(job_path, 'geo_opt.out') lattice_parameter, geometry = get_optimized_geometry(out_file) energy, unit = get_optimized_energy(out_file) record_data_json(path, 'unit', unit, section='geo_opt') record_data_json(path, 'optimized_lattice_parameter', lattice_parameter, section='geo_opt') record_data_json(path, 'optimized_geometry', geometry, section='geo_opt') record_data_json(path, 'energy', energy, section='geo_opt') record_data_csv(path, 'geo_opt', energy) rec = job.path + '\n' rec += 'Output Info readed.\n' rec += '---' * 25 print(rec) record(path, rec)