& max_gs_size,kolor,koniec,WhatsUp,ifinish,CG_COMM,FG_COMM,
& FG_COMM1,CONT_FROM_COMM,CONT_TO_COMM,lentyp
integer MPI_UYZ,MPI_UYZGRAD,MPI_MU,MPI_MAT1,MPI_MAT2,
- & MPI_THET,MPI_GAM,
+ & MPI_THET,MPI_GAM,MPI_I50,MPI_SHI,
& MPI_ROTAT1(0:1),MPI_ROTAT2(0:1),MPI_ROTAT_OLD(0:1),
& MPI_PRECOMP11(0:1),MPI_PRECOMP12(0:1),MPI_PRECOMP22(0:1),
& MPI_PRECOMP23(0:1)
common /types/ MPI_UYZ,MPI_UYZGRAD,MPI_MU,MPI_MAT1,MPI_MAT2,
- & MPI_THET,MPI_GAM,
+ & MPI_THET,MPI_GAM,MPI_I50,MPI_SHI,
& MPI_ROTAT1,MPI_ROTAT2,MPI_ROTAT_OLD,MPI_PRECOMP11,MPI_PRECOMP12,
& MPI_PRECOMP22,MPI_PRECOMP23
common /shield/ VSolvSphere,VSolvSphere_div,buff_shield,
& long_r_sidechain(ntyp),
& short_r_sidechain(ntyp),fac_shield(maxres),wshield,
- & grad_shield_side(3,maxcont,-1:maxres),grad_shield(3,-1:maxres),
- & grad_shield_loc(3,maxcont,-1:maxres),
- & ishield_list(maxres),shield_list(maxcont,maxres),
- & ees0plist(maxcont,maxres)
+ & grad_shield_side(3,maxcontsshi,-1:maxres),
+ & grad_shield(3,-1:maxres),
+ & grad_shield_loc(3,maxcontsshi,-1:maxres),
+ & ishield_list(maxres),shield_list(maxcontsshi,maxres),
+ & ees0plist(maxconts,maxres)
integer maxcont
parameter (maxcont=12*maxres)
C Max. number of contacts per residue
- integer maxconts
+ integer maxconts,maxcontsshi
parameter (maxconts=maxres)
-c parameter (maxconts=50)
+ parameter (maxcontsshi=50)
C Number of AA types (at present only natural AA's will be handled
integer ntyp,ntyp1
parameter (ntyp=24,ntyp1=ntyp+1)
do i=iturn3_start,iturn3_end
if (itype(i).eq.ntyp1.or. itype(i+1).eq.ntyp1
& .or. itype(i+2).eq.ntyp1 .or. itype(i+3).eq.ntyp1
- & .or. itype(i-1).eq.ntyp1
- & .or. itype(i+4).eq.ntyp1
+C & .or. itype(i-1).eq.ntyp1
+C & .or. itype(i+4).eq.ntyp1
& ) cycle
dxi=dc(1,i)
dyi=dc(2,i)
if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1
& .or. itype(i+3).eq.ntyp1
& .or. itype(i+4).eq.ntyp1
- & .or. itype(i+5).eq.ntyp1
- & .or. itype(i-1).eq.ntyp1
+C & .or. itype(i+5).eq.ntyp1
+C & .or. itype(i-1).eq.ntyp1
& ) cycle
dxi=dc(1,i)
dyi=dc(2,i)
c
do i=iatel_s,iatel_e
if (itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1
- & .or. itype(i+2).eq.ntyp1
- & .or. itype(i-1).eq.ntyp1
+C & .or. itype(i+2).eq.ntyp1
+C & .or. itype(i-1).eq.ntyp1
&) cycle
dxi=dc(1,i)
dyi=dc(2,i)
num_conti=num_cont_hb(i)
do j=ielstart(i),ielend(i)
if (itype(j).eq.ntyp1 .or. itype(j+1).eq.ntyp1
- & .or.itype(j+2).eq.ntyp1
- & .or.itype(j-1).eq.ntyp1
+C & .or.itype(j+2).eq.ntyp1
+C & .or.itype(j-1).eq.ntyp1
&) cycle
call eelecij_scale(i,j,ees,evdw1,eel_loc)
enddo ! j
#ifdef MPI
include "mpif.h"
double precision weights_(n_ene)
+ integer IERR
+ integer status(MPI_STATUS_SIZE)
#endif
include 'COMMON.SETUP'
include 'COMMON.IOUNITS'
include 'COMMON.CONTROL'
include 'COMMON.TIME1'
include 'COMMON.SPLITELE'
+ include 'COMMON.SHIELD'
#ifdef MPI
c print*,"ETOTAL Processor",fg_rank," absolute rank",myrank,
c & " nfgtasks",nfgtasks
call set_shield_fac
else if (shield_mode.eq.2) then
call set_shield_fac2
+ if (nfgtasks.gt.1) then
+C#define DEBUG
+#ifdef DEBUG
+ write(iout,*) "befor reduce fac_shield reduce"
+ do i=1,nres
+ write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+ write(2,*) "list", shield_list(1,i),ishield_list(i),
+ & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+ enddo
+#endif
+ call MPI_Allgatherv(fac_shield(ivec_start),ivec_count(fg_rank1),
+ & MPI_DOUBLE_PRECISION,fac_shield(1),ivec_count(0),ivec_displ(0),
+ & MPI_DOUBLE_PRECISION,FG_COMM,IERR)
+ call MPI_Allgatherv(shield_list(1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_I50,shield_list(1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_I50,FG_COMM,IERR)
+ call MPI_Allgatherv(ishield_list(ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_INTEGER,ishield_list(1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_INTEGER,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield(1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_UYZ,grad_shield(1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_UYZ,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield_side(1,1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_SHI,grad_shield_side(1,1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_SHI,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield_loc(1,1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_SHI,grad_shield_loc(1,1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_SHI,FG_COMM,IERR)
+#ifdef DEBUG
+ write(iout,*) "after reduce fac_shield reduce"
+ do i=1,nres
+ write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+ write(2,*) "list", shield_list(1,i),ishield_list(i),
+ & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+ enddo
+#endif
+C#undef DEBUG
+ endif
+#ifdef DEBUG
+ do i=1,nres
+ write(iout,*) fac_shield(i),ishield_list(i),i,grad_shield(1,i)
+ do j=1,ishield_list(i)
+ write(iout,*) "grad", grad_shield_side(1,j,i),
+ & grad_shield_loc(1,j,i)
+ enddo
+ enddo
+#endif
endif
c print *,"Processor",myrank," left VEC_AND_DERIV"
if (ipot.lt.6) then
C print *,"przed lipidami"
if (wliptran.gt.0) then
call Eliptransfer(eliptran)
+ else
+ eliptran=0.0d0
endif
C print *,"za lipidami"
if (AFMlog.gt.0) then
time00=MPI_Wtime()
call MPI_Reduce(enebuff(0),energia(0),n_ene+1,
& MPI_DOUBLE_PRECISION,MPI_SUM,king,FG_COMM,IERR)
-#ifdef DEBUG
+C#ifdef DEBUG
write (iout,*) "energies after REDUCE"
call enerprint(energia)
call flush(iout)
-#endif
+C#endif
time_Reduce=time_Reduce+MPI_Wtime()-time00
endif
if (fg_rank.eq.0) then
C fac_shield(i)=0.4
C fac_shield(j)=0.6
endif
+C if (j.eq.78)
+C & write(iout,*) i,j,fac_shield(i),fac_shield(j)
eello_turn3=eello_turn3+0.5d0*(pizda(1,1)+pizda(2,2))
& *fac_shield(i)*fac_shield(j)
eello_t3=0.5d0*(pizda(1,1)+pizda(2,2))
& *fac_shield(i)*fac_shield(j)
-C#ifdef NEWCORR
+#ifdef NEWCORR
C Derivatives in theta
gloc(nphi+i,icg)=gloc(nphi+i,icg)
& +0.5d0*(gpizda1(1,1)+gpizda1(2,2))*wturn3
gloc(nphi+i+1,icg)=gloc(nphi+i+1,icg)
& +0.5d0*(gpizda2(1,1)+gpizda2(2,2))*wturn3
& *fac_shield(i)*fac_shield(j)
-C#endif
+#endif
C if (energy_dec) write (iout,'(a6,2i5,0pf7.3)')
C Derivatives in shield mode
include 'COMMON.IOUNITS'
include 'COMMON.SHIELD'
include 'COMMON.INTERACT'
+ include 'COMMON.LOCAL'
+
C this is the squar root 77 devided by 81 the epislion in lipid (in protein)
double precision div77_81/0.974996043d0/,
&div4_81/0.2222222222d0/,sh_frac_dist_grad(3)
-
+
C the vector between center of side_chain and peptide group
double precision pep_side(3),long,side_calf(3),
&pept_group(3),costhet_grad(3),cosphi_grad_long(3),
&cosphi_grad_loc(3),pep_side_norm(3),side_calf_norm(3)
+C write(2,*) "ivec",ivec_start,ivec_end
+ do i=1,nres
+ fac_shield(i)=0.0d0
+ do j=1,3
+ grad_shield(j,i)=0.0d0
+ enddo
+ enddo
C the line belowe needs to be changed for FGPROC>1
- do i=iatscp_s,iatscp_e
+ do i=ivec_start,ivec_end
C do i=1,nres-1
- if ((itype(i).eq.ntyp1).and.itype(i+1).eq.ntyp1) cycle
+C if ((itype(i).eq.ntyp1).and.itype(i+1).eq.ntyp1) cycle
ishield_list(i)=0
+ if ((itype(i).eq.ntyp1).and.itype(i+1).eq.ntyp1) cycle
Cif there two consequtive dummy atoms there is no peptide group between them
C the line below has to be changed for FGPROC>1
VolumeTotal=0.0
C print *,buff_shield,"buff"
C now sscale
if (sh_frac_dist.le.0.0) cycle
+C print *,ishield_list(i),i
C If we reach here it means that this side chain reaches the shielding sphere
C Lets add him to the list for gradient
ishield_list(i)=ishield_list(i)+1
VolumeTotal=VolumeTotal+VofOverlap*scale_fac_dist
enddo
fac_shield(i)=VolumeTotal*wshield+(1.0d0-wshield)
-C write(2,*) "TOTAL VOLUME",i,VolumeTotal,fac_shield(i)
+C write(2,*) "TOTAL VOLUME",i,itype(i),fac_shield(i)
enddo
return
end
C for UNRES
do i=1,nres
C lets ommit dummy atoms for now
+
if ((itype(i).eq.ntyp1).or.(itype(i+1).eq.ntyp1)) cycle
C now calculate distance from center of tube and direction vectors
vectube(1)=mod((c(1,i)+c(1,i+1))/2.0d0,boxxsize)
include 'COMMON.LOCAL'
include 'COMMON.MD'
include 'COMMON.CONTROL'
+ include 'COMMON.SHIELD'
c write(iout,'(a,i2)')'Calling etotal_long ipot=',ipot
if (modecalc.eq.12.or.modecalc.eq.14) then
#ifdef MPI
C
107 continue
call vec_and_deriv
- if (shield_mode.gt.0) then
+ if (shield_mode.eq.1) then
call set_shield_fac
+ else if (shield_mode.eq.2) then
+ call set_shield_fac2
+ if (nfgtasks.gt.1) then
+C#define DEBUG
+#ifdef DEBUG
+ write(iout,*) "befor reduce fac_shield reduce"
+ do i=1,nres
+ write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+ write(2,*) "list", shield_list(1,i),ishield_list(i),
+ & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+ enddo
+#endif
+ call MPI_Allgatherv(fac_shield(ivec_start),ivec_count(fg_rank1),
+ & MPI_DOUBLE_PRECISION,fac_shield(1),ivec_count(0),ivec_displ(0),
+ & MPI_DOUBLE_PRECISION,FG_COMM,IERR)
+ call MPI_Allgatherv(shield_list(1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_I50,shield_list(1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_I50,FG_COMM,IERR)
+ call MPI_Allgatherv(ishield_list(ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_INTEGER,ishield_list(1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_INTEGER,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield(1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_UYZ,grad_shield(1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_UYZ,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield_side(1,1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_SHI,grad_shield_side(1,1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_SHI,FG_COMM,IERR)
+ call MPI_Allgatherv(grad_shield_loc(1,1,ivec_start),
+ & ivec_count(fg_rank1),
+ & MPI_SHI,grad_shield_loc(1,1,1),ivec_count(0),
+ & ivec_displ(0),
+ & MPI_SHI,FG_COMM,IERR)
+#ifdef DEBUG
+ write(iout,*) "after reduce fac_shield reduce"
+ do i=1,nres
+ write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+ write(2,*) "list", shield_list(1,i),ishield_list(i),
+ & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+ enddo
+#endif
+C#undef DEBUG
endif
+ endif
if (ipot.lt.6) then
#ifdef SPLITELE
if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
energia(10)=eturn6
energia(20)=Uconst+Uconst_back
call sum_energy(energia,.true.)
-c write (iout,*) "Exit ETOTAL_LONG"
+C call enerprint
+ write (iout,*) "Exit ETOTAL_LONG"
call flush(iout)
return
end
include 'COMMON.VAR'
include 'COMMON.LOCAL'
include 'COMMON.CONTROL'
-
+ include 'COMMON.SHIELD'
c write(iout,'(a,i2)')'Calling etotal_short ipot=',ipot
c call flush(iout)
if (modecalc.eq.12.or.modecalc.eq.14) then
C Calculate electrostatic (H-bonding) energy of the main chain.
C
107 continue
- call vec_and_deriv
- if (shield_mode.gt.0) then
- call set_shield_fac
- endif
-
- if (ipot.lt.6) then
-#ifdef SPLITELE
- if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
- & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
- & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
- & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
-#else
- if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
- & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
- & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
- & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
-#endif
- call eelec_scale(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
- else
- ees=0
- evdw1=0
- eel_loc=0
- eello_turn3=0
- eello_turn4=0
- endif
- else
+C call vec_and_deriv
+C if (shield_mode.eq.1) then
+C call set_shield_fac
+C else if (shield_mode.eq.2) then
+C call set_shield_fac2
+C if (nfgtasks.gt.1) then
+C#define DEBUG
+C#ifdef DEBUG
+C write(iout,*) "befor reduce fac_shield reduce"
+C do i=1,nres
+C write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+C write(2,*) "list", shield_list(1,i),ishield_list(i),
+C & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+C enddo
+C#endif
+C call MPI_Allgatherv(fac_shield(ivec_start),ivec_count(fg_rank1),
+C & MPI_DOUBLE_PRECISION,fac_shield(1),ivec_count(0),ivec_displ(0),
+C & MPI_DOUBLE_PRECISION,FG_COMM,IERR)
+C call MPI_Allgatherv(shield_list(1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_I50,shield_list(1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_I50,FG_COMM,IERR)
+C call MPI_Allgatherv(ishield_list(ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_INTEGER,ishield_list(1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_INTEGER,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield(1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_UYZ,grad_shield(1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_UYZ,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield_side(1,1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_SHI,grad_shield_side(1,1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_SHI,FG_COMM,IERR)
+C call MPI_Allgatherv(grad_shield_loc(1,1,ivec_start),
+C & ivec_count(fg_rank1),
+C & MPI_SHI,grad_shield_loc(1,1,1),ivec_count(0),
+C & ivec_displ(0),
+C & MPI_SHI,FG_COMM,IERR)
+C#ifdef DEBUG
+C write(iout,*) "after reduce fac_shield reduce"
+C do i=1,nres
+C write(2,*) "fac",itype(i),fac_shield(i),grad_shield(1,i)
+C write(2,*) "list", shield_list(1,i),ishield_list(i),
+C & grad_shield_side(1,1,i),grad_shield_loc(1,1,i)
+C enddo
+C#endif
+C#undef DEBUG
+C endif
+C
+C endif
+C if (ipot.lt.6) then
+C#ifdef SPLITELE
+C if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
+C & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
+C & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
+C & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
+C#else
+C if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
+C & wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
+C & .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
+C & .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
+C#endif
+C call eelec_scale(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
+C else
+C ees=0
+C evdw1=0
+C eel_loc=0
+C eello_turn3=0
+C eello_turn4=0
+C endif
+C else
c write (iout,*) "Soft-spheer ELEC potential"
- call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
- & eello_turn4)
- endif
+C call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
+C & eello_turn4)
+C endif
c
c Calculate the short-range part of Evdwpp
energia(17)=estr
energia(19)=edihcnstr
energia(21)=esccor
-c write (iout,*) "ETOTAL_SHORT before SUM_ENERGY"
+ write (iout,*) "ETOTAL_SHORT before SUM_ENERGY"
call flush(iout)
call sum_energy(energia,.true.)
-c write (iout,*) "Exit ETOTAL_SHORT"
+ write (iout,*) "Exit ETOTAL_SHORT"
call flush(iout)
return
end
gg_tube(j,i)=0.0d0
gg_tube_sc(j,i)=0.0d0
C grad_shield_side is Cbeta sidechain gradient
- do kk=1,maxshieldlist
- grad_shield_side(j,kk,i)=0.0d0
- grad_shield_loc(j,kk,i)=0.0d0
+C do kk=1,maxcontsshi
+C grad_shield_side(j,kk,i)=0.0d0
+C grad_shield_loc(j,kk,i)=0.0d0
C grad_shield_side_ca is Calfa sidechain gradient
C grad_shield_side_ca(j,kk,i)=0.0d0
- enddo
+C enddo
do intertyp=1,3
gloc_sc(intertyp,i,icg)=0.0d0
enddo
enddo
enddo
+ do i=1,nres
+ do j=1,maxcontsshi
+ shield_list(j,i)=0
+ do k=1,3
+C print *,i,j,k
+ grad_shield_side(k,j,i)=0.0d0
+ grad_shield_loc(k,j,i)=0.0d0
+ enddo
+ enddo
+ ishield_list(i)=0
+ enddo
C
C Initialize the gradient of local energy terms.
C
call MPI_Group_free(cont_to_group,ierr)
call MPI_Type_contiguous(3,MPI_DOUBLE_PRECISION,MPI_UYZ,IERROR)
call MPI_Type_commit(MPI_UYZ,IERROR)
+ call MPI_Type_contiguous(maxcontsshi,MPI_INTEGER,MPI_I50,IERROR)
+ call MPI_Type_commit(MPI_I50,IERROR)
call MPI_Type_contiguous(18,MPI_DOUBLE_PRECISION,MPI_UYZGRAD,
& IERROR)
call MPI_Type_commit(MPI_UYZGRAD,IERROR)
+ impishi=maxcontsshi*3
+ call MPI_Type_contiguous(impishi,MPI_DOUBLE_PRECISION,
+ & MPI_SHI,IERROR)
+ call MPI_Type_commit(MPI_SHI,IERROR)
call MPI_Type_contiguous(2,MPI_DOUBLE_PRECISION,MPI_MU,IERROR)
call MPI_Type_commit(MPI_MU,IERROR)
call MPI_Type_contiguous(4,MPI_DOUBLE_PRECISION,MPI_MAT1,IERROR)