Merge branch 'prerelease-3.2.1' of mmka.chem.univ.gda.pl:unres into prerelease-3.2.1
authorAdam Liwo <adam@piasek4.chem.univ.gda.pl>
Sun, 10 May 2015 02:31:17 +0000 (04:31 +0200)
committerAdam Liwo <adam@piasek4.chem.univ.gda.pl>
Sun, 10 May 2015 02:31:17 +0000 (04:31 +0200)
Conflicts:
source/unres/src_MD/intcartderiv.F

41 files changed:
PARAM/Lip_tran_initial.parm [new file with mode: 0644]
PARAM/Lip_tran_initial_ext.parm [new file with mode: 0644]
bin/unres/MD/unres-mult-symetr_ifort_MPICH_E0LL2Y.exe
bin/unres/MD/unres_ifort_MPICH_E0LL2Y.exe
bin/unres/MINIM/unres_ifort_MIN_single_E0LL2Y.exe
source/unres/src_CSA/CMakeLists.txt
source/unres/src_CSA/geomout_min.F
source/unres/src_MD-M/DIMENSIONS
source/unres/src_MD-M/cinfo.f
source/unres/src_MD-M/geomout.F
source/unres/src_MD-M/intcartderiv.F
source/unres/src_MD-M/lagrangian_lesyng.F
source/unres/src_MD-M/readpdb.F
source/unres/src_MD/CMakeLists.txt
source/unres/src_MD/COMMON.DERIV
source/unres/src_MD/COMMON.SCCOR
source/unres/src_MD/Makefile
source/unres/src_MD/checkder_p.F
source/unres/src_MD/cinfo.f
source/unres/src_MD/energy_p_new_barrier.F
source/unres/src_MD/geomout.F
source/unres/src_MD/initialize_p.F
source/unres/src_MD/intcartderiv.F
source/unres/src_MD/lagrangian_lesyng.F
source/unres/src_MD/unres.F
source/unres/src_MIN/CMakeLists.txt
source/unres/src_MIN/COMMON.CHAIN
source/unres/src_MIN/COMMON.LOCAL
source/unres/src_MIN/COMMON.SCCOR
source/unres/src_MIN/COMMON.VAR
source/unres/src_MIN/DIMENSIONS
source/unres/src_MIN/checkder_p.F
source/unres/src_MIN/energy_p_new_barrier.F
source/unres/src_MIN/geomout_min.F
source/unres/src_MIN/gradient_p.F
source/unres/src_MIN/initialize_p.F
source/unres/src_MIN/int_to_cart.f
source/unres/src_MIN/intcartderiv.F
source/unres/src_MIN/parmread.F
source/unres/src_MIN/readpdb.F
source/unres/src_MIN/unres_min.F

diff --git a/PARAM/Lip_tran_initial.parm b/PARAM/Lip_tran_initial.parm
new file mode 100644 (file)
index 0000000..4caedb9
--- /dev/null
@@ -0,0 +1,21 @@
+0.02
+  -2.09251
+  -1.67129
+  -2.43220
+  -2.44579
+  -2.30991
+  -1.65770
+  -3.05723
+  -1.30442
+  -0.42122
+   0.00000
+  -0.35328
+   0.05435
+   0.29893
+   0.81526
+   0.86961
+   1.04625
+  -0.17664
+   1.37236
+   1.34518
+  -0.97831
diff --git a/PARAM/Lip_tran_initial_ext.parm b/PARAM/Lip_tran_initial_ext.parm
new file mode 100644 (file)
index 0000000..778d7a3
--- /dev/null
@@ -0,0 +1,25 @@
+0.2
+  -2.09251
+  -1.67129
+  -2.43220
+  -2.44579
+  -2.30991
+  -1.65770
+  -3.05723
+  -1.30442
+  -0.42122
+   0.00000
+  -0.35328
+   0.05435
+   0.29893
+   0.81526
+   0.86961
+   1.04625
+  -0.17664
+   1.37236
+   1.34518
+  -0.97831
+  -1.67129
+  -2.43220
+  -0.42122
+  -0.42122
index 3128072..95469a3 100755 (executable)
Binary files a/bin/unres/MD/unres-mult-symetr_ifort_MPICH_E0LL2Y.exe and b/bin/unres/MD/unres-mult-symetr_ifort_MPICH_E0LL2Y.exe differ
index 0aff9aa..8442e63 100755 (executable)
Binary files a/bin/unres/MD/unres_ifort_MPICH_E0LL2Y.exe and b/bin/unres/MD/unres_ifort_MPICH_E0LL2Y.exe differ
index 23372d3..0c0f61c 100755 (executable)
Binary files a/bin/unres/MINIM/unres_ifort_MIN_single_E0LL2Y.exe and b/bin/unres/MINIM/unres_ifort_MIN_single_E0LL2Y.exe differ
index fdea19f..b297d98 100644 (file)
@@ -146,7 +146,7 @@ elseif(UNRES_CSA_FF STREQUAL "ALPHABETA")
 elseif(UNRES_CSA_FF STREQUAL "CASP5")
   set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
 elseif(UNRES_CSA_FF STREQUAL "3P")
-  set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
+  set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
 elseif(UNRES_CSA_FF STREQUAL "4P")
   set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
 endif(UNRES_CSA_FF STREQUAL "CASP3")
index 5dab339..5385714 100644 (file)
@@ -23,7 +23,7 @@ cmodel      write (iunit,'(a5,i6)') 'MODEL',1
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
         else
-             write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)') 
+           write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3,t76,i5)') 
      &           'HELIX',j,'H',j,
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
index 5131f4e..2b93b81 100644 (file)
@@ -28,7 +28,7 @@ C Max number of symetric chains
       parameter (maxperm=120) 
 C Max. number of variables
       integer maxvar
-      parameter (maxvar=4*maxres)
+      parameter (maxvar=6*maxres)
 C Max. number of groups of interactions that a given SC is involved in
       integer maxint_gr
       parameter (maxint_gr=2)
index db23899..b3595dd 100644 (file)
@@ -1,31 +1,17 @@
 C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C
-<<<<<<< HEAD
-C 0 40360 9
+C 0 40376 2
       subroutine cinfo
       include 'COMMON.IOUNITS'
       write(iout,*)'++++ Compile info ++++'
-      write(iout,*)'Version 0.40360 build 9'
-      write(iout,*)'compiled Fri Jan 23 21:00:08 2015'
-      write(iout,*)'compiled by adam@mmka'
-=======
-C 0 40360 1
-      subroutine cinfo
-      include 'COMMON.IOUNITS'
-      write(iout,*)'++++ Compile info ++++'
-      write(iout,*)'Version 0.40360 build 1'
-      write(iout,*)'compiled Wed Jan  7 10:41:15 2015'
-      write(iout,*)'compiled by czarek@piasek4'
->>>>>>> 9a082c1ab203120d8e865971546d473fb146fcdc
+      write(iout,*)'Version 0.40376 build 2'
+      write(iout,*)'compiled Sun May 10 03:42:01 2015'
+      write(iout,*)'compiled by adam@piasek4'
       write(iout,*)'OS name:    Linux '
-      write(iout,*)'OS release: 3.2.0-72-generic '
+      write(iout,*)'OS release: 3.2.0-70-generic '
       write(iout,*)'OS version:',
-     & ' #107-Ubuntu SMP Thu Nov 6 14:24:01 UTC 2014 '
+     & ' #105-Ubuntu SMP Wed Sep 24 19:49:16 UTC 2014 '
       write(iout,*)'flags:'
-<<<<<<< HEAD
-      write(iout,*)'INSTALL_DIR = /users/software/mpich-1.2.7p1_int...'
-=======
       write(iout,*)'INSTALL_DIR = /users/software/mpich2-1.4.1p1_in...'
->>>>>>> 9a082c1ab203120d8e865971546d473fb146fcdc
       write(iout,*)'FC= ifort'
       write(iout,*)'OPT =  -O3 -ip '
       write(iout,*)'FFLAGS = -c ${OPT} -I$(INSTALL_DIR)/include '
index 51fe4ad..d21b400 100644 (file)
@@ -24,7 +24,7 @@ cmodel      write (iunit,'(a5,i6)') 'MODEL',1
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
         else
-             write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)') 
+           write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3,t76,i5)') 
      &           'HELIX',j,'H',j,
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
index 94b3989..c80ee01 100644 (file)
@@ -161,6 +161,11 @@ c   Obtaining the gamma derivatives from cosine derivative
          enddo
         endif                                                                                           
       enddo
+      do i=1,nres-1
+       do j=1,3
+        dc_norm2(j,i+nres)=-dc_norm(j,i+nres)
+       enddo
+      enddo
 Calculate derivative of Tauangle
 #ifdef PARINTDER
       do i=itau_start,itau_end
@@ -179,10 +184,10 @@ c the conventional case
         cost=dcos(theta(i))
         cost1=dcos(omicron(2,i-1))
         cosg=dcos(tauangle(1,i))
-        do j=1,3
-        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
+C        do j=1,3
+C        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
 cc       write(iout,*) dc_norm2(j,i-2+nres),"dcnorm"
-        enddo
+C        enddo
         scalp=scalar(dc_norm2(1,i-2+nres),dc_norm(1,i-1))
         fac0=1.0d0/(sint1*sint)
         fac1=cost*fac0
@@ -253,9 +258,9 @@ c the conventional case
         cost=dcos(omicron(1,i))
         cost1=dcos(theta(i-1))
         cosg=dcos(tauangle(2,i))
-c        do j=1,3
-c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
-c        enddo
+C        do j=1,3
+C        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
+C        enddo
         scalp=scalar(dc_norm(1,i-3),dc_norm(1,i-1+nres))
         fac0=1.0d0/(sint1*sint)
         fac1=cost*fac0
@@ -269,27 +274,32 @@ c    Obtaining the gamma derivatives from sine derivative
          call vecpr(dc_norm2(1,i-1+nres),dc_norm(1,i-2),vp1)
          call vecpr(dc_norm(1,i-3),dc_norm(1,i-1+nres),vp2)
          call vecpr(dc_norm(1,i-3),dc_norm(1,i-2),vp3)
