django-lazysignup convert to reg user
[django_unres.git] / django_simple / todo / jobfiles.py
index ce0cf44..400a2f7 100644 (file)
@@ -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'
 
 
@@ -126,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 '
@@ -142,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'
@@ -229,7 +231,7 @@ CUTOFF=7.00000 WCORR4=0.00000
         f1 = open('../files/pbs_md_new.csh', 'r') 
       f2 = open('pbs.csh', 'w')
       for line in f1:
-           f2.write(line.replace('$dimen3',str(dimen3) ))
+           f2.write(line.replace('$dimen3',str(dimen3)+' '+str(instance.md_temp) ))
       f1.close()
       f2.close()  
 
@@ -251,6 +253,21 @@ 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)
+        
+      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':
@@ -261,6 +278,8 @@ CUTOFF=7.00000 WCORR4=0.00000
       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)+'" '+str(nreplicas)))
@@ -270,17 +289,19 @@ CUTOFF=7.00000 WCORR4=0.00000
 
 # write wham & cluster input
       with open(instance.jobdirname+'/file_wham.inp','w') as f:
-          if instance.md_nstep/instance.remd_nstex*nreplicas<=8000:
+          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)+
-               ' einicheck=1 rescale=2 delta=0.02 cxfile classify\n')
+            f.write('{:79}'.format('SEED='+str(instance.md_seed)+' isampl='+str(isampl)+
+               ' einicheck=1 rescale=2 delta=0.02 cxfile classify')+'&\n')
+            f.write('BOXX=1000. BOXY=1000. BOXZ=1000. \n')
           else:    
-            f.write('SEED='+str(instance.md_seed)+' isampl='+str(isampl)+
-              ' einicheck=1 rescale=2 delta=0.02 cxfile\n')
+            f.write('{:79}'.format('SEED='+str(instance.md_seed)+' isampl='+str(isampl)+
+              ' einicheck=1 rescale=2 delta=0.02 cxfile')+'&\n')
+            f.write('BOXX=1000. BOXY=1000. BOXZ=1000. \n')
           f.write('nres='+str(len(seq))+' one_letter\n')
           for i in range(0,len(seq),80):
              f.write(seq[i:i+80]+'\n')
@@ -295,7 +316,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')
@@ -306,9 +327,10 @@ CUTOFF=7.00000 WCORR4=0.00000
            
       with open(instance.jobdirname+'/file_cluster.inp','w') as f:
           f.write(instance.name + ' UNRES server job'+ '\n')
-          f.write('nres='+str(len(seq))
+          f.write('{:79}'.format('nres='+str(len(seq))
              +' one_letter rescale=2 PRINT_CART PDBOUT=1 iopt=1'
-             +' temper='+str(instance.remd_cluter_temp)+'\n')
+             +' temper='+str(instance.remd_cluter_temp))+'&\n')
+          f.write('BOXX=1000. BOXY=1000. BOXZ=1000. \n')
           f.write(w)
           for i in range(0,len(seq),80):
              f.write(seq[i:i+80]+'\n')