c write (iout,*) 'theta=', theta(i-1)
enddo
#else
+ if (i.gt. nnt+2 .and. i.lt.nct+2) then
+ iti = itortyp(itype(i-2))
+ else
+ iti=ntortyp+1
+ endif
+c if (i.gt. iatel_s+1 .and. i.lt.iatel_e+4) then
+ if (i.gt. nnt+1 .and. i.lt.nct+1) then
+ iti1 = itortyp(itype(i-1))
+ else
+ iti1=ntortyp+1
+ endif
b1(1,i-2)=b(3,iti)
b1(2,i-2)=b(5,iti)
b2(1,i-2)=b(2,iti)
do k=1,2
mu(k,i-2)=Ub2(k,i-2)+b1(k,i-1)
enddo
+C write (iout,*) 'mumu',i,b1(1,i-1),Ub2(1,i-2)
c write (iout,*) 'mu ',mu(:,i-2),i-2
cd write (iout,*) 'mu1',mu1(:,i-2)
cd write (iout,*) 'mu2',mu2(:,i-2)
& +a33*muij(4)
c write (iout,*) 'i',i,' j',j,itype(i),itype(j),
c & ' eel_loc_ij',eel_loc_ij
-c write(iout,*) 'muije=',muij(1),muij(2),muij(3),muij(4)
+C write(iout,*) 'muije=',i,j,muij(1),muij(2),muij(3),muij(4)
C Calculate patrial derivative for theta angle
#ifdef NEWCORR
geel_loc_ij=a22*gmuij1(1)
& +aa_aq(itypi,itypj)*(2.0d0-sslipi-sslipj)/2.0d0
bb=bb_lip(itypi,itypj)*(sslipi+sslipj)/2.0d0
& +bb_aq(itypi,itypj)*(2.0d0-sslipi-sslipj)/2.0d0
- write(iout,*),aa,aa_lip(itypi,itypj),aa_aq(itypi,itypj)
+C write(iout,*),aa,aa_lip(itypi,itypj),aa_aq(itypi,itypj)
C checking the distance
dist_init=(xj-xi)**2+(yj-yi)**2+(zj-zi)**2
xj_safe=xj
do k=1,2
mu(k,i-2)=Ub2(k,i-2)+b1(k,iti1)
enddo
+C write (iout,*) 'mumu',i,b1(1,iti),Ub2(1,i-2)
+
C Vectors and matrices dependent on a single virtual-bond dihedral.
call matvec2(DD(1,1,iti),b1tilde(1,iti1),auxvec(1))
call matvec2(Ug2(1,1,i-2),auxvec(1),Ug2Db1t(1,i-2))
eel_loc_ij=a22*muij(1)+a23*muij(2)+a32*muij(3)
& +a33*muij(4)
c write (iout,*) 'i',i,' j',j,' eel_loc_ij',eel_loc_ij
-c write (iout,'(a6,2i5,0pf7.3)')
-c & 'eelloc',i,j,eel_loc_ij
+C write (iout,'(a6,2i5,0pf7.3)')
+C & 'eelloc',i,j,eel_loc_ij
+C write(iout,*) 'muije=',i,j,muij(1),muij(2),muij(3),muij(4)
c write (iout,*) a22,muij(1),a23,muij(2),a32,muij(3)
eel_loc=eel_loc+eel_loc_ij
C Partial derivatives in virtual-bond dihedral angles gamma
enddo
endif
else if (j.eq.i+3 .and. itype(i+2).ne.ntyp1) 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)
+ & .or.((i-1).le.0)
+C end of changes suggested by Ana
+ & .or. itype(i+3).eq.ntyp1
+ & .or. itype(i+4).eq.ntyp1
+ & .or. itype(i+5).eq.ntyp1
+ & .or. itype(i).eq.ntyp1
+ & .or. itype(i-1).eq.ntyp1) goto 178
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C Fourth-order contributions
gcorr4_turn(l,j1)=gcorr4_turn(l,j1)-(s1+s2+s3)
enddo
endif
+ 178 continue
endif
return
end