Commit Adam 6/29/2014
[unres.git] / source / wham / src-NEWSC / energy_p_new.F
old mode 100755 (executable)
new mode 100644 (file)
index 113d499..37bd887
@@ -6256,8 +6256,8 @@ c        amino-acid residues.
       include 'COMMON.CONTROL'
       logical lprn
 C Set lprn=.true. for debugging
-      lprn=.false.
-c      lprn=.true.
+c      lprn=.false.
+      lprn=.true.
 c      write (iout,*) "EBACK_SC_COR",itau_start,itau_end,nterm_sccor
       esccor=0.0D0
       do i=itau_start,itau_end
@@ -6289,22 +6289,27 @@ c   3 = SC...Ca...Ca...SCi
         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
+        esccori=0.0d0
         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
+          esccori=esccori+v1ij*cosphi+v2ij*sinphi
           gloci=gloci+j*(v2ij*cosphi-v1ij*sinphi)
         enddo
+        esccor=esccor+esccori
         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,intertyp,itori,itori1),j=1,6)
-     & ,(v2sccor(j,intertyp,itori,itori1),j=1,6)
+        if (lprn) then
+        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,isccori,isccori1,
+     &  (v1sccor(j,intertyp,isccori,isccori1),j=1,6)
+     & ,(v2sccor(j,intertyp,isccori,isccori1),j=1,6)
+        write (iout,*) "esccori",esccori
+        call flush(iout)
+        endif
         gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
        enddo !intertyp
       enddo