task = get_object_or_404(Task, id=task_id)
restart0(task)
return redirect('/')
+
+def add_restart_inp():
+ with open('file.inp','r') as f1, open ('file.inp.tmp','w') as f2:
+ for line in f1:
+ if 'reset_vel=' in line:
+ f2.write('{:79}'.format('restart'+line[7:]))
+ else:
+ f2.write(line)
+ os.remove('file.inp')
+ os.rename('file.inp.tmp','file.inp')
+ return
def restart0(task):
if os.path.isfile(task.jobdirname+'/finished'):
task.save()
if task.type == 'md':
os.chdir(task.jobdirname)
+ add_restart_inp()
ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
os.chdir('..')
elif task.type == 'remd':
os.chdir(task.jobdirname)
+ add_restart_inp()
tmp1=json.loads(task.remd_multi_m)
nreplicas=sum(map(int, tmp1))
with open('file_wham.inp','r') as f1, open ('file_wham.tmp','w') as f2: