X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=django_simple%2Ftodo%2Fjobfiles.py;h=a569298178995ed94b96e93d0f4127a1f93665a5;hb=e7ce5a8738d19336986d61d52a8080fe7cb3eefb;hp=69c809edd75e8c192e20fc974e4ebfbc8ded08e1;hpb=591ac48194b207c02ffd7cda59c1c9709a114498;p=django_unres.git diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index 69c809e..a569298 100644 --- a/django_simple/todo/jobfiles.py +++ b/django_simple/todo/jobfiles.py @@ -14,16 +14,18 @@ logging.basicConfig() logger = logging.getLogger(__name__) def write_ssbond(ssbond): - list=[] + list=[] + if ssbond!='': + ssbond=json.loads(ssbond) for e in ssbond: list.append(e[0]) list.append(e[1]) list_sorted=sorted(list) - if len(list)>0: + if len(list)>0: return str(len(list))+' '+' '.join(map(str,list_sorted))+'\n'+\ str(len(ssbond))+' '+' '.join(map(str,list))+'\n' - else: + else: return '0\n' @@ -32,7 +34,7 @@ def write_on_task_save(sender, instance, **kwargs): if instance.ready and not instance.done and instance.running==0: if (not os.path.isdir(instance.jobdirname)): os.mkdir(instance.jobdirname) - os.chdir(instance.jobdirname) +# os.chdir(instance.jobdirname) @@ -41,14 +43,23 @@ def write_on_task_save(sender, instance, **kwargs): #wrapper = textwrap.TextWrapper(width=70) #word_list = wrapper.wrap(text=md.substitute(nstep=str(nstep))) - w="""WSC=1.00000 WSCP=1.23315 WELEC=0.84476 WBOND=1.00000 WANG=0.62954 & + if instance.unres_ff =='E0LL2Y': + w="""WSC=1.00000 WSCP=1.23315 WELEC=0.84476 WBOND=1.00000 WANG=0.62954 & WSCLOC=0.10554 WTOR=1.34316 WTORD=1.26571 WCORRH=0.19212 WCORR5=0.00000 & WCORR6=0.00000 WEL_LOC=0.37357 WTURN3=1.40323 WTURN4=0.64673 WTURN6=0.00000 & WVDWPP=0.23173 WHPB=1.00000 WSCCOR=0.25 & CUTOFF=7.00000 WCORR4=0.00000 """ + else: + w="""WSC=0.82686 WSCP=0.96947 WELEC=0.79373 WBOND=1.00000 WANG=0.46542 & +WSCLOC=0.07969 WTOR=0.81684 WTORD=0.67806 WCORRH=0.00000 WCORR5=0.00000 & +WCORR6=0.00000 WEL_LOC=0.71100 WTURN3=2.30298 WTURN4=0.86517 WTURN6=0.00000 & +WSCCOR=0.14577 WVDWPP=0.17781 WHPB=1.00000 WSCP14=0.00000 & +CUTOFF=7.00000 WCORR4=0.00000 +""" + - with open('file.inp','w') as f: + with open(instance.jobdirname+'/file.inp','w') as f: f.write(instance.name + ' UNRES server job'+ '\n') if instance.type == 'min' : @@ -117,7 +128,7 @@ CUTOFF=7.00000 WCORR4=0.00000 type_line = 'reset_vel='+ str(instance.remd_nstex)\ +' nstep='+str(instance.md_nstep)\ +' ntwe='+str(instance.md_ntwe)\ - +' ntwx='+str(instance.remd_nstex)\ + +' ntwx='+str(instance.md_ntwx)\ +' dt='+str(instance.md_dt) if instance.md_lang == 'langevin': type_line = type_line + ' lang=1 ' @@ -133,7 +144,7 @@ CUTOFF=7.00000 WCORR4=0.00000 type_line2 = 'nrep='+str(instance.remd_nrep) \ +' nstex='+str(instance.remd_nstex) \ +' tlist mlist sync nsyn='+str(instance.remd_nstex)\ - +' traj1file rest1file ' + +' traj1file rest1file TRAJCACHE=200' if instance.md_start == 'pdbstart': type_line = type_line + ' preminim cart' @@ -205,10 +216,19 @@ CUTOFF=7.00000 WCORR4=0.00000 if instance.type == 'min': - shutil.copy('../files/pbs.csh','.') + os.chdir(instance.jobdirname) + if instance.unres_ff =='E0LL2Y': + shutil.copy('../files/pbs.csh','.') + else: + shutil.copy('../files/pbs_new.csh','pbs.csh') ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') elif instance.type == 'md': - f1 = open('../files/pbs_md.csh', 'r') + os.chdir(instance.jobdirname) + if instance.unres_ff =='E0LL2Y': + f1 = open('../files/pbs_md.csh', 'r') + else: + f1 = open('../files/pbs_md_new.csh', 'r') f2 = open('pbs.csh', 'w') for line in f1: f2.write(line.replace('$dimen3',str(dimen3) )) @@ -221,10 +241,11 @@ CUTOFF=7.00000 WCORR4=0.00000 f1.close() ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') else: +# instance.type == 'remd' tmp1=json.loads(instance.remd_multi_m) nreplicas=sum(map(int, tmp1)) - # hardcoded for 4 core nodes with FGPROC=2 nodes=int(nreplicas*2/4) reszta = nreplicas*2-nodes*4 @@ -232,24 +253,46 @@ CUTOFF=7.00000 WCORR4=0.00000 pbs = '#PBS -l nodes='+str(nodes)+':ppn=4' else: pbs = '#PBS -l nodes='+str(nodes)+':ppn=4+1:ppn='+str(reszta) - - f1 = open('../files/pbs8.csh', 'r') + + tmp_ss='' + if instance.ssbond!='': + ix=[] + ii=0 + for i in range(0,len(seq)): + if seq[i]=='X': + ii=ii+1 + ix.append(ii) + l=[] + ss=json.loads(instance.ssbond) + for e in ss: + l.append(e[0]-ix[e[0]]) + l.append(e[1]-ix[e[1]]) + tmp_ss=' '.join(map(str,l)) + + os.chdir(instance.jobdirname) + if instance.unres_ff =='E0LL2Y': + f1 = open('../files/pbs8.csh', 'r') + else: + f1 = open('../files/pbs8_new.csh', 'r') f2 = open('pbs8.csh', 'w') for line in f1: if '#PBS -l nodes=4:ppn=4' in line: f2.write(line.replace('#PBS -l nodes=4:ppn=4', pbs)) + elif '$ssbond' in line: + f2.write(line.replace('$ssbond',tmp_ss)) else: tmp1=json.loads(instance.remd_multi_t) - f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'"')) + f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'" '+str(nreplicas))) f1.close() - f2.close() + f2.close() + os.chdir('..') # write wham & cluster input - with open('file_wham.inp','w') as f: - if instance.md_nstep/instance.remd_nstex*nreplicas<=8000: + with open(instance.jobdirname+'/file_wham.inp','w') as f: + if instance.md_nstep/instance.md_ntwx*nreplicas<=8000: isampl=1 else: - isampl=int(instance.md_nstep/instance.remd_nstex*nreplicas/8000) + isampl=int(instance.md_nstep/instance.md_ntwx*nreplicas/8000) if instance.md_pdbref: f.write('SEED='+str(instance.md_seed)+' isampl='+str(isampl)+ @@ -271,7 +314,7 @@ CUTOFF=7.00000 WCORR4=0.00000 for element in tmp1: f.write('nr=1 temp='+element+' fi=0.0 0.0 0.0 0.0 0.0\n') f.write('kh= 0.0 Q0=0.0\n') - rec=instance.md_nstep/instance.remd_nstex + rec=instance.md_nstep/instance.md_ntwx f.write('nfile_cx=1 rec_start='+str(rec/10) +' rec_end='+str(rec)+' totraj='+str(nreplicas)+'\n') f.write('file_MD000\n') @@ -280,7 +323,7 @@ CUTOFF=7.00000 WCORR4=0.00000 f.write('plik.pdb\n') - with open('file_cluster.inp','w') as f: + with open(instance.jobdirname+'/file_cluster.inp','w') as f: f.write(instance.name + ' UNRES server job'+ '\n') f.write('nres='+str(len(seq)) +' one_letter rescale=2 PRINT_CART PDBOUT=1 iopt=1' @@ -289,11 +332,12 @@ CUTOFF=7.00000 WCORR4=0.00000 for i in range(0,len(seq),80): f.write(seq[i:i+80]+'\n') f.write(write_ssbond(instance.ssbond)) - + + os.chdir(instance.jobdirname) ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs8.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') print ret_code.stdout.readlines() - os.chdir('..') logger.warning("Dir \"%s\" has been saved." % instance.jobdirname) @receiver(post_delete, sender=Task)