NMR log-exp from Adam
[unres.git] / source / unres / src_MD-M / initialize_p.F
index bb049ab..11a8267 100644 (file)
@@ -80,7 +80,9 @@ C
       igeom=  8
       intin=  9
       ithep= 11
+      ithep_pdb=51
       irotam=12
+      irotam_pdb=52
       itorp= 13
       itordp= 23
       ielep= 14
@@ -117,6 +119,14 @@ C
       icsa_in=40
 crc for ifc error 118
       icsa_pdb=42
+C Lipidic input file for parameters range 60-79
+      iliptranpar=60
+C input file for transfer sidechain and peptide group inside the
+C lipidic environment if lipid is implicite
+
+C DNA input files for parameters range 80-99
+C Suger input files for parameters range 100-119
+C All-atom input files for parameters range 120-149
 C
 C Set default weights of the energy terms.
 C
@@ -144,8 +154,10 @@ c      call memmon_print_usage()
       enddo
       do i=1,ntyp
        do j=1,ntyp
-         aa(i,j)=0.0D0
-         bb(i,j)=0.0D0
+         aa_aq(i,j)=0.0D0
+         bb_aq(i,j)=0.0D0
+          aa_lip(i,j)=0.0D0
+          bb_lip(i,j)=0.0D0
          augm(i,j)=0.0D0
          sigma(i,j)=0.0D0
          r0(i,j)=0.0D0
@@ -161,8 +173,12 @@ c      call memmon_print_usage()
        rr0(i)=0.0D0
        a0thet(i)=0.0D0
        do j=1,2
-         athet(j,i)=0.0D0
-         bthet(j,i)=0.0D0
+         do ichir1=-1,1
+          do ichir2=-1,1
+          athet(j,i,ichir1,ichir2)=0.0D0
+          bthet(j,i,ichir1,ichir2)=0.0D0
+          enddo
+         enddo
         enddo
        do j=0,3
          polthet(j,i)=0.0D0
@@ -188,15 +204,39 @@ c      call memmon_print_usage()
       enddo
       nlob(ntyp1)=0
       dsc(ntyp1)=0.0D0
-      do i=1,maxtor
+      do i=-maxtor,maxtor
        itortyp(i)=0
-       do j=1,maxtor
+cc      write (iout,*) "TU DOCHODZE",i,itortyp(i)
+       do iblock=1,2
+        do j=-maxtor,maxtor
          do k=1,maxterm
-           v1(k,j,i)=0.0D0
-           v2(k,j,i)=0.0D0
+            v1(k,j,i,iblock)=0.0D0
+            v2(k,j,i,iblock)=0.0D0
           enddo
         enddo
       enddo
+      enddo
+      do iblock=1,2
+       do i=-maxtor,maxtor
+        do j=-maxtor,maxtor
+         do k=-maxtor,maxtor
+          do l=1,maxtermd_1
+            v1c(1,l,i,j,k,iblock)=0.0D0
+            v1s(1,l,i,j,k,iblock)=0.0D0
+            v1c(2,l,i,j,k,iblock)=0.0D0
+            v1s(2,l,i,j,k,iblock)=0.0D0
+          enddo !l
+          do l=1,maxtermd_2
+           do m=1,maxtermd_2
+            v2c(m,l,i,j,k,iblock)=0.0D0
+            v2s(m,l,i,j,k,iblock)=0.0D0
+           enddo !m
+          enddo !l
+        enddo !k
+       enddo !j
+      enddo !i
+      enddo !iblock
+
       do i=1,maxres
        itype(i)=0
        itel(i)=0
@@ -215,6 +255,32 @@ C Initialize the bridge arrays
        ihpb(i)=0
        jhpb(i)=0
       enddo
