Merge branch 'adasko' into devel
authorAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Mon, 18 Jun 2012 10:22:21 +0000 (06:22 -0400)
committerAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Mon, 18 Jun 2012 10:22:21 +0000 (06:22 -0400)
Conflicts:
.gitignore

1  2 
.gitignore
source/unres/src_MD/energy_p_new_barrier.F
source/unres/src_MD/readrtns.F

diff --combined .gitignore
@@@ -1,11 -1,6 +1,19 @@@
++<<<<<<< HEAD
 +# ignore compiled stuff
 +*.[oa]
 +
 +# ignore texteditors
 +*.swp
 +*~
 +
 +
 +# ifnore build dir
 +build/
++=======
+ ~.[ao]
+ gradcheck/
+ mapcheck/
+ run/
+ sympcheck/
++>>>>>>> adasko
  
@@@ -471,7 -471,7 +471,7 @@@ cMS$ATTRIBUTES C ::  proc_pro
        include 'mpif.h'
  #endif
        double precision gradbufc(3,maxres),gradbufx(3,maxres),
-      &  glocbuf(4*maxres),gradbufc_sum(3,maxres)
+      &  glocbuf(4*maxres),gradbufc_sum(3,maxres),gloc_scbuf(3,maxres)
        include 'COMMON.SETUP'
        include 'COMMON.IOUNITS'
        include 'COMMON.FFIELD'
        include 'COMMON.CONTROL'
        include 'COMMON.TIME1'
        include 'COMMON.MAXGRAD'
+       include 'COMMON.SCCOR'
  #ifdef TIMING
  #ifdef MPI
        time01=MPI_Wtime()
@@@ -755,7 -756,6 +756,6 @@@ c      endd
       &   +wturn3*gel_loc_turn3(i)
       &   +wturn6*gel_loc_turn6(i)
       &   +wel_loc*gel_loc_loc(i)
-      &   +wsccor*gsccor_loc(i)
        enddo
  #ifdef DEBUG
        write (iout,*) "gloc after adding corr"
          do i=1,4*nres
            glocbuf(i)=gloc(i,icg)
          enddo
+ #define DEBUG
+ #ifdef DEBUG
+       write (iout,*) "gloc_sc before reduce"
+       do i=1,nres
+        do j=1,3
+         write (iout,*) i,j,gloc_sc(j,i,icg)
+        enddo
+       enddo
+ #endif
+ #undef DEBUG
+         do i=1,nres
+          do j=1,3
+           gloc_scbuf(j,i)=gloc_sc(j,i,icg)
+          enddo
+         enddo
          time00=MPI_Wtime()
          call MPI_Barrier(FG_COMM,IERR)
          time_barrier_g=time_barrier_g+MPI_Wtime()-time00
       &    MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR)
          call MPI_Reduce(glocbuf(1),gloc(1,icg),4*nres,
       &    MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR)
+         call MPI_Reduce(gloc_scbuf(1,1),gloc_sc(1,1,icg),3*nres,
+      &    MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR)
          time_reduce=time_reduce+MPI_Wtime()-time00
+ #define DEBUG
+ #ifdef DEBUG
+       write (iout,*) "gloc_sc after reduce"
+       do i=1,nres
+        do j=1,3
+         write (iout,*) i,j,gloc_sc(j,i,icg)
+        enddo
+       enddo
+ #endif
+ #undef DEBUG
  #ifdef DEBUG
        write (iout,*) "gloc after reduce"
        do i=1,4*nres
@@@ -5650,7 -5677,7 +5677,7 @@@ C Proline-Proline pair is a special cas
       &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,itori,itori1,
       &  (v1(j,itori,itori1),j=1,6),(v2(j,itori,itori1),j=1,6)
          gloc(i-3,icg)=gloc(i-3,icg)+wtor*gloci
- c       write (iout,*) 'i=',i,' gloc=',gloc(i-3,icg)
+         write (iout,*) 'i=',i,' gloc=',gloc(i-3,icg)
        enddo
  ! 6/20/98 - dihedral angle constraints
        edihcnstr=0.0d0
@@@ -5765,6 -5792,7 +5792,7 @@@ c      do i=1,ndih_const
          else
            difi=0.0
          endif
+ c        write (iout,*) "gloci", gloc(i-3,icg)
  cd        write (iout,'(2i5,4f8.3,2e14.5)') i,itori,rad2deg*phii,
  cd     &    rad2deg*phi0(i),  rad2deg*drange(i),
  cd     &    rad2deg*difi,0.25d0*ftors*difi**4,gloc(itori-3,icg)
@@@ -5801,7 -5829,6 +5829,6 @@@ c     lprn=.true
          phii1=phi(i+1)
          gloci1=0.0D0
          gloci2=0.0D0
- C Regular cosine and sine terms
          do j=1,ntermd_1(itori,itori1,itori2)
            v1cij=v1c(1,j,itori,itori1,itori2)
            v1sij=v1s(1,j,itori,itori1,itori2)
          enddo
          gloc(i-3,icg)=gloc(i-3,icg)+wtor_d*gloci1
          gloc(i-2,icg)=gloc(i-2,icg)+wtor_d*gloci2
