nexus: small fix for pwscf restarts

This commit is contained in:
Jaron Krogel 2017-01-20 11:27:42 -05:00
parent 3967fcd3ee
commit 2f2590159f
2 changed files with 6 additions and 4 deletions

View File

@ -221,16 +221,17 @@ class Pwscf(Simulation):
fobj.close()
not_converged = 'convergence NOT achieved' in output
time_exceeded = 'Maximum CPU time exceeded' in output
user_stop = 'Program stopped by user request' in output
run_finished = 'JOB DONE' in output
restart = run_finished and self.restartable \
and (not_converged or time_exceeded)
restartable = not_converged or time_exceeded or user_stop
restart = run_finished and self.restartable and restartable
if restart:
self.save_attempt()
self.input.control.restart_mode = 'restart'
self.reset_indicators()
else:
self.finished = run_finished
self.failed = not_converged or time_exceeded
self.failed = restartable
#end if
#end def check_sim_status

View File

@ -881,12 +881,13 @@ class Simulation(NexusCore):
#end for
if len(filepaths)>0:
prefix = self.identifier+'_attempt'
n=1
n=0
for dir in os.listdir(self.locdir):
if dir.startswith(prefix):
n=max(n,int(dir.replace(prefix,'')))
#end if
#end for
n+=1
attempt_dir = os.path.join(self.locdir,prefix+str(n))
os.makedirs(attempt_dir)
for filepath in filepaths: