def run_vasp_relax(jdata, mdata): fp_command = mdata['fp_command'] fp_group_size = mdata['fp_group_size'] fp_resources = mdata['fp_resources'] #machine_type = mdata['fp_machine']['machine_type'] work_dir = os.path.join(jdata['out_dir'], global_dirname_02) forward_files = ["POSCAR", "INCAR", "POTCAR"] user_forward_files = mdata.get("fp" + "_user_forward_files", []) forward_files += [os.path.basename(file) for file in user_forward_files] backward_files = ["OUTCAR","CONTCAR"] backward_files += mdata.get("fp" + "_user_backward_files", []) forward_common_files = [] if 'cvasp' in mdata['fp_resources']: if mdata['fp_resources']['cvasp']: forward_files +=['cvasp.py'] relax_tasks = glob.glob(os.path.join(work_dir, "sys-*")) relax_tasks.sort() #dlog.info("work_dir",work_dir) #dlog.info("relax_tasks",relax_tasks) if len(relax_tasks) == 0: return relax_run_tasks = relax_tasks #for ii in relax_tasks : # if not _vasp_check_fin(ii): # relax_run_tasks.append(ii) run_tasks = [os.path.basename(ii) for ii in relax_run_tasks] api_version = mdata.get('api_version', '0.9') if LooseVersion(api_version) < LooseVersion('1.0'): warnings.warn(f"the dpdispatcher will be updated to new version." f"And the interface may be changed. Please check the documents for more details") dispatcher = make_dispatcher(mdata['fp_machine'], mdata['fp_resources'], work_dir, run_tasks, fp_group_size) dispatcher.run_jobs(fp_resources, [fp_command], work_dir, run_tasks, fp_group_size, forward_common_files, forward_files, backward_files) elif LooseVersion(api_version) >= LooseVersion('1.0'): submission = make_submission( mdata['fp_machine'], mdata['fp_resources'], commands=[fp_command], work_path=work_dir, run_tasks=run_tasks, group_size=fp_group_size, forward_common_files=forward_common_files, forward_files=forward_files, backward_files=backward_files, outlog = 'fp.log', errlog = 'fp.log') submission.run_submission()
def worker(work_path, all_task, forward_common_files, forward_files, backward_files, mdata, inter_type): run_tasks = [os.path.basename(ii) for ii in all_task] machine, resources, command, group_size = util.get_machine_info(mdata, inter_type) disp = make_dispatcher(machine, resources, work_path, run_tasks, group_size) api_version = mdata.get('api_version', '0.9') if LooseVersion(api_version) < LooseVersion('1.0'): warnings.warn(f"the dpdispatcher will be updated to new version." f"And the interface may be changed. Please check the documents for more details") disp.run_jobs(resources, command, work_path, run_tasks, group_size, forward_common_files, forward_files, backward_files, outlog='outlog', errlog='errlog') elif LooseVersion(api_version) >= LooseVersion('1.0'): submission = make_submission( mdata_machine=machine, mdata_resource=resources, commands=[command], work_path=work_path, run_tasks=run_tasks, group_size=group_size, forward_common_files=forward_common_files, forward_files=forward_files, backward_files=backward_files, outlog = 'outlog', errlog = 'errlog' ) submission.run_submission()
def run_equi(confs, inter_param, mdata): # find all POSCARs and their name like mp-xxx # ... conf_dirs = [] for conf in confs: conf_dirs.extend(glob.glob(conf)) conf_dirs.sort() # generate a list of task names like mp-xxx/relaxation/relax_task # ... work_path_list = [] for ii in conf_dirs: work_path_list.append(os.path.abspath(os.path.join(ii, 'relaxation'))) all_task = [] for ii in work_path_list: all_task.append(os.path.join(ii, 'relax_task')) inter_type = inter_param['type'] # vasp if inter_type == "vasp": mdata = convert_mdata(mdata, ["fp"]) elif inter_type in lammps_task_type: mdata = convert_mdata(mdata, ["model_devi"]) else: raise RuntimeError("unknown task %s, something wrong" % inter_type) # dispatch the tasks # POSCAR here is useless virtual_calculator = make_calculator(inter_param, "POSCAR") forward_files = virtual_calculator.forward_files() forward_common_files = virtual_calculator.forward_common_files() backward_files = virtual_calculator.backward_files() # backward_files += logs # ... run_tasks = util.collect_task(all_task, inter_type) if len(run_tasks) == 0: return else: # if LooseVersion() run_tasks = [os.path.basename(ii) for ii in all_task] machine, resources, command, group_size = util.get_machine_info( mdata, inter_type) print('%d tasks will be submited ' % len(run_tasks)) for ii in range(len(work_path_list)): work_path = work_path_list[ii] disp = make_dispatcher(machine, resources, work_path, [run_tasks[ii]], group_size) print("%s --> Runing... " % (work_path)) api_version = mdata.get('api_version', '0.9') if LooseVersion(api_version) < LooseVersion('1.0'): warnings.warn( f"the dpdispatcher will be updated to new version." f"And the interface may be changed. Please check the documents for more details" ) disp.run_jobs(resources, command, work_path, [run_tasks[ii]], group_size, forward_common_files, forward_files, backward_files, outlog='outlog', errlog='errlog') elif LooseVersion(api_version) >= LooseVersion('1.0'): submission = make_submission( mdata_machine=machine, mdata_resource=resources, commands=[command], work_path=work_path, run_tasks=run_tasks, group_size=group_size, forward_common_files=forward_common_files, forward_files=forward_files, backward_files=backward_files, outlog='outlog', errlog='errlog') submission.run_submission()
def run_vasp_md(jdata, mdata): fp_command = mdata['fp_command'] fp_group_size = mdata['fp_group_size'] fp_resources = mdata['fp_resources'] #machine_type = mdata['fp_machine']['machine_type'] work_dir = os.path.join(jdata['out_dir'], global_dirname_04) scale = jdata['scale'] pert_numb = jdata['pert_numb'] md_nstep = jdata['md_nstep'] forward_files = ["POSCAR", "INCAR", "POTCAR"] user_forward_files = mdata.get("fp" + "_user_forward_files", []) forward_files += [os.path.basename(file) for file in user_forward_files] backward_files = ["OUTCAR"] backward_files += mdata.get("fp" + "_user_backward_files", []) forward_common_files = [] if 'cvasp' in mdata['fp_resources']: if mdata['fp_resources']['cvasp']: forward_files +=['cvasp.py'] path_md = work_dir path_md = os.path.abspath(path_md) cwd = os.getcwd() assert(os.path.isdir(path_md)), "md path should exists" md_tasks = glob.glob(os.path.join(work_dir, 'sys-*/scale*/00*')) md_tasks.sort() if len(md_tasks) == 0: return md_run_tasks = md_tasks #for ii in md_tasks : # if not _vasp_check_fin(ii): # md_run_tasks.append(ii) run_tasks = [ii.replace(work_dir+"/", "") for ii in md_run_tasks] #dlog.info("md_work_dir", work_dir) #dlog.info("run_tasks",run_tasks) api_version = mdata.get('api_version', '0.9') if LooseVersion(api_version) < LooseVersion('1.0'): warnings.warn(f"the dpdispatcher will be updated to new version." f"And the interface may be changed. Please check the documents for more details") dispatcher = make_dispatcher(mdata['fp_machine'], mdata['fp_resources'], work_dir, run_tasks, fp_group_size) dispatcher.run_jobs(fp_resources, [fp_command], work_dir, run_tasks, fp_group_size, forward_common_files, forward_files, backward_files) elif LooseVersion(api_version) >= LooseVersion('1.0'): submission = make_submission( mdata['fp_machine'], mdata['fp_resources'], commands=[fp_command], work_path=work_dir, run_tasks=run_tasks, group_size=fp_group_size, forward_common_files=forward_common_files, forward_files=forward_files, backward_files=backward_files, outlog = 'fp.log', errlog = 'fp.log') submission.run_submission()