+C        print *,"chuj"
         do j=1,3
             ctgt=cost/sint
             ctgt1=cost1/sint1
             cosg_inv=1.0d0/cosg
             dsintau(j,2,1,i)=-sing*ctgt1*dtheta(j,1,i-1)
      &        +(fac0*vp1(j)-sing*dc_norm(j,i-3))*vbld_inv(i-2)
-c       write(iout,*) i,j,dsintau(j,2,1,i),sing*ctgt1*dtheta(j,1,i-1),
-c     &fac0*vp1(j),sing*dc_norm(j,i-3),vbld_inv(i-2),"dsintau(2,1)"
+
+C            write(12,*) i,j,dc_norm2(1,i-1+nres),dc_norm(1,i-2)
+
             dtauangle(j,2,1,i)=cosg_inv*dsintau(j,2,1,i)
+
             dsintau(j,2,2,i)=
      &        -sing*(ctgt1*dtheta(j,2,i-1)+ctgt*domicron(j,1,1,i))
      &        -(fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
-c            write(iout,*) "sprawdzenie",i,j,sing*ctgt1*dtheta(j,2,i-1),
-c     & sing*ctgt*domicron(j,1,2,i),
-c     & (fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
+
             dtauangle(j,2,2,i)=cosg_inv*dsintau(j,2,2,i)
-c Bug fixed 3/24/05 (AL)
+
             dsintau(j,2,3,i)=-sing*ctgt*domicron(j,1,2,i)
      &       +(fac0*vp3(j)-sing*dc_norm(j,i-1+nres))*vbld_inv(i-1+nres)
+
 c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
             dtauangle(j,2,3,i)=cosg_inv*dsintau(j,2,3,i)
+
+
+
          enddo
 c   Obtaining the gamma derivatives from cosine derivative
         else
@@ -327,10 +337,10 @@ c the conventional case
         cost=dcos(omicron(1,i))
         cost1=dcos(omicron(2,i-1))
         cosg=dcos(tauangle(3,i))
-        do j=1,3
-        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
-c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
-        enddo
+C        do j=1,3
+C        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
+C        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
+C        enddo
         scalp=scalar(dc_norm2(1,i-2+nres),dc_norm(1,i-1+nres))
         fac0=1.0d0/(sint1*sint)
         fac1=cost*fac0
@@ -362,6 +372,8 @@ c Bug fixed 3/24/05 (AL)
      &        *vbld_inv(i-1+nres)
 c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
             dtauangle(j,3,3,i)=cosg_inv*dsintau(j,3,3,i)
+
+
          enddo
 c   Obtaining the gamma derivatives from cosine derivative
         else
index 89fde29..3398091 100644 (file)
@@ -476,7 +476,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.TIME1'
       include 'COMMON.MD'
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -497,7 +497,10 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+         do i=1,3*my_ng_count
+           z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)
@@ -628,7 +631,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.LANGEVIN.lang0'
 #endif
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -642,7 +645,11 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+
+         do i=1,3*my_ng_count
+          z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)
index c7f0ddd..da934d5 100644 (file)
@@ -74,7 +74,7 @@ C Calculate the CM of the preceding residue.
             endif
 C Start new residue.
 c            write (iout,'(a80)') card
-            read (card(24:26),*) ires
+            read (card(23:26),*) ires
             read (card(18:20),'(a3)') res
             if (ibeg.eq.1) then
               ishift=ires-1
index ea7776c..c210fdc 100644 (file)
@@ -166,7 +166,7 @@ set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
 #=========================================
 if(UNRES_MD_FF STREQUAL "GAB" )
   # set preprocesor flags   
-  set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
+  set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC")
 
 #=========================================
 #  Settings for E0LL2Y force field
index 6fdb1aa..e4c39c5 100644 (file)
@@ -2,7 +2,9 @@
      & gvdwpp,gel_loc,gel_loc_long,gvdwc_scpp,
      & gradx_scp,gvdwc_scp,ghpbx,ghpbc,gloc,gloc_x,dtheta,dphi,dalpha,
      & domega,gscloc,gsclocx,gradcorr,gradcorr_long,gradcorr5_long,
-     & gradcorr6_long,gcorr6_turn_long,gvdwcT,gvdwxT,gvdwx
+     & gradcorr6_long,gcorr6_turn_long,gvdwcT,gvdwxT,gvdwx,gloc_sc,
+     &                 dcostau,dsintau,dtauangle,dcosomicron,
+     &                 domicron
       integer nfl,icg
       common /derivatT/ gvdwcT(3,maxres),gvdwxT(3,maxres)
       common /derivat/ dcdv(6,maxdim),dxdv(6,maxdim),dxds(6,maxres),
      & gel_loc_turn4(maxvar),gel_loc_turn6(maxvar),gcorr_loc(maxvar),
      & g_corr5_loc(maxvar),g_corr6_loc(maxvar),gsccorc(3,maxres),
      & gsccorx(3,maxres),gsccor_loc(maxres),dtheta(3,2,maxres),
-     & gscloc(3,maxres),gsclocx(3,maxres),
+     & gscloc(3,maxres),gsclocx(3,maxres),gloc_sc(3,0:maxres2,10),
+     &    dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
+     &    dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
+     &    domicron(3,3,3,maxres2),
      & dphi(3,3,maxres),dalpha(3,3,maxres),domega(3,3,maxres),nfl,icg
       double precision derx,derx_turn
       common /deriv_loc/ derx(3,5,2),derx_turn(3,5,2)
index c7f1e3c..623bbad 100644 (file)
@@ -1,8 +1,9 @@
 cc Parameters of the SCCOR term
       double precision v1sccor,v2sccor,vlor1sccor,
-     &                 vlor2sccor,vlor3sccor,gloc_sc,
-     &                 dcostau,dsintau,dtauangle,dcosomicron,
-     &                 domicron,v0sccor
+     &                 vlor2sccor,vlor3sccor,v0sccor
+C,gloc_sc,
+C     &                 dcostau,dsintau,dtauangle,dcosomicron,
+C     &                 domicron,v0sccor
       integer nterm_sccor,isccortyp,nsccortyp,nlor_sccor
       common/sccor/v1sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
      &    v2sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
@@ -12,7 +13,8 @@ cc Parameters of the SCCOR term
      &    nlor_sccor(-ntyp:ntyp,-ntyp:ntyp),
      &    vlor1sccor(maxterm_sccor,20,20),
      &    vlor2sccor(maxterm_sccor,20,20),
-     &    vlor3sccor(maxterm_sccor,20,20),gloc_sc(3,0:maxres2,10),
-     &    dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
-     &    dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
-     &    domicron(3,3,3,maxres2)
+     &    vlor3sccor(maxterm_sccor,20,20)
+C,gloc_sc(3,0:maxres2,10),
+C     &    dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
+C     &    dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
+C     &    domicron(3,3,3,maxres2)
index 6584c5e..8453cdd 120000 (symlink)
@@ -1 +1 @@
-Makefile_single_ifort
\ No newline at end of file
+Makefile_MPICH_ifort
\ No newline at end of file
index 6f9ca70..08b7a32 100644 (file)
@@ -284,7 +284,7 @@ C Check the gradient of the energy in Cartesian coordinates.
 c      call intcartderiv
 c      call checkintcartgrad
       call zerograd
-      aincr=1.0D-5
+      aincr=1.0D-6
       write(iout,*) 'Calling CHECK_ECARTINT.'
       nf=0
       icall=0
@@ -534,6 +534,7 @@ c-------------------------------------------------------------------------
          tauangle(1,i+1)=beta(i-1+nres,i-1,i,i+1)
          omicron(1,i)=alpha(i-2,i-1,i-1+nres)
          omicron(2,i)=alpha(i-1+nres,i-1,i)
+C        print *,i,omicron(1,i),omicron(2,i)
         endif
         if (itype(i).ne.10) then
          tauangle(2,i+1)=beta(i-2,i-1,i,i+nres)
index 788bb9d..293f867 100644 (file)
@@ -1,35 +1,31 @@
 C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C
-C 3 2 161
+C 3 2 162
       subroutine cinfo
       include 'COMMON.IOUNITS'
       write(iout,*)'++++ Compile info ++++'
-      write(iout,*)'Version 3.2 build 161'
-      write(iout,*)'compiled Thu Mar 26 15:08:13 2015'
-      write(iout,*)'compiled by adam@mmka'
+      write(iout,*)'Version 3.2 build 162'
+      write(iout,*)'compiled Sun May 10 03:06:38 2015'
+      write(iout,*)'compiled by adam@piasek4'
       write(iout,*)'OS name:    Linux '
-      write(iout,*)'OS release: 3.2.0-77-generic '
+      write(iout,*)'OS release: 3.2.0-70-generic '
       write(iout,*)'OS version:',
-     & ' #112-Ubuntu SMP Tue Feb 10 15:22:22 UTC 2015 '
+     & ' #105-Ubuntu SMP Wed Sep 24 19:49:16 UTC 2014 '
       write(iout,*)'flags:'
-      write(iout,*)'FC = ifort'
-      write(iout,*)'FFLAGS = -c ${OPT} -I$(INSTALL_DIR)/include'
-      write(iout,*)'FFLAGS1 = -c -w -g -d2 -CA -CB -I$(INSTALL_DIR)...'
-      write(iout,*)'FFLAGS2 = -c -w -g -O0 -I$(INSTALL_DIR)/include'
-      write(iout,*)'FFLAGSE = -c -w -O3 -ipo -ipo_obj  -opt_report ...'
-      write(iout,*)'FFLAGS = ${FFLAGS1}'
-      write(iout,*)'FFLAGS2 = ${FFLAGS1}'
-      write(iout,*)'FFLAGSE = ${FFLAGS1}'
-      write(iout,*)'CC = cc'
-      write(iout,*)'CFLAGS = -DLINUX -DPGI -c'
-      write(iout,*)'OPT =  -O3 -ip -w'
-      write(iout,*)'LIBS = -Lxdrf -lxdrf'
+      write(iout,*)'INSTALL_DIR = /users/software/mpich-1.2.7p1_int...'
+      write(iout,*)'FC= ifort'
+      write(iout,*)'OPT =  -O3 -ip '
+      write(iout,*)'FFLAGS = -c ${OPT} -I$(INSTALL_DIR)/include '
+      write(iout,*)'FFLAGS1 = -c  -g -CA -CB -I$(INSTALL_DIR)/inclu...'
+      write(iout,*)'FFLAGS2 = -c  -g -O0 -I$(INSTALL_DIR)/include  '
+      write(iout,*)'FFLAGSE = -c  -O3 -ipo  -opt_report -I$(INSTALL...'
+      write(iout,*)'LIBS = -L$(INSTALL_DIR)/lib -lmpich xdrf/libxdr...'
       write(iout,*)'ARCH = LINUX'
       write(iout,*)'PP = /lib/cpp -P'
       write(iout,*)'object = unres.o arcos.o cartprint.o chainbuild...'
       write(iout,*)'GAB: CPPFLAGS = -DPROCOR -DLINUX -DPGI -DAMD64 ...'
