def vasp_run(n, des): #allows to run vasp several times, here fireworks can be used #n - number of attempts #des - description of run for i in range(n): # max three attempts out = runBash(vasprun_command) printlog(des, 'attempt', i, 'out is', out) cl = CalculationVasp(output='OUTCAR') out = cl.read_results(show='fo') printlog('Results are', imp='y') printlog(out, imp='y') status = check(cl) if status == 0: break else: if os.path.exists('CONTCAR'): copyfile('CONTCAR', 'POSCAR') else: printlog( 'No CONTCAR was found. No further attempts to run VASP', imp='y') break return cl
vasprun_command = params.get('vasp_run') or 'vasp' images = params.get('images') or 3 # number of images mode = params.get('mode') or 'inherit' # number of images printlog('Choosing mode', mode, imp='y') if mode == 'independent': if 1: """1. Calculate (relax) initial and final positions """ cl1 = vasp_step(1, 'Start position', 1) cl2 = vasp_step(2, 'End position', 1) else: cl1 = CalculationVasp(output='1.OUTCAR') cl1.read_results(show='fo') cl2 = CalculationVasp(output='2.OUTCAR') cl2.read_results(show='fo') """2. Create intermediate steps""" interpolate(cl1.end, cl2.end, images, 3) printlog('Interpolation was successful!\n', imp='y') """3. Calculate energies of intermediate steps""" update_incar(parameter='NSW', value=0, run=1, write=0) for v in range(3, 3 + images): vasp_step(v, 'Intermediate position' + str(v), 1) elif mode == 'inherit': #from initial to last