def main(): # ---------- lock if os.path.isfile('lock_cryspy'): raise SystemExit('lock_cryspy file exists') else: with open('lock_cryspy', 'w') as f: pass # create vacant file # ---------- initialize if not os.path.isfile('cryspy.stat'): cryspy_init.initialize() os.remove('lock_cryspy') raise SystemExit() # ---------- restart else: stat, init_struc_data = cryspy_restart.restart() # ---------- check point 1 if rin.stop_chkpt == 1: print('Stop at check point 1') os.remove('lock_cryspy') raise SystemExit() # ---------- check calc files in ./calc_in select_code.check_calc_files() # ---------- mkdir work/fin os.makedirs('work/fin', exist_ok=True) # ---------- instantiate Ctrl_job class jobs = Ctrl_job(stat, init_struc_data) # ---------- check job status jobs.check_job() # ---------- handle job jobs.handle_job() # ---------- recheck for skip and done if jobs.id_queueing: cnt_recheck = 0 while jobs.recheck: cnt_recheck += 1 jobs.recheck = False # True --> False print('\n\n recheck {}\n'.format(cnt_recheck)) jobs.check_job() jobs.handle_job() if not (jobs.id_queueing or jobs.id_running): # ---------- next selection or generation if rin.algo in ['BO', 'LAQA', 'EA']: jobs.next_sg() # ---------- for RS else: with open('cryspy.out', 'a') as fout: fout.write('\nDone all structures!\n') print('Done all structures!') # ---------- unlock os.remove('lock_cryspy')
elif rin.algo == 'LAQA': stat, LAQA_id_data, LAQA_data = LAQA_init.initialize( stat, init_struc_data) if rin.kpt_flag: kpt_data = cryspy_init.kpt_init() if rin.energy_step_flag: energy_step_data = cryspy_init.energy_step_init() if rin.struc_step_flag: struc_step_data = cryspy_init.struc_step_init() if rin.fs_step_flag: fs_step_data = cryspy_init.fs_step_init() # ---------- restart else: # ------ cpsy_restart stat = cryspy_restart.restart() # ------ load data init_struc_data = pkl_data.load_init_struc() opt_struc_data = pkl_data.load_opt_struc() rslt_data = pkl_data.load_rslt() if rin.algo == 'RS': RS_id_data = pkl_data.load_RS_id() elif rin.algo == 'BO': BO_id_data = pkl_data.load_BO_id() BO_data = pkl_data.load_BO_data() elif rin.algo == 'LAQA': LAQA_id_data = pkl_data.load_LAQA_id() LAQA_data = pkl_data.load_LAQA_data() if rin.kpt_flag: kpt_data = pkl_data.load_kpt() if rin.energy_step_flag:
# ---------- lock if os.path.isfile('lock_cryspy'): raise SystemExit('lock_cryspy file exists') else: with open('lock_cryspy', 'w') as f: pass # create vacant file # ---------- initialize if not os.path.isfile('cryspy.stat'): cryspy_init.initialize() os.remove('lock_cryspy') raise SystemExit() # ---------- restart else: stat, init_struc_data = cryspy_restart.restart() # ---------- check point 1 if rin.stop_chkpt == 1: print('Stop at check point 1') os.remove('lock_cryspy') raise SystemExit() # ---------- check calc files in ./calc_in select_code.check_calc_files() # os.makedirs('work/fin', exist_ok=True) # python3.2 or later if not os.path.isdir('work/fin'): os.makedirs('work/fin') # ---------- instantiate Ctrl_job class