-      write(iout,*)'GAB: BIN = ../../../bin/unres/MD/unres_ifort_si...'
+      write(iout,*)'GAB: BIN = ../../../bin/unres/MD/unres_ifort_MP...'
       write(iout,*)'4P: CPPFLAGS = -DLINUX -DPGI -DAMD64 -DUNRES -D...'
-      write(iout,*)'4P: BIN = ../../../bin/unres/MD/unres_ifort_sin...'
+      write(iout,*)'4P: BIN = ../../../bin/unres/MD/unres_ifort_MPI...'
       write(iout,*)'E0LL2Y: CPPFLAGS = -DPROCOR -DLINUX -DPGI -DAMD...'
       write(iout,*)'E0LL2Y: BIN = ../../../bin/unres/MD/unres_ifort...'
       write(iout,*)'++++ End of compile info ++++'
index 5ae5a43..47583a4 100644 (file)
@@ -3023,6 +3023,9 @@ C
 C Loop over i,i+2 and i,i+3 pairs of the peptide groups
 C
       do i=iturn3_start,iturn3_end
+C        if (itype(i).eq.21 .or. itype(i+1).eq.21
+C     &  .or. itype(i+2).eq.21 .or. itype(i+3).eq.21.or.itype(i+4).eq.21)
+C     &  cycle
         dxi=dc(1,i)
         dyi=dc(2,i)
         dzi=dc(3,i)
@@ -3038,6 +3041,10 @@ C
         num_cont_hb(i)=num_conti
       enddo
       do i=iturn4_start,iturn4_end
+C        if (itype(i).eq.21 .or. itype(i+1).eq.21
+C     &  .or. itype(i+2).eq.21 .or. itype(i+3).eq.21.or.itype(i+4).eq.21
+C     &  .or. itype(i+5).eq.21)
+C     & cycle
         dxi=dc(1,i)
         dyi=dc(2,i)
         dzi=dc(3,i)
@@ -3056,6 +3063,8 @@ c
 c Loop over all pairs of interacting peptide groups except i,i+2 and i,i+3
 c
       do i=iatel_s,iatel_e
+C          if (itype(i).eq.21 .or. itype(i+1).eq.21
+C     &.or.itype(i+2)) cycle
         dxi=dc(1,i)
         dyi=dc(2,i)
         dzi=dc(3,i)
@@ -3068,6 +3077,8 @@ c
 c        write (iout,*) 'i',i,' ielstart',ielstart(i),' ielend',ielend(i)
         num_conti=num_cont_hb(i)
         do j=ielstart(i),ielend(i)
+C          if (itype(j).eq.21 .or. itype(j+1).eq.21
+C     &.or.itype(j+2)) cycle
           call eelecij(i,j,ees,evdw1,eel_loc)
         enddo ! j
         num_cont_hb(i)=num_conti
@@ -4775,7 +4786,7 @@ C
      & cosph1(maxsingle),sinph1(maxsingle),cosph2(maxsingle),
      & sinph2(maxsingle),cosph1ph2(maxdouble,maxdouble),
      & sinph1ph2(maxdouble,maxdouble)
-      logical lprn /.false./, lprn1 /.true./
+      logical lprn /.false./, lprn1 /.false./
       etheta=0.0D0
       do i=ithet_start,ithet_end
         if ((itype(i-1).eq.ntyp1).or.(itype(i-2).eq.ntyp1).or.
@@ -4789,7 +4800,8 @@ C
           coskt(k)=dcos(k*theti2)
           sinkt(k)=dsin(k*theti2)
         enddo
-        if (i.gt.3) then
+C        if (i.gt.3) then
+         if (i.gt.3 .and. itype(i-3).ne.ntyp1) then
 #ifdef OSF
           phii=phi(i)
           if (phii.ne.phii) phii=150.0
           enddo
         else
           phii=0.0d0
-          ityp1=nthetyp+1
+          ityp1=ithetyp(itype(i-2))
           do k=1,nsingle
             cosph1(k)=0.0d0
             sinph1(k)=0.0d0
           enddo 
         endif
-        if (i.lt.nres) then
+        if ((i.lt.nres).and. itype(i+1).ne.ntyp1) then
 #ifdef OSF
           phii1=phi(i+1)
           if (phii1.ne.phii1) phii1=150.0
@@ -4824,7 +4836,7 @@ C
           enddo
         else
           phii1=0.0d0
-          ityp3=nthetyp+1
+          ityp3=ithetyp(itype(i))
           do k=1,nsingle
             cosph2(k)=0.0d0
             sinph2(k)=0.0d0
@@ -4930,11 +4942,9 @@ C
           enddo
         enddo
 10      continue
-c        lprn1=.true.
         if (lprn1) write (iout,'(a4,i2,3f8.1,9h ethetai ,f10.5)') 
      &  'ebe', i,theta(i)*rad2deg,phii*rad2deg,
      &   phii1*rad2deg,ethetai
-c        lprn1=.false.
         etheta=etheta+ethetai
         if (i.gt.3) gloc(i-3,icg)=gloc(i-3,icg)+wang*dephii
         if (i.lt.nres) gloc(i-2,icg)=gloc(i-2,icg)+wang*dephii1
@@ -5958,17 +5968,19 @@ c      lprn=.true.
 c      write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
       esccor=0.0D0
       do i=itau_start,itau_end
+C        do i=42,42
         esccor_ii=0.0D0
         if ((itype(i-2).eq.ntyp1).or.(itype(i-1).eq.ntyp1)) cycle
         isccori=isccortyp(itype(i-2))
         isccori1=isccortyp(itype(i-1))
         phii=phi(i)
+
 cccc  Added 9 May 2012
 cc Tauangle is torsional engle depending on the value of first digit 
 c(see comment below)
 cc Omicron is flat angle depending on the value of first digit 
 c(see comment below)
-
+C        print *,i,tauangle(1,i)
         
 c        do intertyp=1,3 !intertyp
         do intertyp=2,2 !intertyp
@@ -5996,6 +6008,7 @@ c   3 = SC...Ca...Ca...SCi
           esccor=esccor+v1ij*cosphi+v2ij*sinphi
           gloci=gloci+j*(v2ij*cosphi-v1ij*sinphi)
         enddo
+C        print *,i,tauangle(1,i),gloci
         gloc_sc(intertyp,i-3,icg)=gloc_sc(intertyp,i-3,icg)+wsccor*gloci
 c        write (iout,*) "WTF",intertyp,i,itype(i),v1ij*cosphi+v2ij*sinphi
 c     &gloc_sc(intertyp,i-3,icg)
index df698f5..81f8db4 100644 (file)
@@ -23,7 +23,7 @@ cmodel      write (iunit,'(a5,i6)') 'MODEL',1
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
         else
-             write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)') 
+           write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3,t76,i5)')
      &           'HELIX',j,'H',j,
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
index 565ccaf..a7ee3b7 100644 (file)
@@ -565,9 +565,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-2,itau_start,itau_end) 
+      itau_start=itau_start+2
+      itau_end=itau_end+2
       call int_bounds(nres-3,iphi1_start,iphi1_end)
       iphi1_start=iphi1_start+3
       iphi1_end=iphi1_end+3
@@ -1094,7 +1094,7 @@ c        write (iout,*) "MPI_ROTAT2",MPI_ROTAT2
       idihconstr_end=ndih_constr
       iphid_start=iphi_start
       iphid_end=iphi_end-1
-      itau_start=4
+      itau_start=3
       itau_end=nres
       ibond_start=2
       ibond_end=nres-1
index 889bedd..fcc2e86 100644 (file)
@@ -35,7 +35,7 @@ c We need dtheta(:,:,i-1) to compute dphi(:,:,i)
       do i=3,nres
 #endif
         cost=dcos(theta(i))
-       sint=sqrt(1-cost*cost)
+       sint=dsqrt(1-cost*cost)
         do j=1,3
           dcostheta(j,1,i)=-(dc_norm(j,i-1)+cost*dc_norm(j,i-2))/
      &   vbld(i-1)
@@ -54,9 +54,9 @@ c We need dtheta(:,:,i-1) to compute dphi(:,:,i)
 #endif
       if ((itype(i-1).ne.10).and.(itype(i-1).ne.21)) then
         cost1=dcos(omicron(1,i))
-       sint1=sqrt(1-cost1*cost1)
+       sint1=dsqrt(1-cost1*cost1)
         cost2=dcos(omicron(2,i))
-        sint2=sqrt(1-cost2*cost2)
+        sint2=dsqrt(1-cost2*cost2)
         do j=1,3
 CC Calculate derivative over first omicron (Cai-2,Cai-1,SCi-1) 
           dcosomicron(j,1,1,i)=-(dc_norm(j,i-1+nres)+
@@ -149,7 +149,7 @@ c   Obtaining the gamma derivatives from cosine derivative
         endif                                                                                           
       enddo
 
-      do i=1,nres-1
+      do i=1,nres
        do j=1,3
         dc_norm2(j,i+nres)=-dc_norm(j,i+nres)
        enddo
@@ -213,15 +213,15 @@ c   Obtaining the gamma derivatives from cosine derivative
            dcostau(j,1,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
      &     dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1)-scalp*
      &     (dc_norm2(j,i-2+nres)))/vbld(i-2+nres)