+C Initialize correlation arrays
+      do i=1,maxres
+       do k=1,2
+        b1(k,i)=0.0
+        b2(k,i)=0.0
+        b1tilde(k,i)=0.0
+c        b2tilde(k,i)=0.0
+        do j=1,2
+C        CC(j,k,i)=0.0
+C        Ctilde(j,k,i)=0.0
+C        DD(j,k,i)=0.0
+C        Dtilde(j,k,i)=0.0
+        EE(j,k,i)=0.0
+        enddo
+       enddo
+      enddo
+      do i=-maxtor,maxtor
+       do k=1,2
+        do j=1,2
+        CC(j,k,i)=0.0
+        Ctilde(j,k,i)=0.0
+        DD(j,k,i)=0.0
+        Dtilde(j,k,i)=0.0
+        enddo
+      enddo
+      enddo
 C
 C Initialize timing.
 C
@@ -237,8 +303,8 @@ C
 C Initialize constants used to split the energy into long- and short-range
 C components
 C
-      r_cut=2.0d0
-      rlamb=0.3d0
+C      r_cut=2.0d0
+C      rlamb=0.3d0
 #ifndef SPLITELE
       nprint_ene=nprint_ene-1
 #endif
@@ -251,24 +317,32 @@ c-------------------------------------------------------------------------
       include 'COMMON.NAMES'
       include 'COMMON.FFIELD'
       data restyp /
+     &'DD','DAU','DAI','DDB','DSM','DPR','DLY','DAR','DHI','DAS','DGL',
+     & 'DSG','DGN','DSN','DTH',
+     &'DYY','DAL','DTY','DTR','DVA','DLE','DIL','DPN','MED','DCY','ZER',
      &'CYS','MET','PHE','ILE','LEU','VAL','TRP','TYR','ALA','GLY','THR',
-     &'SER','GLN','ASN','GLU','ASP','HIS','ARG','LYS','PRO','D'/
+     &'SER','GLN','ASN','GLU','ASP','HIS','ARG','LYS','PRO','SME','DBZ',
+     &'AIB','ABU','D'/
       data onelet /
+     &'z','z','z','z','z','p','k','r','h','d','e','n','q','s','t','g',
+     &'a','y','w','v','l','i','f','m','c','x',
      &'C','M','F','I','L','V','W','Y','A','G','T',
-     &'S','Q','N','E','D','H','R','K','P','X'/
+     &'S','Q','N','E','D','H','R','K','P','z','z','z','z','X'/
       data potname /'LJ','LJK','BP','GB','GBV'/
       data ename /
      &   "EVDW SC-SC","EVDW2 SC-p","EES p-p","ECORR4 ","ECORR5 ",
      &   "ECORR6 ","EELLO ","ETURN3 ","ETURN4 ","ETURN6 ",
      &   "EBE bend","ESC SCloc","ETORS ","ETORSD ","EHPB ","EVDWPP ",
-     &   "ESTR ","EVDW2_14 ","UCONST ", "      ","ESCCOR"/
+     &   "ESTR ","EVDW2_14 ","UCONST ", "EDIHC ","ESCCOR",
+     &   "Eliptran","Eafmforce","Ehomology","ESAXS"/
       data wname /
      &   "WSC","WSCP","WELEC","WCORR","WCORR5","WCORR6","WEL_LOC",
      &   "WTURN3","WTURN4","WTURN6","WANG","WSCLOC","WTOR","WTORD",
-     &   "WSTRAIN","WVDWPP","WBOND","SCAL14","     ","    ","WSCCOR"/
-      data nprint_ene /20/
+     &   "WSTRAIN","WVDWPP","WBOND","SCAL14","WDIHCSN","    ","WSCCOR",
+     &    "Wliptran","WAFM ","EHOMO","WSAXS"/
+      data nprint_ene /25/
       data print_order/1,2,3,11,12,13,14,4,5,6,7,8,9,10,19,18,15,17,16,
-     & 21,0/
+     & 21,24,22,23,20,25/
       end 
 c---------------------------------------------------------------------------
       subroutine init_int_table
@@ -554,6 +628,11 @@ C Partition local interactions
       call int_bounds(nres-2,ithet_start,ithet_end)
       ithet_start=ithet_start+2
       ithet_end=ithet_end+2
