small fix for Gly as 1st residue and in dynamic disulfides
[unres.git] / source / wham / src-M / energy_p_new.F
index cba6b5e..be6ed2a 100644 (file)
@@ -23,7 +23,7 @@ cMS$ATTRIBUTES C ::  proc_proc
       include 'COMMON.SBRIDGE'
       include 'COMMON.CHAIN'
       double precision fact(6)
-cd      write(iout, '(a,i2)')'Calling etotal ipot=',ipot
+Cd      write(iout, '(a,i2)')'Calling etotal ipot=',ipot
 cd    print *,'nnt=',nnt,' nct=',nct
 C
 C Compute the side-chain and electrostatic interaction energy
@@ -825,6 +825,7 @@ c     print *,'Entering EGB nnt=',nnt,' nct=',nct,' expon=',expon
 c      if (icall.gt.0) lprn=.true.
       ind=0
       do i=iatsc_s,iatsc_e
+C        write(iout,*) i,"i",iatsc_s,iatsc_e
         itypi=iabs(itype(i))
         if (itypi.eq.ntyp1) cycle
         itypi1=iabs(itype(i+1))
@@ -891,6 +892,8 @@ C     &                        'evdw',i,j,evdwij,'tss',evdw,evdw_t
              enddo! k
             ELSE
             ind=ind+1
+C            write(iout,*) j,"j",istart(i,iint),iend(i,iint)
+
             itypj=iabs(itype(j))
             if (itypj.eq.ntyp1) cycle
             dscj_inv=vbld_inv(j+nres)
@@ -1955,7 +1958,7 @@ C 13-go grudnia roku pamietnego...
       double precision unmat(3,3) /1.0d0,0.0d0,0.0d0,
      &                   0.0d0,1.0d0,0.0d0,
      &                   0.0d0,0.0d0,1.0d0/
-cd      write(iout,*) 'In EELEC'
+      write(iout,*) 'In EELEC'
 cd      do i=1,nloctyp
 cd        write(iout,*) 'Type',i
 cd        write(iout,*) 'B1',B1(:,i)
@@ -2013,15 +2016,16 @@ C      write (iout,*) 'iatel_s=',iatel_s,' iatel_e=',iatel_e
         gcorr_loc(i)=0.0d0
       enddo
       do i=iatel_s,iatel_e
-          if (i.eq.1) then 
-           if (itype(i).eq.ntyp1.or. itype(i+1).eq.ntyp1
-     &  .or. itype(i+2).eq.ntyp1) cycle
-          else
+          write (iout,*) i,"i2",itype(i)
+          if (i.eq.1) cycle 
+C           if (itype(i).eq.ntyp1.or. itype(i+1).eq.ntyp1
+C     &  .or. itype(i+2).eq.ntyp1) cycle
+C          else
         if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1
      &  .or. itype(i+2).eq.ntyp1
      &  .or. itype(i-1).eq.ntyp1
      &) cycle
-         endif
+C         endif
         if (itel(i).eq.0) goto 1215
         dxi=dc(1,i)
         dyi=dc(2,i)
@@ -2041,6 +2045,8 @@ C      write (iout,*) 'iatel_s=',iatel_s,' iatel_e=',iatel_e
         num_conti=0
 C        write (iout,*) 'i',i,' ielstart',ielstart(i),' ielend',ielend(i)
         do j=ielstart(i),ielend(i)
+C           write(iout,*) j,"j2"
+
           if (j.eq.1) then
            if (itype(j).eq.ntyp1 .or. itype(j+1).eq.ntyp1
      & .or.itype(j+2).eq.ntyp1
@@ -2051,6 +2057,7 @@ C        write (iout,*) 'i',i,' ielstart',ielstart(i),' ielend',ielend(i)
      & .or.itype(j-1).eq.ntyp1
      &) cycle
          endif
+C           write(iout,*) j,"j2"
 C
 C) cycle
           if (itel(j).eq.0) goto 1216
@@ -2844,7 +2851,7 @@ C Cartesian derivatives
      &      +0.5d0*(pizda(1,1)+pizda(2,2))
         enddo
         endif
-      else if (j.eq.i+3 .and. itype(i+2).ne.ntyp1) then
+      else if (j.eq.i+3 .and. itype(i+2).ne.ntyp1.and.(i.gt.1)) then
       if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1
 C changes suggested by Ana to avoid out of bounds
      & .or.((i+5).gt.nres)
@@ -3682,7 +3689,7 @@ c     &    rad2deg*phii,rad2deg*phii1,ethetai
 c 1215   continue
       enddo
       ethetacnstr=0.0d0
-C      print *,ithetaconstr_start,ithetaconstr_end,"TU"
+      print *,ntheta_constr,"TU"
       do i=1,ntheta_constr
         itheta=itheta_constr(i)
         thetiii=theta(itheta)
@@ -3706,7 +3713,7 @@ C     &    i,itheta,rad2deg*thetiii,
 C     &    rad2deg*theta_constr0(i),  rad2deg*theta_drange(i),
 C     &    rad2deg*difi,0.25d0*for_thet_constr(i)*difi**4,
 C     &    gloc(itheta+nphi-2,icg)
-        endif
+C        endif
       enddo
 C Ufff.... We've done all this!!! 
       return