+ c        write (iout,*) "gloci", gloc(i-3,icg)
        enddo
        return
        end
@@@ -5868,26 -5896,57 +5896,57 @@@ C Set lprn=.true. for debuggin
  c      lprn=.true.
  c      write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
        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))
          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)
+         
+         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.21).or.
+      &      (itype(i-1).eq.21)))
+      &    .or. ((intertyp.eq.1).and.((itype(i-2).eq.10)
+      &     .or.(itype(i-2).eq.21)))
+      &    .or.((intertyp.eq.2).and.((itype(i-1).eq.10).or.
+      &      (itype(i-1).eq.21)))) cycle  
+         if ((intertyp.eq.2).and.(i.eq.4).and.(itype(1).eq.21)) cycle
+         if ((intertyp.eq.1).and.(i.eq.nres).and.(itype(nres).eq.21))
+      & 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
+         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)
          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)
+      &  (v1sccor(j,intertyp,itori,itori1),j=1,6)
+      & ,(v2sccor(j,intertyp,itori,itori1),j=1,6)
          gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
+        enddo !intertyp
        enddo
+ c        do i=1,nres
+ c        write (iout,*) "W@T@F",  gloc_sc(1,i,icg),gloc(i,icg)
+ c        enddo
        return
        end
  c----------------------------------------------------------------------------
  C      Parallel       Antiparallel
  C                                             
  C          o             o         
 -C         /l\           /j\       
 -C        /   \         /   \      
 -C       /| o |         | o |\     
 +C         /l\           /j\
 +C        /   \         /   \
 +C       /| o |         | o |\
  C     \ j|/k\|  /   \  |/k\|l /   
  C      \ /   \ /     \ /   \ /    
  C       o     o       o     o                
@@@ -8095,18 -8154,18 +8154,18 @@@ c--------------------------------------
        logical lprn
        common /kutas/ lprn
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 -C                                              
 -C      Parallel       Antiparallel
 -C                                             
 -C          o             o         
 -C     \   /l\           /j\   /   
 -C      \ /   \         /   \ /    
 -C       o| o |         | o |o     
 -C     \ j|/k\|      \  |/k\|l     
 -C      \ /   \       \ /   \      
 -C       o             o                      
 -C       i             i                     
 -C
 +C                                                                              C
 +C      Parallel       Antiparallel                                             C
 +C                                                                              C
 +C          o             o                                                     C
 +C     \   /l\           /j\   /                                                C
 +C      \ /   \         /   \ /                                                 C
 +C       o| o |         | o |o                                                  C                
 +C     \ j|/k\|      \  |/k\|l                                                  C
 +C      \ /   \       \ /   \                                                   C
 +C       o             o                                                        C
 +C       i             i                                                        C 
 +C                                                                              C           
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
  cd      write (2,*) 'eello6_graph2: i,',i,' j',j,' k',k,' l',l
  C AL 7/4/01 s1 would occur in the sixth-order moment, 
@@@ -8277,18 -8336,18 +8336,18 @@@ c--------------------------------------
        double precision vv(2),pizda(2,2),auxmat(2,2),auxvec(2)
        logical swap
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 -C                                              
 -C      Parallel       Antiparallel
 -C                                             
 -C          o             o         
 -C         /l\   /   \   /j\       
 -C        /   \ /     \ /   \      
 -C       /| o |o       o| o |\     
 -C       j|/k\|  /      |/k\|l /   
 -C        /   \ /       /   \ /    
 -C       /     o       /     o                
 -C       i             i                     
 -C
 +C                                                                              C 
 +C      Parallel       Antiparallel                                             C
 +C                                                                              C
 +C          o             o                                                     C 
 +C         /l\   /   \   /j\                                                    C 
 +C        /   \ /     \ /   \                                                   C
 +C       /| o |o       o| o |\                                                  C
 +C       j|/k\|  /      |/k\|l /                                                C
 +C        /   \ /       /   \ /                                                 C
 +C       /     o       /     o                                                  C
 +C       i             i                                                        C
 +C                                                                              C
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
  C
  C 4/7/01 AL Component s1 was removed, because it pertains to the respective 
@@@ -8394,18 -8453,18 +8453,18 @@@ c--------------------------------------
       & auxvec1(2),auxmat1(2,2)
        logical swap
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 -C                                              
 -C      Parallel       Antiparallel
 -C                                             
 -C          o             o         
 -C         /l\   /   \   /j\       
 -C        /   \ /     \ /   \      
 -C       /| o |o       o| o |\     
 -C     \ j|/k\|      \  |/k\|l     
 -C      \ /   \       \ /   \      
 -C       o     \       o     \                
 -C       i             i                     
 -C
 +C                                                                              C                       
 +C      Parallel       Antiparallel                                             C
 +C                                                                              C
 +C          o             o                                                     C
 +C         /l\   /   \   /j\                                                    C
 +C        /   \ /     \ /   \                                                   C
 +C       /| o |o       o| o |\                                                  C
 +C     \ j|/k\|      \  |/k\|l                                                  C
 +C      \ /   \       \ /   \                                                   C 
 +C       o     \       o     \                                                  C
 +C       i             i                                                        C
 +C                                                                              C 
  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
  C
  C 4/7/01 AL Component s1 was removed, because it pertains to the respective 
