C
do iint=1,nint_gr(i)
do j=istart(i,iint),iend(i,iint)
+c write (iout,*) "i",i," j", j," itype",itype(i),itype(j)
+c call flush(iout)
ind=ind+1
itypj=itype(j)
if (itypj.eq.ntyp1) cycle
c dscj_inv=dsc_inv(itypj)
dscj_inv=vbld_inv(j+nres)
-c write (iout,*) "j",j,dsc_inv(itypj),dscj_inv,
+c write (iout,*) "j",j,itypi,itypj,dsc_inv(itypj),dscj_inv,
c & 1.0d0/vbld(j+nres)
-c write (iout,*) "i",i," j", j," itype",itype(i),itype(j)
+c call flush(iout)
sig0ij=sigma(itypi,itypj)
chi1=chi(itypi,itypj)
chi2=chi(itypj,itypi)
yj=mod(yj,boxysize)
if (yj.lt.0) yj=yj+boxysize
zj=mod(zj,boxzsize)
+c write (iout,*) "After box"
+c call flush(iout)
if (zj.lt.0) zj=zj+boxzsize
if ((zj.gt.bordlipbot)
&.and.(zj.lt.bordliptop)) then
sslipj=0.0d0
ssgradlipj=0.0
endif
+c write (iout,*) "After lipid"
+c call flush(iout)
aa=aa_lip(itypi,itypj)*(sslipi+sslipj)/2.0d0
& +aa_aq(itypi,itypj)*(2.0d0-sslipi+sslipj)/2.0d0
bb=bb_lip(itypi,itypj)*(sslipi+sslipj)/2.0d0
C Calculate angle-dependent terms of energy and contributions to their
C derivatives.
call sc_angular
+c write (iout,*) "After sc_angular"
+c call flush(iout)
sigsq=1.0D0/sigsq
sig=sig0ij*dsqrt(sigsq)
rij_shift=1.0D0/rij-sig+sig0ij
C I hate to put IF's in the loops, but here don't have another choice!!!!
if (rij_shift.le.0.0D0) then
evdw=1.0D20
-cd write (iout,'(2(a3,i3,2x),17(0pf7.3))')
-cd & restyp(itypi),i,restyp(itypj),j,
-cd & rij_shift,1.0D0/rij,sig,sig0ij,sigsq,1-dsqrt(sigsq)
+c write (iout,'(2(a3,i3,2x),17(0pf7.3))')
+c & restyp(itypi),i,restyp(itypj),j,
+c & rij_shift,1.0D0/rij,sig,sig0ij,sigsq,1-dsqrt(sigsq)
return
endif
sigder=-sig*sigsq
eps3der=evdwij*eps2rt
c write (iout,*) "sigsq",sigsq," sig",sig," eps2rt",eps2rt,
c & " eps3rt",eps3rt," eps1",eps1," e1",e1," e2",e2
+c call flush(iout)
evdwij=evdwij*eps2rt*eps3rt
evdw=evdw+evdwij*sss
if (lprn) then
& eps1,eps2rt**2,eps3rt**2,sig,sig0ij,
& om1,om2,om12,1.0D0/rij,1.0D0/rij_shift,
& evdwij
+ call flush(iout)
endif
- if (energy_dec) write (iout,'(a6,2i5,0pf7.3)')
- & 'evdw',i,j,evdwij
+ if (energy_dec) then
+ write (iout,'(a6,2i5,0pf7.3)') 'evdw',i,j,evdwij
+ call flush(iout)
+ endif
C Calculate gradient components.
e1=e1*eps1*eps2rt**2*eps3rt**2
gg(3)=zj*fac
gg_lipi(3)=ssgradlipi*evdwij
gg_lipj(3)=ssgradlipj*evdwij
+c write (iout,*) "Calling sc_grad_scale"
+c call flush(iout)
C Calculate angular part of the gradient.
call sc_grad_scale(sss)
+c write (iout,*) "After sc_grad_scale"
+c call flush(iout)
endif
enddo ! j
enddo ! iint
include 'COMMON.IOUNITS'
double precision dcosom1(3),dcosom2(3)
double precision scalfac
+c write (iout,*) "sc_grad_scale",i,j,k,l
+c call flush(iout)
eom1=eps2der*eps2rt_om1-2.0D0*alf1*eps3der+sigder*sigsq_om1
eom2=eps2der*eps2rt_om2+2.0D0*alf2*eps3der+sigder*sigsq_om2
eom12=evdwij*eps1_om12+eps2der*eps2rt_om12
C Calculate the components of the gradient in DC and X
C
do l=1,3
- gvdwc(l,i)=gvdwc(l,i)-gg(l)+gg_lipi(k)
- gvdwc(l,j)=gvdwc(l,j)+gg(l)+gg_lipj(k)
+ gvdwc(l,i)=gvdwc(l,i)-gg(l)+gg_lipi(l)
+ gvdwc(l,j)=gvdwc(l,j)+gg(l)+gg_lipj(l)
enddo
return
end