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')
from __future__ import print_function import os from CrySPY.BO import BO_init, BO_restart from CrySPY.interface import select_code from CrySPY.job import ctrl_job from CrySPY.IO import pkl_data from CrySPY.IO import read_input as rin from CrySPY.LAQA import LAQA_init, LAQA_restart from CrySPY.start import cryspy_init, cryspy_restart # ---------- initialize if not os.path.isfile('cryspy.stat'): # ------ cryspy_init stat, init_struc_data, opt_struc_data, rslt_data = cryspy_init.initialize() if rin.algo == 'RS': RS_id_data = cryspy_init.RS_init(stat) elif rin.algo == 'BO': stat, rslt_data, BO_id_data, BO_data = BO_init.initialize( stat, init_struc_data, rslt_data) 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:
from CrySPY.interface import select_code from CrySPY.job import ctrl_job from CrySPY.IO import read_input as rin from CrySPY.start import cryspy_init, cryspy_restart # ---------- 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()