From: Cezary Czaplewski Date: Mon, 16 Apr 2018 15:08:54 +0000 (+0200) Subject: restart conflict with preminim X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=945a3be3d25aa78881674906c116fe48002efe81;p=django_unres.git restart conflict with preminim --- diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index 61d2c45..6311e07 100644 --- a/django_simple/todo/jobfiles.py +++ b/django_simple/todo/jobfiles.py @@ -147,7 +147,7 @@ CUTOFF=7.00000 WCORR4=0.00000""" if instance.md_pdbref: control_line = control_line+'pdbref ' - type_line = 'restart reset_vel=0'\ + type_line = ' reset_vel=0'\ +' t_bath='+str(instance.md_temp)\ +' nstep='+str(instance.md_nstep)\ +' ntwe='+str(instance.md_ntwe)\ @@ -187,7 +187,7 @@ CUTOFF=7.00000 WCORR4=0.00000""" cntrl_saxs=' nsaxs='+str(nsaxs)+' scal_rad='+str(instance.scal_rad) control_line += cntrl_saxs - type_line = 'restart reset_vel='+ str(instance.remd_nstex)\ + type_line = ' reset_vel='+ str(instance.remd_nstex)\ +' nstep='+str(instance.md_nstep)\ +' ntwe='+str(instance.md_ntwe)\ +' ntwx='+str(instance.md_ntwx)\ diff --git a/django_simple/todo/views.py b/django_simple/todo/views.py index e1ac2b0..d38312f 100644 --- a/django_simple/todo/views.py +++ b/django_simple/todo/views.py @@ -910,6 +910,17 @@ def restart(request, task_id): 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'): @@ -920,10 +931,12 @@ def restart0(task): 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: