New valence-torsionals completed
[unres.git] / source / unres / src_MD-M / parmread.F
index 438f544..e96dfc3 100644 (file)
@@ -101,6 +101,8 @@ c
         enddo
       endif
 C reading lipid parameters
+      write (iout,*) "iliptranpar",iliptranpar
+      call flush(iout)
        read(iliptranpar,*) pepliptran
        do i=1,ntyp
        read(iliptranpar,*) liptranene(i)
@@ -219,6 +221,8 @@ C Kozlowska et al., J. Phys.: Condens. Matter 19 (2007) 285203
 C
       read (ithep,*,err=111,end=111) nthetyp,ntheterm,ntheterm2,
      &  ntheterm3,nsingle,ndouble
+      write (iout,*) "ithep",ithep
+      call flush(iout)
       nntheterm=max0(ntheterm,ntheterm2,ntheterm3)
       read (ithep,*,err=111,end=111) (ithetyp(i),i=1,ntyp1)
       do i=-ntyp1,-1
@@ -361,11 +365,12 @@ C Control printout of the coefficients of virtual-bond-angle potentials
 C
       if (lprint) then
         write (iout,'(//a)') 'Parameter of virtual-bond-angle potential'
-        do i=1,nthetyp+1
-          do j=1,nthetyp+1
-            do k=1,nthetyp+1
+        do iblock=1,2
+        do i=0,nthetyp
+          do j=-nthetyp,nthetyp
+            do k=-nthetyp,nthetyp
               write (iout,'(//4a)') 
-     &         'Type ',onelett(i),onelett(j),onelett(k) 
+     &         'Type ',toronelet(i),toronelet(j),toronelet(k) 
               write (iout,'(//a,10x,a)') " l","a[l]"
               write (iout,'(i2,1pe15.5)') 0,aa0thet(i,j,k,iblock)
               write (iout,'(i2,1pe15.5)')
@@ -394,6 +399,7 @@ C
             enddo
           enddo
         enddo
+        enddo
       enddo
       call flush(iout)
       endif
@@ -661,8 +667,9 @@ c      &v2(k,-i,-j,iblock),v2(k,i,j,iblock)
       close (itorp)
       if (lprint) then
         write (iout,'(/a/)') 'Torsional constants:'
-        do i=1,ntortyp
-          do j=1,ntortyp
+        do iblock=1,2
+        do i=0,ntortyp-1
+          do j=-ntortyp+1,ntortyp-1
             write (iout,*) 'ityp',i,' jtyp',j
             write (iout,*) 'Fourier constants'
             do k=1,nterm(i,j,iblock)
@@ -676,6 +683,7 @@ c      &v2(k,-i,-j,iblock),v2(k,i,j,iblock)
             enddo
           enddo
         enddo
+        enddo
       endif
 
 C
@@ -776,42 +784,79 @@ C Martix of D parameters for two dimesional fourier series
       endif
 #endif
 C read Czybyshev torsional parameters
-        read (itorkcc,*,end=121,err=121) nkcctyp
-        read (itorkcc,*,end=121,err=121) (itortyp_kcc(i),i=1,ntyp)
-        do i=-ntyp,-1
+      read (itorkcc,*,end=121,err=121) nkcctyp
+      read (itorkcc,*,end=121,err=121) (itortyp_kcc(i),i=1,ntyp)
+      do i=-ntyp,-1
         itortyp_kcc(i)=-itortyp_kcc(-i)
-        enddo
-        do i=1,nkcctyp
-         do j=1,nkcctyp
+      enddo
+      do i=0,nkcctyp
+        do j=0,nkcctyp
 C first we read the cos and sin gamma parameters
           read (itorkcc,*,end=121,err=121) 
      &    nterm_kcc(j,i),nterm_kcc_Tb(j,i)
 C           read (itorkcc,*,end=121,err=121) nterm_kcc_Tb(j,i)
-           do k=1,nterm_kcc(j,i)
-           do l=1,nterm_kcc_Tb(j,i)
-             read (itorkcc,*,end=121,err=121)
-     &        v1_chyb(l,k,j,i)
-           enddo
-           do l=1,nterm_kcc_Tb(j,i)
-             read (itorkcc,*,end=121,err=121)
-     &        v2_chyb(l,k,j,i)
-           enddo
-             read (itorkcc,*,end=121,err=121) 
-     &        v1_kcc(k,j,i)
-             read (itorkcc,*,end=121,err=121)
-     &         v2_kcc(k,j,i)
-           enddo
+          do k=1,nterm_kcc(j,i)
+            do l=1,nterm_kcc_Tb(j,i)
+              read (itorkcc,*,end=121,err=121) v11_chyb(l,k,j,i)
+            enddo
+            do l=1,nterm_kcc_Tb(j,i)
+              read (itorkcc,*,end=121,err=121) v21_chyb(l,k,j,i)
+            enddo
+            do l=1,nterm_kcc_Tb(j,i)
+              read (itorkcc,*,end=121,err=121) v12_chyb(l,k,j,i)
+            enddo
+            do l=1,nterm_kcc_Tb(j,i)
+              read (itorkcc,*,end=121,err=121) v22_chyb(l,k,j,i)
+            enddo
+            read (itorkcc,*,end=121,err=121) v1_kcc(k,j,i)
+            read (itorkcc,*,end=121,err=121) v2_kcc(k,j,i)
+          enddo
+        enddo
+      enddo
+      if (lprint) then
+c Print valence-torsional parameters
+        write (iout,'(a)') 
+     &    "Parameters of the valence-torsional potentials"
+        do i=0,nkcctyp
+        do j=0,nkcctyp
+        write (iout,'(3a)') "Type ",toronelet(i),toronelet(j)
+        write (iout,'(2a20,a15)') "v_kcc","v1_chyb","v2_chyb"
+        do k=1,nterm_kcc(j,i)
+          write (iout,'(i5,f15.10,i5,2f15.10)') 
+     &      k,v1_kcc(k,j,i),1,v11_chyb(1,k,j,i),v21_chyb(1,k,j,i)
+          do l=2,nterm_kcc_Tb(j,i)
+            write (iout,'(20x,i5,2f15.10)') 
+     &        l,v11_chyb(l,k,j,i),v21_chyb(l,k,j,i)
           enddo
-         enddo
+          write (iout,'(i5,f15.10,i5,2f15.10)') 
+     &      k,v2_kcc(k,j,i),1,v12_chyb(1,k,j,i),v22_chyb(1,k,j,i)
+          do l=2,nterm_kcc_Tb(j,i)
+            write (iout,'(20x,i5,2f15.10)') 
+     &        l,v12_chyb(l,k,j,i),v22_chyb(l,k,j,i)
+          enddo
+          write (iout,'(a)')
+        enddo
+        enddo
+        enddo
+      endif
 C here will be the apropriate recalibrating for D-aminoacid
 C        read (ithetkcc,*,end=121,err=121) nkcctyp
-        do i=1,nkcctyp
+      do i=0,nkcctyp
         read (ithetkcc,*,end=121,err=121) nbend_kcc_Tb(i)
-           do j=1,nbend_kcc_Tb(i)
-         read (ithetkcc,*,end=121,err=121)
-     &     v1bend_chyb(j,i)
-           enddo
+        do j=1,nbend_kcc_Tb(i)
+          read (ithetkcc,*,end=121,err=121) v1bend_chyb(j,i)
+        enddo
+      enddo
+      if (lprint) then
+        write (iout,'(a)') 
+     &    "Parameters of the valence-only potentials"
+        do i=0,nkcctyp
+        write (iout,'(2a)') "Type ",toronelet(i)
+        do k=1,nbend_kcc_Tb(i)
+          write(iout,'(i5,f15.10)') k,v1bend_chyb(k,i)
         enddo
+        enddo
+      endif
 C Read of Side-chain backbone correlation parameters
 C Modified 11 May 2012 by Adasko
 CCC
@@ -919,7 +964,7 @@ cc maxinter is maximum interaction sites
             v0ijsccor=v0ijsccor+vlor1sccor(k,i,j)/
      &(1+vlor3sccor(k,i,j)**2)
           enddo
-          v0sccor(i,j,iblock)=v0ijsccor
+          v0sccor(l,i,j)=v0ijsccor
         enddo
       enddo
       enddo
@@ -928,6 +973,7 @@ cc maxinter is maximum interaction sites
 #endif      
       if (lprint) then
         write (iout,'(/a/)') 'Torsional constants:'
+        do l=1,maxinter
         do i=1,nsccortyp
           do j=1,nsccortyp
             write (iout,*) 'ityp',i,' jtyp',j
@@ -942,6 +988,7 @@ cc maxinter is maximum interaction sites
             enddo
           enddo
         enddo
+        enddo
       endif
 
 C
@@ -953,7 +1000,29 @@ C
         write (iout,*) "Coefficients of the cumulants"
       endif
       read (ifourier,*) nloctyp
-
+#ifdef NEWCORR
+      read (ifourier,*,end=115,err=115) (itype2loc(i),i=1,ntyp)
+      read (ifourier,*,end=115,err=115) (iloctyp(i),i=0,nloctyp-1)
+      itype2loc(ntyp1)=nloctyp
+      iloctyp(nloctyp)=ntyp1
+#else
+      do i=1,ntyp1
+        itype2loc(i)=itortyp(i)
+      enddo
+      iloctyp(0)=10
+      iloctyp(1)=9
+      iloctyp(2)=20
+      iloctyp(3)=ntyp1
+#endif
+      do i=1,ntyp1
+        itype2loc(-i)=-itype2loc(i)
+      enddo
+      do i=1,nloctyp
+        iloctyp(-i)=-iloctyp(i)
+      enddo
+      write (iout,*) "itype2loc",(itype2loc(i),i=1,ntyp1)
+      write (iout,*) "nloctyp",nloctyp,
+     &  " iloctyp",(iloctyp(i),i=0,nloctyp)
       do i=0,nloctyp-1
         read (ifourier,*,end=115,err=115)
         read (ifourier,*,end=115,err=115) (b(ii,i),ii=1,13)
@@ -984,14 +1053,14 @@ c        B2(1,i)  = b(2)
 c        B2(2,i)  = b(4)
 c        B2(1,-i)  =b(2)
 c        B2(2,-i)  =-b(4)
-        B1tilde(1,i) = b(3,i)
-        B1tilde(2,i) =-b(5,i)
+cc        B1tilde(1,i) = b(3,i)
+cc        B1tilde(2,i) =-b(5,i)
 C        B1tilde(1,-i) =-b(3,i)
 C        B1tilde(2,-i) =b(5,i)
-        b1tilde(1,i)=0.0d0
-        b1tilde(2,i)=0.0d0
-        B2(1,i)  = b(2,i)
-        B2(2,i)  = b(4,i)
+cc        b1tilde(1,i)=0.0d0
+cc        b1tilde(2,i)=0.0d0
+cc        B2(1,i)  = b(2,i)
+cc        B2(2,i)  = b(4,i)
 C        B2(1,-i)  =b(2,i)
 C        B2(2,-i)  =-b(4,i)