+      call int_bounds(nsaxs,isaxs_start,isaxs_end)
+c      isaxs_start=isaxs_start+nnt-1
+c      isaxs_end=isaxs_end+nnt-1
+      write (iout,*) me," isaxs_start",isaxs_start,
+     &  " isaxs_end",isaxs_end
       call int_bounds(nct-nnt-2,iturn3_start,iturn3_end) 
       iturn3_start=iturn3_start+nnt
       iphi_start=iturn3_start+2
@@ -580,6 +659,8 @@ C Partition local interactions
       call int_bounds(nct-nnt,ibondp_start,ibondp_end) 
       ibondp_start=ibondp_start+nnt
       ibondp_end=ibondp_end+nnt
+      call int_bounds(nres,ilip_start,ilip_end)
+      ilip_start=ilip_start
       call int_bounds1(nres-1,ivec_start,ivec_end) 
 c      print *,"Processor",myrank,fg_rank,fg_rank1,
 c     &  " ivec_start",ivec_start," ivec_end",ivec_end
@@ -665,12 +746,16 @@ c      nlen=nres-nnt+1
         iaux=iphi1_end-iphi1_start+1
         call MPI_Allgather(iaux,1,MPI_INTEGER,iphi1_count(0),1,
      &    MPI_INTEGER,FG_COMM,IERROR)
-        do i=0,maxprocs-1
+        write (iout,*) "ielstart before zeroing out",max_fg_procs
+        call flush (iout)
+        do i=0,max_fg_procs-1
           do j=1,maxres
             ielstart_all(j,i)=0
             ielend_all(j,i)=0
           enddo
         enddo
