first introduction of valence constrains - not working yet
[unres.git] / source / unres / src_MD-M / initialize_p.F
index a9414d3..6c5f4eb 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
@@ -161,10 +163,14 @@ 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
+        do j=0,3
          polthet(j,i)=0.0D0
         enddo
        do j=1,3
@@ -188,15 +194,39 @@ c      call memmon_print_usage()
       enddo
       nlob(ntyp1)=0
       dsc(ntyp1)=0.0D0
-      do i=1,maxtor
-       itortyp(i)=0
-       do j=1,maxtor
-         do k=1,maxterm
-           v1(k,j,i)=0.0D0
-           v2(k,j,i)=0.0D0
+      do i=-maxtor,maxtor
+        itortyp(i)=0
+cc      write (iout,*) "TU DOCHODZE",i,itortyp(i)
+       do iblock=1,2
+        do j=-maxtor,maxtor
+          do k=1,maxterm
+            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
@@ -251,11 +281,17 @@ 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 ",
@@ -308,7 +344,7 @@ C... to deal with by current processor.
         itask_cont_from(i)=fg_rank
         itask_cont_to(i)=fg_rank
       enddo
-      lprint=.false.
+      lprint=energy_dec
       if (lprint)
      &write (iout,*) 'INIT_INT_TABLE nres=',nres,' nnt=',nnt,' nct=',nct
       n_sc_int_tot=(nct-nnt+1)*(nct-nnt)/2-nss
@@ -341,6 +377,7 @@ cd    write (iout,*) 'ns=',ns,' nss=',nss,' ihpb,jhpb',
 cd   &   (ihpb(i),jhpb(i),i=1,nss)
       do i=nnt,nct-1
         scheck=.false.
+        if (dyn_ss) goto 10
         do ii=1,nss
           if (ihpb(ii).eq.i+nres) then
             scheck=.true.
@@ -406,6 +443,7 @@ c            write (iout,*) 'jj=nct'
       iatsc_s=nnt
       iatsc_e=nct-1
 #endif
+      if (iatsc_s.eq.0) iatsc_s=1
 #ifdef MPI
       if (lprint) write (*,*) 'Processor',fg_rank,' CG Group',kolor,
      &   ' absolute rank',myrank,' iatsc_s=',iatsc_s,' iatsc_e=',iatsc_e
@@ -538,6 +576,7 @@ cd        write (iout,*) 'i.gt.nct-iscp'
         endif 
       enddo ! i
 #endif
+      if (iatscp_s.eq.0) iatscp_s=1
       if (lprint) then
         write (iout,'(a)') 'SC-p interaction array:'
         do i=iatscp_s,iatscp_e
@@ -560,6 +599,9 @@ C Partition local interactions
       iphi_end=iturn3_end+2
       iturn3_start=iturn3_start-1
       iturn3_end=iturn3_end-1
+      call int_bounds(nres-3,itau_start,itau_end)
+      itau_start=itau_start+3
+      itau_end=itau_end+3
       call int_bounds(nres-3,iphi1_start,iphi1_end)
       iphi1_start=iphi1_start+3
       iphi1_end=iphi1_end+3
@@ -587,6 +629,13 @@ c     &  " ivec_start",ivec_start," ivec_end",ivec_end
       else
         call int_bounds(ndih_constr,idihconstr_start,idihconstr_end)
       endif
+      if (ntheta_constr.eq.0) then
+        idihconstr_start=1
+        idihconstr_end=0
+      else
+        call int_bounds
+     &  (ntheta_constr,ithetaconstr_start,ithetaconstr_end)
+      endif
 c      nsumgrad=(nres-nnt)*(nres-nnt+1)/2
 c      nlen=nres-nnt+1
       nsumgrad=(nres-nnt)*(nres-nnt+1)/2
@@ -622,6 +671,9 @@ c      nlen=nres-nnt+1
      & ' iset_start',iset_start,' iset_end',iset_end,
      & ' idihconstr_start',idihconstr_start,' idihconstr_end',
      &   idihconstr_end
+     & ' ithetaconstr_start',ithetaconstr_start,' ithetaconstr_end',
+     &   ithetaconstr_end
+
        write (*,*) 'Processor:',fg_rank,myrank,' igrad_start',
      &   igrad_start,' igrad_end',igrad_end,' ngrad_start',ngrad_start,
      &   ' ngrad_end',ngrad_end
@@ -1086,8 +1138,12 @@ c        write (iout,*) "MPI_ROTAT2",MPI_ROTAT2
       iphi1_end=nres
       idihconstr_start=1
       idihconstr_end=ndih_constr
+      ithetaconstr_start=1
+      ithetaconstr_end=ntheta_constr
       iphid_start=iphi_start
       iphid_end=iphi_end-1
+      itau_start=4
+      itau_end=nres
       ibond_start=2
       ibond_end=nres-1
       ibondp_start=nnt
@@ -1109,14 +1165,15 @@ c---------------------------------------------------------------------------
       include "COMMON.INTERACT"
       include "COMMON.SETUP"
       include "COMMON.IOUNITS"
-      integer ii,jj,itask(4),ntask_cont_to,itask_cont_to(0:max_fg_procs-1)
+      integer ii,jj,itask(4),ntask_cont_to,
+     &itask_cont_to(0:max_fg_procs-1)
       logical flag
       integer iturn3_start_all,iturn3_end_all,iturn4_start_all,
      & iturn4_end_all,iatel_s_all,iatel_e_all,ielstart_all,ielend_all
       common /przechowalnia/ iturn3_start_all(0:max_fg_procs),
      & iturn3_end_all(0:max_fg_procs),iturn4_start_all(0:max_fg_procs),
      & iturn4_end_all(0:max_fg_procs),iatel_s_all(0:max_fg_procs),
-     & iatel_e_all(0:max_fg_procs),ielstart_all(maxres,0:max_fg_procs-1),
+     &iatel_e_all(0:max_fg_procs),ielstart_all(maxres,0:max_fg_procs-1),
      & ielend_all(maxres,0:max_fg_procs-1)
       integer iproc,isent,k,l
 c Determines whether to send interaction ii,jj to other processors; a given