-           dtauangle(j,1,1,i)=-1/sing*dcostau(j,1,1,i)
+           dtauangle(j,1,1,i)=-1.0d0/sing*dcostau(j,1,1,i)
            dcostau(j,1,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
      &     dcostheta(j,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
      &     dcostheta(j,1,i)
-           dtauangle(j,1,2,i)=-1/sing*dcostau(j,1,2,i)
+           dtauangle(j,1,2,i)=-1.0d0/sing*dcostau(j,1,2,i)
            dcostau(j,1,3,i)=fac2*dcostheta(j,2,i)+fac4*
      &     dcostheta(j,2,i)-fac0*(-dc_norm(j,i-2+nres)-scalp*
      &     dc_norm(j,i-1))/vbld(i)
-           dtauangle(j,1,3,i)=-1/sing*dcostau(j,1,3,i)
+           dtauangle(j,1,3,i)=-1.0d0/sing*dcostau(j,1,3,i)
 c         write (iout,*) "else",i
          enddo
         endif
@@ -287,15 +287,15 @@ c   Obtaining the gamma derivatives from cosine derivative
            dcostau(j,2,1,i)=fac1*dcostheta(j,1,i-1)+fac3*
      &     dcostheta(j,1,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
      &     dc_norm(j,i-3))/vbld(i-2)
-           dtauangle(j,2,1,i)=-1/sing*dcostau(j,2,1,i)
+           dtauangle(j,2,1,i)=-1.0d0/sing*dcostau(j,2,1,i)
            dcostau(j,2,2,i)=fac1*dcostheta(j,2,i-1)+fac2*
      &     dcosomicron(j,1,1,i)+fac3*dcostheta(j,2,i-1)+fac4*
      &     dcosomicron(j,1,1,i)
-           dtauangle(j,2,2,i)=-1/sing*dcostau(j,2,2,i)
+           dtauangle(j,2,2,i)=-1.0d0/sing*dcostau(j,2,2,i)
            dcostau(j,2,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
      &     dcosomicron(j,1,2,i)-fac0*(dc_norm(j,i-3)-scalp*
      &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
-           dtauangle(j,2,3,i)=-1/sing*dcostau(j,2,3,i)
+           dtauangle(j,2,3,i)=-1.0d0/sing*dcostau(j,2,3,i)
 c        write(iout,*) i,j,"else", dtauangle(j,2,3,i) 
          enddo
         endif                                                                                            
@@ -360,15 +360,15 @@ c   Obtaining the gamma derivatives from cosine derivative
            dcostau(j,3,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
      &     dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
      &     dc_norm2(j,i-2+nres))/vbld(i-2+nres)
-           dtauangle(j,3,1,i)=-1/sing*dcostau(j,3,1,i)
+           dtauangle(j,3,1,i)=-1.0d0/sing*dcostau(j,3,1,i)
            dcostau(j,3,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
      &     dcosomicron(j,1,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
      &     dcosomicron(j,1,1,i)
-           dtauangle(j,3,2,i)=-1/sing*dcostau(j,3,2,i)
+           dtauangle(j,3,2,i)=-1.0d0/sing*dcostau(j,3,2,i)
            dcostau(j,3,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
      &     dcosomicron(j,1,2,i)-fac0*(dc_norm2(j,i-2+nres)-scalp*
      &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
-           dtauangle(j,3,3,i)=-1/sing*dcostau(j,3,3,i)
+           dtauangle(j,3,3,i)=-1.0d0/sing*dcostau(j,3,3,i)
 c          write(iout,*) "else",i 
          enddo
         endif                                                                                            
index 8a9163a..775142b 100644 (file)
@@ -499,7 +499,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.TIME1'
       include 'COMMON.MD'
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -520,7 +520,10 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+         do i=1,3*my_ng_count
+           z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)
@@ -651,7 +654,7 @@ c---------------------------------------------------------------------------
       include 'COMMON.LANGEVIN.lang0'
 #endif
       double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
-     &time01
+     &,time01,zcopy(dimen3)
 #ifdef MPI
       if (nfgtasks.gt.1) then
         if (fg_rank.eq.0) then
@@ -665,7 +668,11 @@ c        call MPI_Barrier(FG_COMM,IERROR)
         time00=MPI_Wtime()
         call MPI_Scatterv(z,ng_counts(0),ng_start(0),
      &    MPI_DOUBLE_PRECISION,
-     &    z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+     &    zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+
+         do i=1,3*my_ng_count
+          z(i)=zcopy(i)
+         enddo
 c        write (2,*) "My chunk of z"
 c        do i=1,3*my_ng_count
 c          write (2,*) i,z(i)
index b14c040..a63047f 100644 (file)
@@ -736,6 +736,7 @@ c      enddo
       print *,'icheckgrad=',icheckgrad
       goto (10,20,30) icheckgrad
   10  call check_ecartint
+      call check_ecartint
       return
   20  call check_cartgrad
       return
index ed0bb6e..d8eb8de 100644 (file)
@@ -139,7 +139,7 @@ set_property(SOURCE ${UNRES_MIN_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
 set_property(SOURCE ${UNRES_MIM_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
 
 # set preprocesor flags   
-set(CPPFLAGS "PROCOR -DLINUX -DISNAN -DSPLITELE -DLANG0" )
+set(CPPFLAGS "PROCOR -DLINUX -DISNAN -DSPLITELE -DLANG0 -DSCCORPDB" )
 
 if (Fortran_COMPILER_NAME STREQUAL "ifort")
   # Add ifort preprocessor flags
index f7a8a1d..6e19f8d 100644 (file)
@@ -1,9 +1,10 @@
       integer nres,nsup,nstart_sup,nz_start,nz_end,iz_sc,
      &  nres0,nstart_seq
       double precision c,dc,dc_old,d_c_work,xloc,xrot,dc_norm,t,r,
-     & prod,rt,dc_work,cref,crefjlee
+     & prod,rt,dc_work,cref,crefjlee,dc_norm2
       common /chain/ c(3,maxres2+2),dc(3,0:maxres2),dc_old(3,0:maxres2),
      & xloc(3,maxres),xrot(3,maxres),dc_norm(3,0:maxres2),
+     & dc_norm2(3,0:maxres2),
      & dc_work(MAXRES6),nres,nres0
       common /rotmat/ t(3,3,maxres),r(3,3,maxres),prod(3,3,maxres),
      &                rt(3,3,maxres) 
index 837a7a3..2c9ea5f 100644 (file)
@@ -32,7 +32,7 @@ C Virtual-bond lenghts
      & iphi_end,iphid_start,iphid_end,ibond_start,ibond_end,
      & ibondp_start,ibondp_end,ivec_start,ivec_end,iset_start,iset_end,
      & iturn3_start,iturn3_end,iturn4_start,iturn4_end,iint_start,
-     & iint_end,iphi1_start,iphi1_end,
+     & iint_end,iphi1_start,iphi1_end,itau_start,itau_end,
      & ibond_displ(0:max_fg_procs-1),ibond_count(0:max_fg_procs-1),
      & ithet_displ(0:max_fg_procs-1),ithet_count(0:max_fg_procs-1),
      & iphi_displ(0:max_fg_procs-1),iphi_count(0:max_fg_procs-1),
@@ -46,7 +46,7 @@ C Virtual-bond lenghts
      & ibondp_start,ibondp_end,ivec_start,ivec_end,iset_start,iset_end,
      & iturn3_start,iturn3_end,iturn4_start,iturn4_end,iint_start,
      & iint_end,iphi1_start,iphi1_end,iint_count,iint_displ,ivec_displ,
-     & ivec_count,iset_displ,
+     & ivec_count,iset_displ,itau_start,itau_end,
      & iset_count,ibond_displ,ibond_count,ithet_displ,ithet_count,
      & iphi_displ,iphi_count,iphi1_displ,iphi1_count
 C Inverses of the actual virtual bond lengths
index a28f621..19a46d2 100644 (file)
@@ -1,6 +1,18 @@
-C Parameters of the SCCOR term
-      double precision v1sccor,v2sccor
-      integer nterm_sccor
-      common/sccor/v1sccor(maxterm_sccor,20,20),
-     &    v2sccor(maxterm_sccor,20,20),
-     &    nterm_sccor
+cc Parameters of the SCCOR term
+      double precision v1sccor,v2sccor,vlor1sccor,
+     &                 vlor2sccor,vlor3sccor,gloc_sc,
+     &                 dcostau,dsintau,dtauangle,dcosomicron,
+     &                 domicron
+      integer nterm_sccor,isccortyp,nsccortyp,nlor_sccor
+      common/sccor/v1sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
+     &    v2sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
+     &    v0sccor(-ntyp:ntyp,-ntyp:ntyp),
+     &    nterm_sccor(-ntyp:ntyp,-ntyp:ntyp),isccortyp(-ntyp:ntyp),
+     &    nsccortyp,
+     &    nlor_sccor(-ntyp:ntyp,-ntyp:ntyp),
+     &    vlor1sccor(maxterm_sccor,20,20),
+     &    vlor2sccor(maxterm_sccor,20,20),
+     &    vlor3sccor(maxterm_sccor,20,20),gloc_sc(3,0:maxres2,10),
+     &    dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
+     &    dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
+     &    domicron(3,3,3,maxres2)
index 71158b8..fd0626a 100644 (file)
@@ -3,11 +3,13 @@ C Store the geometric variables in the following COMMON block.
      &        mask_theta,mask_phi,mask_side
       double precision theta,phi,alph,omeg,varsave,esave,varall,vbld,
      &          thetaref,phiref,costtab,sinttab,cost2tab,sint2tab,
+     &          tauangle,omicron,
      &          xxtab,yytab,zztab,xxref,yyref,zzref
       common /var/ theta(maxres),phi(maxres),alph(maxres),omeg(maxres),
      &          vbld(2*maxres),thetaref(maxres),phiref(maxres),
      &          costtab(maxres), sinttab(maxres), cost2tab(maxres),
      &          sint2tab(maxres),xxtab(maxres),yytab(maxres),
+     &          omicron(2,maxres),tauangle(3,maxres),
      &          zztab(maxres),xxref(maxres),yyref(maxres),zzref(maxres),
      &          ialph(maxres,2),ivar(4*maxres2),ntheta,nphi,nside,nvar
 C Store the angles and variables corresponding to old conformations (for use
index 8f3f01c..893b9b5 100644 (file)
@@ -16,7 +16,7 @@ C Max. number of coarse-grain processors
       parameter (max_cg_procs=maxprocs)
 C Max. number of AA residues
       integer maxres
-      parameter (maxres=100)
+      parameter (maxres=800)
 C Appr. max. number of interaction sites
       integer maxres2,maxres6,mmaxres2
       parameter (maxres2=2*maxres,maxres6=6*maxres)
@@ -54,7 +54,7 @@ C virtual-bond angle bending potentials
      & mmaxtheterm=maxtheterm)
 c Max number of torsional terms in SCCOR
       integer maxterm_sccor
-      parameter (maxterm_sccor=3)
+      parameter (maxterm_sccor=6)
 C Max. number of lobes in SC distribution
       integer maxlob
       parameter (maxlob=4)
index 67465bb..a50bc2a 100644 (file)
@@ -514,7 +514,20 @@ c-------------------------------------------------------------------------
      &     +(c(j,i+1)-c(j,i))/dnorm2)
         enddo
         be=0.0D0
-        if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
+        if (i.gt.2) then
+        if (i.le.nres) phi(i+1)=beta(i-2,i-1,i,i+1)
+        if ((itype(i).ne.10).and.(itype(i-1).ne.10)) then
+         tauangle(3,i+1)=beta(i+nres-1,i-1,i,i+nres)
+        endif
+        if (itype(i-1).ne.10) then
+         tauangle(1,i+1)=beta(i-1+nres,i-1,i,i+1)
+         omicron(1,i)=alpha(i-2,i-1,i-1+nres)
+         omicron(2,i)=alpha(i-1+nres,i-1,i)
+        endif
+        if (itype(i).ne.10) then
+         tauangle(2,i+1)=beta(i-2,i-1,i,i+nres)
+        endif
+        endif
         omeg(i)=beta(nres+i,i,maxres2,i+1)
         alph(i)=alpha(nres+i,i,maxres2)
         theta(i+1)=alpha(i-1,i,i+1)
index 96df440..3f19648 100644 (file)
@@ -5780,29 +5780,53 @@ c        amino-acid residues.
       include 'COMMON.CONTROL'
       logical lprn
 C Set lprn=.true. for debugging
+C Set lprn=.true. for debugging
       lprn=.false.
 c      lprn=.true.
-c      write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
+c      write (iout,*) "EBACK_SC_COR",itau_start,itau_end
       esccor=0.0D0
-      do i=iphi_start,iphi_end
+      do i=itau_start,itau_end
         esccor_ii=0.0D0
-        itori=itype(i-2)
-        itori1=itype(i-1)
+        isccori=isccortyp(itype(i-2))
+        isccori1=isccortyp(itype(i-1))
+c      write (iout,*) "EBACK_SC_COR",i,nterm_sccor(isccori,isccori1)
         phii=phi(i)
+        do intertyp=1,3 !intertyp
+cc Added 09 May 2012 (Adasko)
+cc  Intertyp means interaction type of backbone mainchain correlation: 
+c   1 = SC...Ca...Ca...Ca
+c   2 = Ca...Ca...Ca...SC
+c   3 = SC...Ca...Ca...SCi
         gloci=0.0D0
-        do j=1,nterm_sccor
-          v1ij=v1sccor(j,itori,itori1)
-          v2ij=v2sccor(j,itori,itori1)
-          cosphi=dcos(j*phii)
-          sinphi=dsin(j*phii)
+        if (((intertyp.eq.3).and.((itype(i-2).eq.10).or.
+     &      (itype(i-1).eq.10).or.(itype(i-2).eq.ntyp1).or.
+     &      (itype(i-1).eq.ntyp1)))
+     &    .or. ((intertyp.eq.1).and.((itype(i-2).eq.10)
+     &     .or.(itype(i-2).eq.ntyp1).or.(itype(i-1).eq.ntyp1)
+     &     .or.(itype(i).eq.ntyp1)))
+     &    .or.((intertyp.eq.2).and.((itype(i-1).eq.10).or.
+     &      (itype(i-1).eq.ntyp1).or.(itype(i-2).eq.ntyp1).or.
+     &      (itype(i-3).eq.ntyp1)))) cycle
+        if ((intertyp.eq.2).and.(i.eq.4).and.(itype(1).eq.ntyp1)) cycle
+        if ((intertyp.eq.1).and.(i.eq.nres).and.(itype(nres).eq.ntyp1))
+     & cycle
+       do j=1,nterm_sccor(isccori,isccori1)
+          v1ij=v1sccor(j,intertyp,isccori,isccori1)
+          v2ij=v2sccor(j,intertyp,isccori,isccori1)
+          cosphi=dcos(j*tauangle(intertyp,i))
+          sinphi=dsin(j*tauangle(intertyp,i))
           esccor=esccor+v1ij*cosphi+v2ij*sinphi
           gloci=gloci+j*(v2ij*cosphi-v1ij*sinphi)
         enddo
+c      write (iout,*) "EBACK_SC_COR",i,esccor,intertyp
+        gloc_sc(intertyp,i-3,icg)=gloc_sc(intertyp,i-3,icg)+wsccor*gloci
         if (lprn)
      &  write (iout,'(2(a3,2x,i3,2x),2i3,6f8.3/26x,6f8.3/)')
-     &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,itori,itori1,
-     &  (v1sccor(j,itori,itori1),j=1,6),(v2sccor(j,itori,itori1),j=1,6)
-        gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
+     &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,isccori,isccori1,
+     &  (v1sccor(j,intertyp,isccori,isccori1),j=1,6)
+     & ,(v2sccor(j,intertyp,isccori,isccori1),j=1,6)
+C        gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
+       enddo !intertyp
       enddo
       return
       end
index 5dab339..5385714 100644 (file)
@@ -23,7 +23,7 @@ cmodel      write (iunit,'(a5,i6)') 'MODEL',1
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
         else
-             write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3)') 
+           write (iunit,'(a5,i5,1x,a1,i2,1x,a3,i7,2x,a3,i7,i3,t76,i5)') 
      &           'HELIX',j,'H',j,
      &           restyp(iti),hfrag(1,j)-1,
      &           restyp(itj),hfrag(2,j)-1,1,hfrag(2,j)-hfrag(1,j)
index 25d1b12..569120f 100644 (file)
@@ -337,6 +337,7 @@ C-------------------------------------------------------------------------
       include 'COMMON.CHAIN'
       include 'COMMON.VAR'
       include 'COMMON.MD_'
+      include 'COMMON.SCCOR'
 C
 C Initialize Cartesian-coordinate gradient
 C
@@ -374,6 +375,9 @@ C
           gradx(j,i,icg)=0.0d0
           gscloc(j,i)=0.0d0
           gsclocx(j,i)=0.0d0
+          do intertyp=1,3
+           gloc_sc(intertyp,i,icg)=0.0d0
+          enddo
         enddo
       enddo
 C
index 8cc2278..8cca656 100644 (file)
@@ -564,6 +564,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
@@ -1090,6 +1093,8 @@ c        write (iout,*) "MPI_ROTAT2",MPI_ROTAT2
       idihconstr_end=ndih_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+1
index 97324ec..db8aeb0 100644 (file)
@@ -13,9 +13,9 @@ c-------------------------------------------------------------
       include 'COMMON.INTERACT'
       include 'COMMON.MD_'
       include 'COMMON.IOUNITS'
-      
+      include 'COMMON.SCCOR'        
 c   calculating dE/ddc1      
-       if (nres.lt.3) return
+       if (nres.lt.3) go to 18
        do j=1,3
          gcart(j,1)=gcart(j,1)+gloc(1,icg)*dphi(j,1,4)
      &     +gloc(nres-2,icg)*dtheta(j,1,3)      
@@ -112,7 +112,162 @@ c   The side-chain vector derivatives
      &        +gloc(ialph(i,1)+nside,icg)*domega(j,3,i)
             enddo
          endif     
-       enddo                                                                                                                                                   
+       enddo                
+c----------------------------------------------------------------------
+C INTERTYP=1 SC...Ca...Ca...Ca
+C INTERTYP=2 Ca...Ca...Ca...SC
+C INTERTYP=3 SC...Ca...Ca...SC
+c   calculating dE/ddc1      
+  18   continue
+c       do i=1,nres
+c       gloc(i,icg)=0.0D0
+c          write (iout,*) "poczotkoawy",i,gloc_sc(1,i,icg)
+c       enddo
+       if (nres.lt.2) return
+       if ((nres.lt.3).and.(itype(1).eq.10)) return
+       if ((itype(1).ne.10).and.(itype(1).ne.ntyp1)) then
+        do j=1,3
+cc Derviative was calculated for oposite vector of side chain therefore
+c there is "-" sign before gloc_sc
+         gxcart(j,1)=gxcart(j,1)-gloc_sc(1,0,icg)*
+     &     dtauangle(j,1,1,3)
+         gcart(j,1)=gcart(j,1)+gloc_sc(1,0,icg)*
+     &     dtauangle(j,1,2,3)
+          if ((itype(2).ne.10).and.(itype(2).ne.ntyp1)) then
+         gxcart(j,1)= gxcart(j,1)
+     &               -gloc_sc(3,0,icg)*dtauangle(j,3,1,3)
+         gcart(j,1)=gcart(j,1)+gloc_sc(3,0,icg)*
+     &       dtauangle(j,3,2,3)
+          endif
+       enddo
+       endif
+         if ((nres.ge.3).and.(itype(3).ne.10).and.(itype(3).ne.ntyp1))
+     & then
+         do j=1,3
+         gcart(j,1)=gcart(j,1)+gloc_sc(2,1,icg)*dtauangle(j,2,1,4)
+         enddo
+         endif
+c   As potetnial DO NOT depend on omicron anlge their derivative is
+c   ommited 
+c     &     +gloc_sc(intertyp,nres-2,icg)*dtheta(j,1,3)  
+
+c     Calculating the remainder of dE/ddc2
+       do j=1,3
+         if((itype(2).ne.10).and.(itype(2).ne.ntyp1)) then
+           if (itype(1).ne.10) gxcart(j,2)=gxcart(j,2)+
+     &                         gloc_sc(3,0,icg)*dtauangle(j,3,3,3)
+        if ((itype(3).ne.10).and.(nres.ge.3).and.(itype(3).ne.ntyp1))
+     &   then
+           gxcart(j,2)=gxcart(j,2)-gloc_sc(3,1,icg)*dtauangle(j,3,1,4)
+cc                  the   - above is due to different vector direction
+           gcart(j,2)=gcart(j,2)+gloc_sc(3,1,icg)*dtauangle(j,3,2,4)
+          endif
+          if (nres.gt.3) then
+           gxcart(j,2)=gxcart(j,2)-gloc_sc(1,1,icg)*dtauangle(j,1,1,4)
+cc                  the   - above is due to different vector direction
+           gcart(j,2)=gcart(j,2)+gloc_sc(1,1,icg)*dtauangle(j,1,2,4)
+c          write(iout,*) gloc_sc(1,1,icg),dtauangle(j,1,2,4),"gcart"
+c           write(iout,*) gloc_sc(1,1,icg),dtauangle(j,1,1,4),"gx"
+          endif
+         endif
+         if ((itype(1).ne.10).and.(itype(1).ne.ntyp1)) then
+          gcart(j,2)=gcart(j,2)+gloc_sc(1,0,icg)*dtauangle(j,1,3,3)
+c           write(iout,*)  gloc_sc(1,0,icg),dtauangle(j,1,3,3)
+        endif
+         if ((itype(3).ne.10).and.(nres.ge.3)) then
+          gcart(j,2)=gcart(j,2)+gloc_sc(2,1,icg)*dtauangle(j,2,2,4)
+c           write(iout,*) gloc_sc(2,1,icg),dtauangle(j,2,2,4)
+         endif
+         if ((itype(4).ne.10).and.(nres.ge.4)) then
+          gcart(j,2)=gcart(j,2)+gloc_sc(2,2,icg)*dtauangle(j,2,1,5)
+c           write(iout,*) gloc_sc(2,2,icg),dtauangle(j,2,1,5)
+         endif
+
+c      write(iout,*) gcart(j,2),itype(2),itype(1),itype(3), "gcart2"
+       enddo
+c    If there are more than five residues
+      if(nres.ge.5) then                        
+        do i=3,nres-2
+         do j=1,3
+c          write(iout,*) "before", gcart(j,i)
+          if ((itype(i).ne.10).and.(itype(i).ne.ntyp1)) then
+          gxcart(j,i)=gxcart(j,i)+gloc_sc(2,i-2,icg)
+     &    *dtauangle(j,2,3,i+1)
+     &    -gloc_sc(1,i-1,icg)*dtauangle(j,1,1,i+2)
+          gcart(j,i)=gcart(j,i)+gloc_sc(1,i-1,icg)
+     &    *dtauangle(j,1,2,i+2)
+c                   write(iout,*) "new",j,i,
+c     &  gcart(j,i),gloc_sc(1,i-1,icg),dtauangle(j,1,2,i+2)
+          if (itype(i-1).ne.10) then
+           gxcart(j,i)=gxcart(j,i)+gloc_sc(3,i-2,icg)
+     &*dtauangle(j,3,3,i+1)
+          endif
+          if (itype(i+1).ne.10) then
+           gxcart(j,i)=gxcart(j,i)-gloc_sc(3,i-1,icg)
+     &*dtauangle(j,3,1,i+2)
+           gcart(j,i)=gcart(j,i)+gloc_sc(3,i-1,icg)
+     &*dtauangle(j,3,2,i+2)
+          endif
+          endif
+          if (itype(i-1).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(1,i-2,icg)*
+     &     dtauangle(j,1,3,i+1)
+          endif
+          if (itype(i+1).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(2,i-1,icg)*
+     &     dtauangle(j,2,2,i+2)
+c          write(iout,*) "numer",i,gloc_sc(2,i-1,icg),
+c     &    dtauangle(j,2,2,i+2)
+          endif
+          if (itype(i+2).ne.10) then
+           gcart(j,i)=gcart(j,i)+gloc_sc(2,i,icg)*
+     &     dtauangle(j,2,1,i+3)
+          endif
+         enddo
+        enddo
+      endif     
+c  Setting dE/ddnres-1       
+      if(nres.ge.4) then
+         do j=1,3
+         if ((itype(nres-1).ne.10).and.(itype(nres-1).ne.ntyp1)) then
+         gxcart(j,nres-1)=gxcart(j,nres-1)+gloc_sc(2,nres-3,icg)
+     &    *dtauangle(j,2,3,nres)
+c          write (iout,*) "gxcart(nres-1)", gloc_sc(2,nres-3,icg),
+c     &     dtauangle(j,2,3,nres), gxcart(j,nres-1)
+         if (itype(nres-2).ne.10) then
+        gxcart(j,nres-1)=gxcart(j,nres-1)+gloc_sc(3,nres-3,icg)
+     &    *dtauangle(j,3,3,nres)
+          endif
+         if ((itype(nres).ne.10).and.(itype(nres).ne.ntyp1)) then
+        gxcart(j,nres-1)=gxcart(j,nres-1)-gloc_sc(3,nres-2,icg)
+     &    *dtauangle(j,3,1,nres+1)
+        gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(3,nres-2,icg)
+     &    *dtauangle(j,3,2,nres+1)
+          endif
+         endif
+         if ((itype(nres-2).ne.10).and.(itype(nres-2).ne.ntyp1)) then
+            gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(1,nres-3,icg)*
+     &   dtauangle(j,1,3,nres)
+         endif
+          if ((itype(nres).ne.10).and.(itype(nres).ne.ntyp1)) then
+            gcart(j,nres-1)=gcart(j,nres-1)+gloc_sc(2,nres-2,icg)*
+     &     dtauangle(j,2,2,nres+1)
+c           write (iout,*) "gcart(nres-1)", gloc_sc(2,nres-2,icg),
+c     &     dtauangle(j,2,2,nres+1), itype(nres-1),itype(nres)
+           endif
+         enddo
+      endif
+c  Settind dE/ddnres       
+       if ((nres.ge.3).and.(itype(nres).ne.10).and.
+     &    (itype(nres).ne.ntyp1))then
+       do j=1,3
+        gxcart(j,nres)=gxcart(j,nres)+gloc_sc(3,nres-2,icg)
+     & *dtauangle(j,3,3,nres+1)+gloc_sc(2,nres-2,icg)
+     & *dtauangle(j,2,3,nres+1)
+        enddo
+       endif
+c   The side-chain vector derivatives
+                                                                                                                                       
       return
       end      
        
index 5fea875..2c865e6 100644 (file)
@@ -12,6 +12,7 @@
       include 'COMMON.DERIV'
       include 'COMMON.IOUNITS'
       include 'COMMON.LOCAL'
+      include 'COMMON.SCCOR'
       double precision dcostheta(3,2,maxres),
      & dcosphi(3,3,maxres),dsinphi(3,3,maxres),
      & dcosalpha(3,3,maxres),dcosomega(3,3,maxres),
@@ -44,7 +45,41 @@ c We need dtheta(:,:,i-1) to compute dphi(:,:,i)
           dtheta(j,2,i)=-1/sint*dcostheta(j,2,i)     
         enddo
       enddo
-      
+#if defined(MPI) && defined(PARINTDER)
+c We need dtheta(:,:,i-1) to compute dphi(:,:,i)
+      do i=max0(ithet_start-1,3),ithet_end
+#else
+      do i=3,nres
+#endif
+      if ((itype(i-1).ne.10).and.(itype(i-1).ne.ntyp1)) then
+        cost1=dcos(omicron(1,i))
+        sint1=sqrt(1-cost1*cost1)
+        cost2=dcos(omicron(2,i))
+        sint2=sqrt(1-cost2*cost2)
+       do j=1,3
+CC Calculate derivative over first omicron (Cai-2,Cai-1,SCi-1) 
+          dcosomicron(j,1,1,i)=-(dc_norm(j,i-1+nres)+
+     &    cost1*dc_norm(j,i-2))/
+     &    vbld(i-1)
+          domicron(j,1,1,i)=-1/sint1*dcosomicron(j,1,1,i)
+          dcosomicron(j,1,2,i)=-(dc_norm(j,i-2)
+     &    +cost1*(dc_norm(j,i-1+nres)))/
+     &    vbld(i-1+nres)
+          domicron(j,1,2,i)=-1/sint1*dcosomicron(j,1,2,i)
+CC Calculate derivative over second omicron Sci-1,Cai-1 Cai
+CC Looks messy but better than if in loop
+          dcosomicron(j,2,1,i)=-(-dc_norm(j,i-1+nres)
+     &    +cost2*dc_norm(j,i-1))/
+     &    vbld(i)
+          domicron(j,2,1,i)=-1/sint2*dcosomicron(j,2,1,i)
+          dcosomicron(j,2,2,i)=-(dc_norm(j,i-1)
+     &     +cost2*(-dc_norm(j,i-1+nres)))/
+     &    vbld(i-1+nres)
+c          write(iout,*) "vbld", i,itype(i),vbld(i-1+nres)
+          domicron(j,2,2,i)=-1/sint2*dcosomicron(j,2,2,i)
+        enddo
+       endif
+      enddo            
 c Derivatives of phi:
 c If phi is 0 or 180 degrees, then the formulas 
 c have to be derived by power series expansion of the
@@ -109,6 +144,227 @@ c   Obtaining the gamma derivatives from cosine derivative
          enddo
         endif                                                                                           
       enddo
+Calculate derivative of Tauangle
+#ifdef PARINTDER
+      do i=itau_start,itau_end
+#else
+      do i=3,nres
+#endif
+       if ((itype(i-2).eq.ntyp1).or.(itype(i-2).eq.10)) cycle
+c       if ((itype(i-2).eq.ntyp1).or.(itype(i-2).eq.10).or.
+c     &     (itype(i-1).eq.ntyp1).or.(itype(i).eq.ntyp1)) cycle
+cc dtauangle(j,intertyp,dervityp,residue number)
+cc INTERTYP=1 SC...Ca...Ca..Ca
+c the conventional case
+        sint=dsin(theta(i))
+        sint1=dsin(omicron(2,i-1))
+        sing=dsin(tauangle(1,i))
+        cost=dcos(theta(i))
+        cost1=dcos(omicron(2,i-1))
+        cosg=dcos(tauangle(1,i))
+        do j=1,3
+        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
+cc       write(iout,*) dc_norm2(j,i-2+nres),"dcnorm"
+        enddo
+        scalp=scalar(dc_norm2(1,i-2+nres),dc_norm(1,i-1))
+        fac0=1.0d0/(sint1*sint)
+        fac1=cost*fac0
+        fac2=cost1*fac0
+        fac3=cosg*cost1/(sint1*sint1)
+        fac4=cosg*cost/(sint*sint)
+cc         write(iout,*) "faki",fac0,fac1,fac2,fac3,fac4
+c    Obtaining the gamma derivatives from sine derivative                                
+       if (tauangle(1,i).gt.-pi4.and.tauangle(1,i).le.pi4.or.
+     &     tauangle(1,i).gt.pi34.and.tauangle(1,i).le.pi.or.
+     &     tauangle(1,i).gt.-pi.and.tauangle(1,i).le.-pi34) then
+         call vecpr(dc_norm(1,i-1),dc_norm(1,i-2),vp1)
+         call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-1),vp2)
+         call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-2),vp3)
+        do j=1,3
+            ctgt=cost/sint
+            ctgt1=cost1/sint1
+            cosg_inv=1.0d0/cosg
+            dsintau(j,1,1,i)=-sing*ctgt1*domicron(j,2,2,i-1)
+     &-(fac0*vp1(j)+sing*(dc_norm2(j,i-2+nres)))
+     & *vbld_inv(i-2+nres)
+            dtauangle(j,1,1,i)=cosg_inv*dsintau(j,1,1,i)
+            dsintau(j,1,2,i)=
+     &        -sing*(ctgt1*domicron(j,2,1,i-1)+ctgt*dtheta(j,1,i))
+     &        -(fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
+c            write(iout,*) "dsintau", dsintau(j,1,2,i)
+            dtauangle(j,1,2,i)=cosg_inv*dsintau(j,1,2,i)
+c Bug fixed 3/24/05 (AL)
+            dsintau(j,1,3,i)=-sing*ctgt*dtheta(j,2,i)
+     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i)
+c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
+            dtauangle(j,1,3,i)=cosg_inv*dsintau(j,1,3,i)
+         enddo
+c   Obtaining the gamma derivatives from cosine derivative
+        else
+           do j=1,3
+           dcostau(j,1,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
+     &     dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1)-scalp*
+     &     (dc_norm2(j,i-2+nres)))/vbld(i-2+nres)
+           dtauangle(j,1,1,i)=-1/sing*dcostau(j,1,1,i)
+           dcostau(j,1,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
+     &     dcostheta(j,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
+     &     dcostheta(j,1,i)
+           dtauangle(j,1,2,i)=-1/sing*dcostau(j,1,2,i)
+           dcostau(j,1,3,i)=fac2*dcostheta(j,2,i)+fac4*
+     &     dcostheta(j,2,i)-fac0*(-dc_norm(j,i-2+nres)-scalp*
+     &     dc_norm(j,i-1))/vbld(i)
+           dtauangle(j,1,3,i)=-1/sing*dcostau(j,1,3,i)
+c         write (iout,*) "else",i
+         enddo
+        endif
+c        do k=1,3                 
+c        write(iout,*) "tu",i,k,(dtauangle(j,1,k,i),j=1,3)        
+c        enddo                
+      enddo
+CC Second case Ca...Ca...Ca...SC
+#ifdef PARINTDER
+      do i=itau_start,itau_end
+#else
+      do i=4,nres
+#endif
+       if ((itype(i-1).eq.ntyp1).or.(itype(i-1).eq.10).or.
+     &    (itype(i-2).eq.ntyp1).or.(itype(i-3).eq.ntyp1)) cycle
+c the conventional case
+        sint=dsin(omicron(1,i))
+        sint1=dsin(theta(i-1))
+        sing=dsin(tauangle(2,i))
+        cost=dcos(omicron(1,i))
+        cost1=dcos(theta(i-1))
+        cosg=dcos(tauangle(2,i))
+c        do j=1,3
+c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
+c        enddo
+        scalp=scalar(dc_norm(1,i-3),dc_norm(1,i-1+nres))
+        fac0=1.0d0/(sint1*sint)
+        fac1=cost*fac0
+        fac2=cost1*fac0
+        fac3=cosg*cost1/(sint1*sint1)
+        fac4=cosg*cost/(sint*sint)
+c    Obtaining the gamma derivatives from sine derivative                                
+       if (tauangle(2,i).gt.-pi4.and.tauangle(2,i).le.pi4.or.
+     &     tauangle(2,i).gt.pi34.and.tauangle(2,i).le.pi.or.
+     &     tauangle(2,i).gt.-pi.and.tauangle(2,i).le.-pi34) then
+         call vecpr(dc_norm2(1,i-1+nres),dc_norm(1,i-2),vp1)
+         call vecpr(dc_norm(1,i-3),dc_norm(1,i-1+nres),vp2)
+         call vecpr(dc_norm(1,i-3),dc_norm(1,i-2),vp3)
+        do j=1,3
+            ctgt=cost/sint
+            ctgt1=cost1/sint1
+            cosg_inv=1.0d0/cosg
+            dsintau(j,2,1,i)=-sing*ctgt1*dtheta(j,1,i-1)
+     &        +(fac0*vp1(j)-sing*dc_norm(j,i-3))*vbld_inv(i-2)
+c       write(iout,*) i,j,dsintau(j,2,1,i),sing*ctgt1*dtheta(j,1,i-1),
+c     &fac0*vp1(j),sing*dc_norm(j,i-3),vbld_inv(i-2),"dsintau(2,1)"
+            dtauangle(j,2,1,i)=cosg_inv*dsintau(j,2,1,i)
+            dsintau(j,2,2,i)=
+     &        -sing*(ctgt1*dtheta(j,2,i-1)+ctgt*domicron(j,1,1,i))
+     &        -(fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
+c            write(iout,*) "sprawdzenie",i,j,sing*ctgt1*dtheta(j,2,i-1),
+c     & sing*ctgt*domicron(j,1,2,i),
+c     & (fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
+            dtauangle(j,2,2,i)=cosg_inv*dsintau(j,2,2,i)
+c Bug fixed 3/24/05 (AL)
+            dsintau(j,2,3,i)=-sing*ctgt*domicron(j,1,2,i)
+     &       +(fac0*vp3(j)-sing*dc_norm(j,i-1+nres))*vbld_inv(i-1+nres)
+c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
+            dtauangle(j,2,3,i)=cosg_inv*dsintau(j,2,3,i)
+         enddo
+c   Obtaining the gamma derivatives from cosine derivative
+        else
+           do j=1,3
+           dcostau(j,2,1,i)=fac1*dcostheta(j,1,i-1)+fac3*
+     &     dcostheta(j,1,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
+     &     dc_norm(j,i-3))/vbld(i-2)
+           dtauangle(j,2,1,i)=-1/sing*dcostau(j,2,1,i)
+           dcostau(j,2,2,i)=fac1*dcostheta(j,2,i-1)+fac2*
+     &     dcosomicron(j,1,1,i)+fac3*dcostheta(j,2,i-1)+fac4*
+     &     dcosomicron(j,1,1,i)
+           dtauangle(j,2,2,i)=-1/sing*dcostau(j,2,2,i)
+           dcostau(j,2,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
+     &     dcosomicron(j,1,2,i)-fac0*(dc_norm(j,i-3)-scalp*
+     &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
+           dtauangle(j,2,3,i)=-1/sing*dcostau(j,2,3,i)
+c        write(iout,*) i,j,"else", dtauangle(j,2,3,i) 
+         enddo
+        endif                                    
+      enddo
+
+CCC third case SC...Ca...Ca...SC
+#ifdef PARINTDER
+
+      do i=itau_start,itau_end
+#else
+      do i=3,nres
+#endif
+c the conventional case
+      if ((itype(i-1).eq.ntyp1).or.(itype(i-1).eq.10).or.
+     &(itype(i-2).eq.ntyp1).or.(itype(i-2).eq.10)) cycle
+        sint=dsin(omicron(1,i))
+        sint1=dsin(omicron(2,i-1))
+        sing=dsin(tauangle(3,i))
+        cost=dcos(omicron(1,i))
+        cost1=dcos(omicron(2,i-1))
+        cosg=dcos(tauangle(3,i))
+        do j=1,3
+        dc_norm2(j,i-2+nres)=-dc_norm(j,i-2+nres)
+c        dc_norm2(j,i-1+nres)=-dc_norm(j,i-1+nres)
+        enddo
+        scalp=scalar(dc_norm2(1,i-2+nres),dc_norm(1,i-1+nres))
+        fac0=1.0d0/(sint1*sint)
+        fac1=cost*fac0
+        fac2=cost1*fac0
+        fac3=cosg*cost1/(sint1*sint1)
+        fac4=cosg*cost/(sint*sint)
+c    Obtaining the gamma derivatives from sine derivative                                
+       if (tauangle(3,i).gt.-pi4.and.tauangle(3,i).le.pi4.or.
+     &     tauangle(3,i).gt.pi34.and.tauangle(3,i).le.pi.or.
+     &     tauangle(3,i).gt.-pi.and.tauangle(3,i).le.-pi34) then
+         call vecpr(dc_norm(1,i-1+nres),dc_norm(1,i-2),vp1)
+         call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-1+nres),vp2)
+         call vecpr(dc_norm2(1,i-2+nres),dc_norm(1,i-2),vp3)
+        do j=1,3
+            ctgt=cost/sint
+            ctgt1=cost1/sint1
+            cosg_inv=1.0d0/cosg
+            dsintau(j,3,1,i)=-sing*ctgt1*domicron(j,2,2,i-1)
+     &        -(fac0*vp1(j)-sing*dc_norm(j,i-2+nres))
+     &        *vbld_inv(i-2+nres)
+            dtauangle(j,3,1,i)=cosg_inv*dsintau(j,3,1,i)
+            dsintau(j,3,2,i)=
+     &        -sing*(ctgt1*domicron(j,2,1,i-1)+ctgt*domicron(j,1,1,i))
+     &        -(fac0*vp2(j)+sing*dc_norm(j,i-2))*vbld_inv(i-1)
+            dtauangle(j,3,2,i)=cosg_inv*dsintau(j,3,2,i)
+c Bug fixed 3/24/05 (AL)
+            dsintau(j,3,3,i)=-sing*ctgt*domicron(j,1,2,i)
+     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1+nres))
+     &        *vbld_inv(i-1+nres)
+c     &        +(fac0*vp3(j)-sing*dc_norm(j,i-1))*vbld_inv(i-1)
+            dtauangle(j,3,3,i)=cosg_inv*dsintau(j,3,3,i)
+         enddo
+c   Obtaining the gamma derivatives from cosine derivative
+        else
+           do j=1,3
+           dcostau(j,3,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
+     &     dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
+     &     dc_norm2(j,i-2+nres))/vbld(i-2+nres)
+           dtauangle(j,3,1,i)=-1/sing*dcostau(j,3,1,i)
+           dcostau(j,3,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
+     &     dcosomicron(j,1,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
+     &     dcosomicron(j,1,1,i)
+           dtauangle(j,3,2,i)=-1/sing*dcostau(j,3,2,i)
+           dcostau(j,3,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
+     &     dcosomicron(j,1,2,i)-fac0*(dc_norm2(j,i-2+nres)-scalp*
+     &     dc_norm(j,i-1+nres))/vbld(i-1+nres)
+           dtauangle(j,3,3,i)=-1/sing*dcostau(j,3,3,i)
+c          write(iout,*) "else",i 
+         enddo
+        endif
+      enddo
 #ifdef CRYST_SC
 c   Derivatives of side-chain angles alpha and omega
 #if defined(MPI) && defined(PARINTDER)
index f95bbb0..20a2319 100644 (file)
@@ -557,24 +557,126 @@ C
 C 5/21/07 (AL) Read coefficients of the backbone-local sidechain-local
 C         correlation energies.
 C
-      read (isccor,*,end=119,err=119) nterm_sccor
-      do i=1,20
-       do j=1,20
-          read (isccor,'(a)')
-         do k=1,nterm_sccor
-           read (isccor,*,end=119,err=119) kk,v1sccor(k,i,j),
-     &        v2sccor(k,i,j) 
+      read (isccor,*,end=119,err=119) nsccortyp
+#ifdef SCCORPDB
+      read (isccor,*,end=119,err=119) (isccortyp(i),i=1,ntyp)
+C For D-aminoacid uncomment
+C      do i=-ntyp,-1
+C        isccortyp(i)=-isccortyp(-i)
+C      enddo
+      iscprol=isccortyp(20)
+c      write (iout,*) 'ntortyp',ntortyp
+      maxinter=3
+cc maxinter is maximum interaction sites
+      do l=1,maxinter
+      do i=1,nsccortyp
+        do j=1,nsccortyp
+          read (isccor,*,end=119,err=119)
+     &nterm_sccor(i,j),nlor_sccor(i,j)
+          v0ijsccor=0.0d0
+          si=-1.0d0
+C          nterm_sccor(-i,j)=nterm_sccor(i,j)
+C          nterm_sccor(-i,-j)=nterm_sccor(i,j)
+C          nterm_sccor(i,-j)=nterm_sccor(i,j)
+          do k=1,nterm_sccor(i,j)
+            read (isccor,*,end=119,err=119) kk,v1sccor(k,l,i,j)
+     &    ,v2sccor(k,l,i,j)
+C            if (j.eq.iscprol) then
+C             if (i.eq.isccortyp(10)) then
+C             v1sccor(k,l,i,-j)=v1sccor(k,l,i,j)
+C             v2sccor(k,l,i,-j)=-v2sccor(k,l,i,j)
+C             else
+C             v1sccor(k,l,i,-j)=v1sccor(k,l,i,j)*0.5d0
+C     &                        +v2sccor(k,l,i,j)*dsqrt(0.75d0)
+C             v2sccor(k,l,i,-j)=-v2sccor(k,l,i,j)*0.5d0
+C     &                        +v1sccor(k,l,i,j)*dsqrt(0.75d0)
+C             v1sccor(k,l,-i,-j)=v1sccor(k,l,i,j)
+C             v2sccor(k,l,-i,-j)=-v2sccor(k,l,i,j)
+C             v1sccor(k,l,-i,j)=v1sccor(k,l,i,-j)
+C             v2sccor(k,l,-i,j)=-v2sccor(k,l,i,-j)
+C             endif
+CC           else
+C             if (i.eq.isccortyp(10)) then
+C             v1sccor(k,l,i,-j)=v1sccor(k,l,i,j)
+C             v2sccor(k,l,i,-j)=-v2sccor(k,l,i,j)
+C             else
+C               if (j.eq.isccortyp(10)) then
+C             v1sccor(k,l,-i,j)=v1sccor(k,l,i,j)
+C             v2sccor(k,l,-i,j)=-v2sccor(k,l,i,j)
+C               else
+C             v1sccor(k,l,i,-j)=-v1sccor(k,l,i,j)
+C             v2sccor(k,l,i,-j)=-v2sccor(k,l,i,j)
+C             v1sccor(k,l,-i,-j)=v1sccor(k,l,i,j)
+C             v2sccor(k,l,-i,-j)=-v2sccor(k,l,i,j)
+C             v1sccor(k,l,-i,j)=v1sccor(k,l,i,-j)
+C             v2sccor(k,l,-i,j)=-v2sccor(k,l,i,-j)
+C                endif
+C               endif
+C            endif
+            v0ijsccor=v0ijsccor+si*v1sccor(k,l,i,j)
+            si=-si
+          enddo
+          do k=1,nlor_sccor(i,j)
+            read (isccor,*,end=113,err=113) kk,vlor1sccor(k,i,j),
+     &        vlor2sccor(k,i,j),vlor3sccor(k,i,j)
+            v0ijsccor=v0ijsccor+vlor1sccor(k,i,j)/
+     &(1+vlor3sccor(k,i,j)**2)
+          enddo
+          v0sccor(i,j)=v0ijsccor
+        enddo
+      enddo
+      enddo
+      close (isccor)
+#else
+      read (isccor,*,end=113,err=113) (isccortyp(i),i=1,ntyp)
+c      write (iout,*) 'ntortyp',ntortyp
+      maxinter=3
+cc maxinter is maximum interaction sites
+      do l=1,maxinter
+      do i=1,nsccortyp
+        do j=1,nsccortyp
+          read (isccor,*,end=113,err=113)
+     & nterm_sccor(i,j),nlor_sccor(i,j)
+          v0ijsccor=0.0d0
+          si=-1.0d0
+
+          do k=1,nterm_sccor(i,j)
+            read (isccor,*,end=113,err=113) kk,v1sccor(k,l,i,j)
+     &    ,v2sccor(k,l,i,j)
+            v0ijsccor=v0ijsccor+si*v1sccor(k,l,i,j)
+            si=-si
           enddo
+          do k=1,nlor_sccor(i,j)
+            read (isccor,*,end=113,err=113) kk,vlor1sccor(k,i,j),
+     &        vlor2sccor(k,i,j),vlor3sccor(k,i,j)
+            v0ijsccor=v0ijsccor+vlor1sccor(k,i,j)/
+     &(1+vlor3sccor(k,i,j)**2)
+          enddo
+          v0sccor(i,j)=v0ijsccor
         enddo
       enddo
+      enddo
       close (isccor)
+
+#endif      
       if (lprint) then
-       write (iout,'(/a/)') 'Torsional constants of SCCORR:'
-       do i=1,20
-         do j=1,20
+       write (iout,'(/a/)') 'Torsional constants of SCCORR:'
+C       do i=1,20
+C         do j=1,20
+C        write (iout,'(/a/)') 'Torsional constants:'
+        do i=1,nsccortyp
+          do j=1,nsccortyp
             write (iout,*) 'ityp',i,' jtyp',j
-            do k=1,nterm_sccor
-             write (iout,'(2(1pe15.5))') v1sccor(k,i,j),v2sccor(k,i,j)
+C            do k=1,nterm_sccor
+C             write (iout,'(2(1pe15.5))') v1sccor(k,i,j),v2sccor(k,i,j)
+C            write (iout,*) 'Fourier constants'
+            do k=1,nterm_sccor(i,j)
+      write (iout,'(2(1pe15.5))') v1sccor(k,l,i,j),v2sccor(k,l,i,j)
+            enddo
+            write (iout,*) 'Lorenz constants'
+            do k=1,nlor_sccor(i,j)
+              write (iout,'(3(1pe15.5))')
+     &         vlor1sccor(k,i,j),vlor2sccor(k,i,j),vlor3sccor(k,i,j)
             enddo
           enddo
         enddo
index eb4ba3f..08bdf96 100644 (file)
@@ -250,7 +250,20 @@ ctest          stop
         vbld(i+1)=dist(i,i+1)
         vbld_inv(i+1)=1.0d0/vbld(i+1)
         if (i.gt.1) theta(i+1)=alpha(i-1,i,i+1)
-        if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
+        if (i.gt.2) then
+        if (i.le.nres) phi(i+1)=beta(i-2,i-1,i,i+1)
+        if ((itype(i).ne.10).and.(itype(i-1).ne.10)) then
+         tauangle(3,i+1)=beta(i+nres-1,i-1,i,i+nres)
+        endif
+        if (itype(i-1).ne.10) then
+         tauangle(1,i+1)=beta(i-1+nres,i-1,i,i+1)
+         omicron(1,i)=alpha(i-2,i-1,i-1+nres)
+         omicron(2,i)=alpha(i-1+nres,i-1,i)
+        endif
+        if (itype(i).ne.10) then
+         tauangle(2,i+1)=beta(i-2,i-1,i,i+nres)
+        endif
+        endif
       enddo
 c      if (unres_pdb) then
 c        if (itype(1).eq.21) then
index 3cdbeef..f1a33c8 100644 (file)
@@ -78,7 +78,8 @@ C Fine-grain slaves just do energy and gradient components.
       else if (modecalc.eq.5) then
          call exec_checkgrad
       else
-        write (iout,'(a)') 'This calculation type is not supported',
+        write (iout,'(a,i5)') 
+     &   'This calculation type is not supported',
      &   ModeCalc
       endif
 #ifdef MPI