def clean_enhc(iter_index): iter_name = make_iter_name (iter_index) work_path = iter_name + "/" + enhc_name + "/" all_task = glob.glob(work_path + "/[0-9]*[0-9]") all_task.sort() cleaned_files = ['state*.cpt', '*log', 'traj.trr', 'topol.tpr', 'ener.edr', 'mdout.mdp'] cwd = os.getcwd() for ii in all_task : os.chdir(ii) clean_files(cleaned_files) os.chdir(cwd)
def clean_enhc(iter_index): iter_name = make_iter_name(iter_index) work_path = iter_name + "/" + enhc_name + "/" all_task = glob.glob(work_path + "/[0-9]*[0-9]") all_task.sort() all_task += glob.glob(work_path + "/*_job_id") all_task += glob.glob(work_path + "/*_finished") all_task += glob.glob(work_path + "/*.sub") all_task += glob.glob(work_path + "/*.json") all_task += glob.glob(work_path + "/*.sub.o*") cleaned_files = [ 'state*.cpt', '*log', 'traj.trr', 'topol.tpr', 'ener.edr', 'mdout.mdp' ] cwd = os.getcwd() for ii in all_task: if os.path.isdir(ii): os.chdir(ii) clean_files(cleaned_files) os.chdir(cwd) elif os.path.isfile(ii): os.remove(ii) print('enhanc clean done')