tutorial update, d-amino correction
[django_unres.git] / django_simple / todo / jobfiles.py
index 25532da..44cf4a4 100644 (file)
@@ -84,7 +84,7 @@ def write_on_task_save(sender, instance, **kwargs):
 #wrapper = textwrap.TextWrapper(width=70)
 #word_list = wrapper.wrap(text=md.substitute(nstep=str(nstep)))
 
-     if  instance.unres_ff =='E0LL2Y':
+     if  instance.unres_ff =='FF2':
       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    &
@@ -221,6 +221,10 @@ CUTOFF=7.00000 WCORR4=0.00000"""
        f.write(word_list[-1]+'\n')
           
        if instance.md_start == 'pdbstart':
+        if instance.type == 'remd' :
+         f.write('print_min_ini print_min_res print_min_stat maxfun='+
+           str(instance.min_maxfun)+'\n')
+        else:
          f.write('print_min_ini print_min_res print_min_stat\n')
 
        
@@ -252,10 +256,10 @@ CUTOFF=7.00000 WCORR4=0.00000"""
        if instance.type == 'min' or instance.md_start == 'pdbstart':
           f.write('plik.pdb\n')
           f.write(write_ssbond(instance.ssbond))
-          if instance.md_seq_2d == '':
+          if instance.md_2d == '':
             f.write('0\n')
           else:
-            f.write(seq_2d_write(seq_2d_xx(instance.md_seq_2d,seq)))
+            f.write(seq_2d_write(seq_2d_xx(instance.md_2d,seq)))
 
        if instance.type == 'md' and instance.md_start != 'pdbstart':
 
@@ -295,7 +299,7 @@ CUTOFF=7.00000 WCORR4=0.00000"""
         
      if instance.type == 'min':
       os.chdir(instance.jobdirname)
-      if  instance.unres_ff =='E0LL2Y':
+      if  instance.unres_ff =='FF2':
         shutil.copy('../files/pbs.csh','.')
       else:
         shutil.copy('../files/pbs_new.csh','pbs.csh')
@@ -303,7 +307,7 @@ CUTOFF=7.00000 WCORR4=0.00000"""
       os.chdir('..')
      elif instance.type == 'md':
       os.chdir(instance.jobdirname)
-      if  instance.unres_ff =='E0LL2Y':
+      if  instance.unres_ff =='FF2':
         f1 = open('../files/pbs_md.csh', 'r')
       else:
         f1 = open('../files/pbs_md_new.csh', 'r') 
@@ -316,6 +320,7 @@ CUTOFF=7.00000 WCORR4=0.00000"""
       f1 = open('file.seq', 'w')
       for i in range(0,len(seq),80):
              f1.write(seq[i:i+80]+'\n')
+      f1.write('\n')       
       f1.close()
 
       ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)      
@@ -348,7 +353,7 @@ CUTOFF=7.00000 WCORR4=0.00000"""
         tmp_ss=' '.join(map(str,l))
 
       os.chdir(instance.jobdirname)
-      if  instance.unres_ff =='E0LL2Y':
+      if  instance.unres_ff =='FF2':
         f1 = open('../files/pbs8.csh', 'r')
       else:
         f1 = open('../files/pbs8_new.csh', 'r')
@@ -363,6 +368,13 @@ CUTOFF=7.00000 WCORR4=0.00000"""
            f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'" '+str(nreplicas)))
       f1.close()
       f2.close()
+
+      f1 = open('file.seq', 'w')
+      for i in range(0,len(seq),80):
+             f1.write(seq[i:i+80]+'\n')
+      f1.write('\n')       
+      f1.close()
+      
       os.chdir('..')  
 
 # write wham & cluster input
@@ -393,13 +405,25 @@ CUTOFF=7.00000 WCORR4=0.00000"""
              f.write(seq_2d_write_50(seq_2d_xx(instance.md_2d,seq)))
 
           if instance.saxs_data != '':
+             saxs_r=[]
+             saxs_P=[]
+             saxs_norm=0
+             r_last=None
              fsaxs = open(instance.jobdirname+'/saxs.data', 'w')
              lines=instance.saxs_data.split('\n')
              for line in lines:
               tmp=line.split()
               if len(tmp)==2:
                f.write(tmp[0]+' '+tmp[1]+'\n')
-               fsaxs.write(tmp[0]+' '+tmp[1]+'\n') 
+               saxs_r.append(tmp[0])
+               saxs_P.append(float(tmp[1]))
+               if r_last==None:
+                  r_last=float(tmp[0])
+               else:
+                  saxs_norm += float(tmp[1])*(float(tmp[0])-r_last)
+                  r_last=float(tmp[0])
+             for r,p in zip(saxs_r,saxs_P):
+               fsaxs.write('{} {}\n'.format(r,p/saxs_norm)) 
              fsaxs.close()
 
           f.write(w+'\n')