+        write (iout,*) "ielstart zeroed out"
+        call flush (iout)
         call MPI_Allgather(iturn3_start,1,MPI_INTEGER,
      &    iturn3_start_all(0),1,MPI_INTEGER,FG_COMM,IERROR)
         call MPI_Allgather(iturn4_start,1,MPI_INTEGER,
@@ -805,6 +890,7 @@ c        call flush(iout)
 c        write (iout,*) "Gather itask_cont_to ended"
 c        call flush(iout)
         if (fg_rank.eq.king) then
+         if (me.eq.0 .or. .not. out1file) then
           write (iout,*)"Contact receive task map (proc, #tasks, tasks)"
           do i=0,nfgtasks-1
             write (iout,'(20i4)') i,ntask_cont_from_all(i),
@@ -819,6 +905,7 @@ c        call flush(iout)
           enddo
           write (iout,*)
           call flush(iout)
+         endif
 C Check if every send will have a matching receive
           ncheck_to=0
           ncheck_from=0
@@ -826,7 +913,8 @@ C Check if every send will have a matching receive
             ncheck_to=ncheck_to+ntask_cont_to_all(i)
             ncheck_from=ncheck_from+ntask_cont_from_all(i)
           enddo
-          write (iout,*) "Control sums",ncheck_from,ncheck_to
+          if (me.eq.0 .or. .not. out1file)
+     &     write (iout,*) "Control sums",ncheck_from,ncheck_to
           if (ncheck_from.ne.ncheck_to) then
             write (iout,*) "Error: #receive differs from #send."
             write (iout,*) "Terminating program...!"
@@ -1090,6 +1178,8 @@ c        write (iout,*) "MPI_ROTAT2",MPI_ROTAT2
       iphi1_end=nres
       idihconstr_start=1
       idihconstr_end=ndih_constr
+      isaxs_start=1
+      isaxs_end=nsaxs
       iphid_start=iphi_start
       iphid_end=iphi_end-1
       itau_start=4
@@ -1097,13 +1187,16 @@ c        write (iout,*) "MPI_ROTAT2",MPI_ROTAT2
       ibond_start=2
       ibond_end=nres-1
       ibondp_start=nnt
-      ibondp_end=nct-1
+C      ibondp_end=nct-1
+      ibondp_end=nct
       ivec_start=1
       ivec_end=nres-1
       iset_start=3
       iset_end=nres+1
       iint_start=2
       iint_end=nres-1
+      ilip_start=1
+      ilip_end=nres
 #endif
       return
       end 
@@ -1374,9 +1467,12 @@ c------------------------------------------------------------------------------
       include 'COMMON.SBRIDGE'
       include 'COMMON.IOUNITS'
       include 'COMMON.SETUP'
+      include 'COMMON.CONTROL'
+c      write(2,*)"hpb_partition: nhpb=",nhpb
 #ifdef MPI
       call int_bounds(nhpb,link_start,link_end)
-      write (iout,*) 'Processor',fg_rank,' CG group',kolor,
+      if (.not. out1file) 
+     &  write (iout,*) 'Processor',fg_rank,' CG group',kolor,
      &  ' absolute rank',MyRank,
      &  ' nhpb',nhpb,' link_start=',link_start,
      &  ' link_end',link_end
@@ -1384,5 +1480,71 @@ c------------------------------------------------------------------------------
       link_start=1
       link_end=nhpb
 #endif
+c      write(2,*)"hpb_partition: link_start=",nhpb," link_end=",link_end
+      return
+      end
+c------------------------------------------------------------------------------
+      subroutine homology_partition
+      implicit real*8 (a-h,o-z)
+      include 'DIMENSIONS'
+#ifdef MPI
+      include 'mpif.h'
+#endif
+      include 'COMMON.SBRIDGE'
+      include 'COMMON.IOUNITS'
+      include 'COMMON.SETUP'
+      include 'COMMON.CONTROL'
+      include 'COMMON.MD'
+      include 'COMMON.INTERACT'
+cd      write(iout,*)"homology_partition: lim_odl=",lim_odl,
+cd     &   " lim_dih",lim_dih
+#ifdef MPI
+      if (me.eq.king .or. .not. out1file) write (iout,*) "MPI"
+      call int_bounds(lim_odl,link_start_homo,link_end_homo)
+      call int_bounds(lim_dih,idihconstr_start_homo,
+     &  idihconstr_end_homo)
+      idihconstr_start_homo=idihconstr_start_homo+nnt-1+3
+      idihconstr_end_homo=idihconstr_end_homo+nnt-1+3
+      if (me.eq.king .or. .not. out1file) 
+     &  write (iout,*) 'Processor',fg_rank,' CG group',kolor,
+     &  ' absolute rank',MyRank,
+     &  ' lim_odl',lim_odl,' link_start=',link_start_homo,
+     &  ' link_end',link_end_homo,' lim_dih',lim_dih,
+     &  ' idihconstr_start_homo',idihconstr_start_homo,
+     &  ' idihconstr_end_homo',idihconstr_end_homo
+#else
+      write (iout,*) "Not MPI"
+      link_start_homo=1
+      link_end_homo=lim_odl
+      idihconstr_start_homo=nnt+3
+      idihconstr_end_homo=lim_dih+nnt-1+3
+      write (iout,*) 
+     &  ' lim_odl',lim_odl,' link_start=',link_start_homo,
+     &  ' link_end',link_end_homo,' lim_dih',lim_dih,
+     &  ' idihconstr_start_homo',idihconstr_start_homo,
+     &  ' idihconstr_end_homo',idihconstr_end_homo
+#endif
+      return
+      end
+c------------------------------------------------------------------------------
+      subroutine NMRpeak_partition
+      implicit real*8 (a-h,o-z)
+      include 'DIMENSIONS'
+#ifdef MPI
+      include 'mpif.h'
+#endif
+      include 'COMMON.SBRIDGE'
+      include 'COMMON.IOUNITS'
+      include 'COMMON.SETUP'
+#ifdef MPI
+      call int_bounds(npeak,link_start_peak,link_end_peak)
+      write (iout,*) 'Processor',fg_rank,' CG group',kolor,
+     &  ' absolute rank',MyRank,
+     &  ' npeak',npeak,' link_start_peak=',link_start_peak,
+     &  ' link_end_peak',link_end_peak
+#else
+      link_start_peak=1
+      link_end_peak=npeak
+#endif
       return
       end