@@@ -2080,38 -2080,38 +2080,38 @@@ C Get parameter filenames and open the 
        open (isidep,file=sidename,status='old')
  #else
        open(1,file=pref_orig(:ilen(pref_orig))//'.inp',status='old',
 -     &  readonly)
 +     &action='read')
         open (9,file=prefix(:ilen(prefix))//'.intin',status='unknown')
  C      open (18,file=prefix(:ilen(prefix))//'.entin',status='unknown')
  C Get parameter filenames and open the parameter files.
        call getenv_loc('BONDPAR',bondname)
 -      open (ibond,file=bondname,status='old',readonly)
 +      open (ibond,file=bondname,status='old',action='read')
        call getenv_loc('THETPAR',thetname)
 -      open (ithep,file=thetname,status='old',readonly)
 +      open (ithep,file=thetname,status='old',action='read')
  #ifndef CRYST_THETA
        call getenv_loc('THETPARPDB',thetname_pdb)
        print *,"thetname_pdb ",thetname_pdb
 -      open (ithep_pdb,file=thetname_pdb,status='old',readonly)
 +      open (ithep_pdb,file=thetname_pdb,status='old',action='read')
        print *,ithep_pdb," opened"
  #endif
        call getenv_loc('ROTPAR',rotname)
 -      open (irotam,file=rotname,status='old',readonly)
 +      open (irotam,file=rotname,status='old',action='read')
  #ifndef CRYST_SC
        call getenv_loc('ROTPARPDB',rotname_pdb)
 -      open (irotam_pdb,file=rotname_pdb,status='old',readonly)
 +      open (irotam_pdb,file=rotname_pdb,status='old',action='read')
  #endif
        call getenv_loc('TORPAR',torname)
 -      open (itorp,file=torname,status='old',readonly)
 +      open (itorp,file=torname,status='old',action='read')
        call getenv_loc('TORDPAR',tordname)
 -      open (itordp,file=tordname,status='old',readonly)
 +      open (itordp,file=tordname,status='old',action='read')
        call getenv_loc('SCCORPAR',sccorname)
 -      open (isccor,file=sccorname,status='old',readonly)
 +      open (isccor,file=sccorname,status='old',action='read')
        call getenv_loc('FOURIER',fouriername)
 -      open (ifourier,file=fouriername,status='old',readonly)
 +      open (ifourier,file=fouriername,status='old',action='read')
        call getenv_loc('ELEPAR',elename)
 -      open (ielep,file=elename,status='old',readonly)
 +      open (ielep,file=elename,status='old',action='read')
        call getenv_loc('SIDEPAR',sidename)
 -      open (isidep,file=sidename,status='old',readonly)
 +      open (isidep,file=sidename,status='old',action='read')
  #endif
  #ifndef OLDSCP
  C
  #elif (defined G77)
        open (iscpp,file=scpname,status='old')
  #else
 -      open (iscpp,file=scpname,status='old',readonly)
 +      open (iscpp,file=scpname,status='old',action='read')
  #endif
  #endif
        call getenv_loc('PATTERN',patname)
  #elif (defined G77)
        open (icbase,file=patname,status='old')
  #else
 -      open (icbase,file=patname,status='old',readonly)
 +      open (icbase,file=patname,status='old',action='read')
  #endif
  #ifdef MPI
  C Open output file only for CG processes
@@@ -2192,6 -2192,7 +2192,7 @@@ c      print *,"Processor",myrank," fg_
  #if defined(AIX) || defined(PGI)
        if (me.eq.king .or. .not. out1file) 
       &   open(iout,file=outname,status='unknown')
+ c#define DEBUG
  #ifdef DEBUG
        if (fg_rank.gt.0) then
          write (liczba,'(i3.3)') myrank/nfgtasks
       &   status='unknown')
        endif
  #endif
+ c#undef DEBUG
        if(me.eq.king) then
         open(igeom,file=intname,status='unknown',position='append')
         open(ipdb,file=pdbname,status='unknown')
@@@ -2211,14 -2213,17 +2213,17 @@@ c1out       open(iout,file=outname,stat
  #else
        if (me.eq.king .or. .not.out1file)
       &    open(iout,file=outname,status='unknown')
+ c#define DEBUG
  #ifdef DEBUG
        if (fg_rank.gt.0) then
+         print "Processor",fg_rank," opening output file"
          write (liczba,'(i3.3)') myrank/nfgtasks
          write (ll,'(bz,i3.3)') fg_rank
          open(iout,file="debug"//liczba(:ilen(liczba))//"."//ll,
       &   status='unknown')
        endif
  #endif
+ c#undef DEBUG
        if(me.eq.king) then
         open(igeom,file=intname,status='unknown',access='append')
         open(ipdb,file=pdbname,status='unknown')