include 'COMMON.TIME1'
include 'COMMON.MD'
double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
- &time01
+ &,time01,zcopy(dimen3)
#ifdef MPI
if (nfgtasks.gt.1) then
if (fg_rank.eq.0) then
time00=MPI_Wtime()
call MPI_Scatterv(z,ng_counts(0),ng_start(0),
& MPI_DOUBLE_PRECISION,
- & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ do i=1,3*my_ng_count
+ z(i)=zcopy(i)
+ enddo
c write (2,*) "My chunk of z"
c do i=1,3*my_ng_count
c write (2,*) i,z(i)
include 'COMMON.LANGEVIN.lang0'
#endif
double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
- &time01
+ &,time01,zcopy(dimen3)
#ifdef MPI
if (nfgtasks.gt.1) then
if (fg_rank.eq.0) then
time00=MPI_Wtime()
call MPI_Scatterv(z,ng_counts(0),ng_start(0),
& MPI_DOUBLE_PRECISION,
- & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+
+ do i=1,3*my_ng_count
+ z(i)=zcopy(i)
+ enddo
c write (2,*) "My chunk of z"
c do i=1,3*my_ng_count
c write (2,*) i,z(i)
& gvdwpp,gel_loc,gel_loc_long,gvdwc_scpp,
& gradx_scp,gvdwc_scp,ghpbx,ghpbc,gloc,gloc_x,dtheta,dphi,dalpha,
& domega,gscloc,gsclocx,gradcorr,gradcorr_long,gradcorr5_long,
- & gradcorr6_long,gcorr6_turn_long,gvdwcT,gvdwxT,gvdwx
+ & gradcorr6_long,gcorr6_turn_long,gvdwcT,gvdwxT,gvdwx,gloc_sc,
+ & dcostau,dsintau,dtauangle,dcosomicron,
+ & domicron
integer nfl,icg
common /derivatT/ gvdwcT(3,maxres),gvdwxT(3,maxres)
common /derivat/ dcdv(6,maxdim),dxdv(6,maxdim),dxds(6,maxres),
& gel_loc_turn4(maxvar),gel_loc_turn6(maxvar),gcorr_loc(maxvar),
& g_corr5_loc(maxvar),g_corr6_loc(maxvar),gsccorc(3,maxres),
& gsccorx(3,maxres),gsccor_loc(maxres),dtheta(3,2,maxres),
- & gscloc(3,maxres),gsclocx(3,maxres),
+ & gscloc(3,maxres),gsclocx(3,maxres),gloc_sc(3,0:maxres2,10),
+ & dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
+ & dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
+ & domicron(3,3,3,maxres2),
& dphi(3,3,maxres),dalpha(3,3,maxres),domega(3,3,maxres),nfl,icg
double precision derx,derx_turn
common /deriv_loc/ derx(3,5,2),derx_turn(3,5,2)
cc Parameters of the SCCOR term
double precision v1sccor,v2sccor,vlor1sccor,
- & vlor2sccor,vlor3sccor,gloc_sc,
- & dcostau,dsintau,dtauangle,dcosomicron,
- & domicron,v0sccor
+ & vlor2sccor,vlor3sccor,v0sccor
+C,gloc_sc,
+C & dcostau,dsintau,dtauangle,dcosomicron,
+C & domicron,v0sccor
integer nterm_sccor,isccortyp,nsccortyp,nlor_sccor
common/sccor/v1sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
& v2sccor(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp),
- & v0sccor(maxterm_sccor,-ntyp:ntyp),
+ & v0sccor(-ntyp:ntyp,-ntyp:ntyp),
& nterm_sccor(-ntyp:ntyp,-ntyp:ntyp),isccortyp(-ntyp:ntyp),
& nsccortyp,
& nlor_sccor(-ntyp:ntyp,-ntyp:ntyp),
& vlor1sccor(maxterm_sccor,20,20),
& vlor2sccor(maxterm_sccor,20,20),
- & vlor3sccor(maxterm_sccor,20,20),gloc_sc(3,0:maxres2,10),
- & dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
- & dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
- & domicron(3,3,3,maxres2)
+ & vlor3sccor(maxterm_sccor,20,20)
+C,gloc_sc(3,0:maxres2,10),
+C & dcostau(3,3,3,maxres2),dsintau(3,3,3,maxres2),
+C & dtauangle(3,3,3,maxres2),dcosomicron(3,3,3,maxres2),
+C & domicron(3,3,3,maxres2)
c call intcartderiv
c call checkintcartgrad
call zerograd
- aincr=1.0D-5
+ aincr=1.0D-6
write(iout,*) 'Calling CHECK_ECARTINT.'
nf=0
icall=0
tauangle(1,i+1)=beta(i-1+nres,i-1,i,i+1)
omicron(1,i)=alpha(i-2,i-1,i-1+nres)
omicron(2,i)=alpha(i-1+nres,i-1,i)
+C print *,i,omicron(1,i),omicron(2,i)
endif
if (itype(i).ne.10) then
tauangle(2,i+1)=beta(i-2,i-1,i,i+nres)
C Loop over i,i+2 and i,i+3 pairs of the peptide groups
C
do i=iturn3_start,iturn3_end
+C if (itype(i).eq.21 .or. itype(i+1).eq.21
+C & .or. itype(i+2).eq.21 .or. itype(i+3).eq.21.or.itype(i+4).eq.21)
+C & cycle
dxi=dc(1,i)
dyi=dc(2,i)
dzi=dc(3,i)
num_cont_hb(i)=num_conti
enddo
do i=iturn4_start,iturn4_end
+C if (itype(i).eq.21 .or. itype(i+1).eq.21
+C & .or. itype(i+2).eq.21 .or. itype(i+3).eq.21.or.itype(i+4).eq.21
+C & .or. itype(i+5).eq.21)
+C & cycle
dxi=dc(1,i)
dyi=dc(2,i)
dzi=dc(3,i)
c Loop over all pairs of interacting peptide groups except i,i+2 and i,i+3
c
do i=iatel_s,iatel_e
+C if (itype(i).eq.21 .or. itype(i+1).eq.21
+C &.or.itype(i+2)) cycle
dxi=dc(1,i)
dyi=dc(2,i)
dzi=dc(3,i)
c write (iout,*) 'i',i,' ielstart',ielstart(i),' ielend',ielend(i)
num_conti=num_cont_hb(i)
do j=ielstart(i),ielend(i)
+C if (itype(j).eq.21 .or. itype(j+1).eq.21
+C &.or.itype(j+2)) cycle
call eelecij(i,j,ees,evdw1,eel_loc)
enddo ! j
num_cont_hb(i)=num_conti
c write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
esccor=0.0D0
do i=itau_start,itau_end
+C do i=42,42
esccor_ii=0.0D0
if ((itype(i-2).eq.ntyp1).or.(itype(i-1).eq.ntyp1)) cycle
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)
-
+C print *,i,tauangle(1,i)
do intertyp=1,3 !intertyp
cc Added 09 May 2012 (Adasko)
esccor=esccor+v1ij*cosphi+v2ij*sinphi
gloci=gloci+j*(v2ij*cosphi-v1ij*sinphi)
enddo
+C print *,i,tauangle(1,i),gloci
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)
iphi_end=iturn3_end+2
iturn3_start=iturn3_start-1
iturn3_end=iturn3_end-1
- call int_bounds(nres-3,itau_start,itau_end)
- itau_start=itau_start+3
- itau_end=itau_end+3
+ call int_bounds(nres-2,itau_start,itau_end)
+ itau_start=itau_start+2
+ itau_end=itau_end+2
call int_bounds(nres-3,iphi1_start,iphi1_end)
iphi1_start=iphi1_start+3
iphi1_end=iphi1_end+3
idihconstr_end=ndih_constr
iphid_start=iphi_start
iphid_end=iphi_end-1
- itau_start=4
+ itau_start=3
itau_end=nres
ibond_start=2
ibond_end=nres-1
do i=3,nres
#endif
cost=dcos(theta(i))
- sint=sqrt(1-cost*cost)
+ sint=dsqrt(1-cost*cost)
do j=1,3
dcostheta(j,1,i)=-(dc_norm(j,i-1)+cost*dc_norm(j,i-2))/
& vbld(i-1)
#endif
if ((itype(i-1).ne.10).and.(itype(i-1).ne.21)) then
cost1=dcos(omicron(1,i))
- sint1=sqrt(1-cost1*cost1)
+ sint1=dsqrt(1-cost1*cost1)
cost2=dcos(omicron(2,i))
- sint2=sqrt(1-cost2*cost2)
+ sint2=dsqrt(1-cost2*cost2)
do j=1,3
CC Calculate derivative over first omicron (Cai-2,Cai-1,SCi-1)
dcosomicron(j,1,1,i)=-(dc_norm(j,i-1+nres)+
endif
enddo
- do i=1,nres-1
+ do i=1,nres
do j=1,3
dc_norm2(j,i+nres)=-dc_norm(j,i+nres)
enddo
dcostau(j,1,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
& dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1)-scalp*
& (dc_norm2(j,i-2+nres)))/vbld(i-2+nres)
- dtauangle(j,1,1,i)=-1/sing*dcostau(j,1,1,i)
+ dtauangle(j,1,1,i)=-1.0d0/sing*dcostau(j,1,1,i)
dcostau(j,1,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
& dcostheta(j,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
& dcostheta(j,1,i)
- dtauangle(j,1,2,i)=-1/sing*dcostau(j,1,2,i)
+ dtauangle(j,1,2,i)=-1.0d0/sing*dcostau(j,1,2,i)
dcostau(j,1,3,i)=fac2*dcostheta(j,2,i)+fac4*
& dcostheta(j,2,i)-fac0*(-dc_norm(j,i-2+nres)-scalp*
& dc_norm(j,i-1))/vbld(i)
- dtauangle(j,1,3,i)=-1/sing*dcostau(j,1,3,i)
+ dtauangle(j,1,3,i)=-1.0d0/sing*dcostau(j,1,3,i)
c write (iout,*) "else",i
enddo
endif
dcostau(j,2,1,i)=fac1*dcostheta(j,1,i-1)+fac3*
& dcostheta(j,1,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
& dc_norm(j,i-3))/vbld(i-2)
- dtauangle(j,2,1,i)=-1/sing*dcostau(j,2,1,i)
+ dtauangle(j,2,1,i)=-1.0d0/sing*dcostau(j,2,1,i)
dcostau(j,2,2,i)=fac1*dcostheta(j,2,i-1)+fac2*
& dcosomicron(j,1,1,i)+fac3*dcostheta(j,2,i-1)+fac4*
& dcosomicron(j,1,1,i)
- dtauangle(j,2,2,i)=-1/sing*dcostau(j,2,2,i)
+ dtauangle(j,2,2,i)=-1.0d0/sing*dcostau(j,2,2,i)
dcostau(j,2,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
& dcosomicron(j,1,2,i)-fac0*(dc_norm(j,i-3)-scalp*
& dc_norm(j,i-1+nres))/vbld(i-1+nres)
- dtauangle(j,2,3,i)=-1/sing*dcostau(j,2,3,i)
+ dtauangle(j,2,3,i)=-1.0d0/sing*dcostau(j,2,3,i)
c write(iout,*) i,j,"else", dtauangle(j,2,3,i)
enddo
endif
dcostau(j,3,1,i)=fac1*dcosomicron(j,2,2,i-1)+fac3*
& dcosomicron(j,2,2,i-1)-fac0*(dc_norm(j,i-1+nres)-scalp*
& dc_norm2(j,i-2+nres))/vbld(i-2+nres)
- dtauangle(j,3,1,i)=-1/sing*dcostau(j,3,1,i)
+ dtauangle(j,3,1,i)=-1.0d0/sing*dcostau(j,3,1,i)
dcostau(j,3,2,i)=fac1*dcosomicron(j,2,1,i-1)+fac2*
& dcosomicron(j,1,1,i)+fac3*dcosomicron(j,2,1,i-1)+fac4*
& dcosomicron(j,1,1,i)
- dtauangle(j,3,2,i)=-1/sing*dcostau(j,3,2,i)
+ dtauangle(j,3,2,i)=-1.0d0/sing*dcostau(j,3,2,i)
dcostau(j,3,3,i)=fac2*dcosomicron(j,1,2,i)+fac4*
& dcosomicron(j,1,2,i)-fac0*(dc_norm2(j,i-2+nres)-scalp*
& dc_norm(j,i-1+nres))/vbld(i-1+nres)
- dtauangle(j,3,3,i)=-1/sing*dcostau(j,3,3,i)
+ dtauangle(j,3,3,i)=-1.0d0/sing*dcostau(j,3,3,i)
c write(iout,*) "else",i
enddo
endif
include 'COMMON.TIME1'
include 'COMMON.MD'
double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
- &time01
+ &,time01,zcopy(dimen3)
#ifdef MPI
if (nfgtasks.gt.1) then
if (fg_rank.eq.0) then
time00=MPI_Wtime()
call MPI_Scatterv(z,ng_counts(0),ng_start(0),
& MPI_DOUBLE_PRECISION,
- & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ do i=1,3*my_ng_count
+ z(i)=zcopy(i)
+ enddo
c write (2,*) "My chunk of z"
c do i=1,3*my_ng_count
c write (2,*) i,z(i)
include 'COMMON.LANGEVIN.lang0'
#endif
double precision z(dimen3),d_a_tmp(dimen3),temp(maxres6),time00
- &time01
+ &,time01,zcopy(dimen3)
#ifdef MPI
if (nfgtasks.gt.1) then
if (fg_rank.eq.0) then
time00=MPI_Wtime()
call MPI_Scatterv(z,ng_counts(0),ng_start(0),
& MPI_DOUBLE_PRECISION,
- & z,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+ & zcopy,3*my_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERR)
+
+ do i=1,3*my_ng_count
+ z(i)=zcopy(i)
+ enddo
c write (2,*) "My chunk of z"
c do i=1,3*my_ng_count
c write (2,*) i,z(i)
print *,'icheckgrad=',icheckgrad
goto (10,20,30) icheckgrad
10 call check_ecartint
+ call check_ecartint
return
20 call check_cartgrad
return