1 subroutine etotal_long(energia)
2 implicit real*8 (a-h,o-z)
5 c Compute the long-range slow-varying contributions to the energy
10 cMS$ATTRIBUTES C :: proc_proc
14 include 'COMMON.IOUNITS'
15 double precision energia(0:n_ene),energia1(0:n_ene+1)
16 include 'COMMON.FFIELD'
17 include 'COMMON.DERIV'
18 include 'COMMON.INTERACT'
19 include 'COMMON.SBRIDGE'
20 include 'COMMON.CHAIN'
22 call int_from_cart1(.false.)
23 cd print '(a,i2)','Calling etotal ipot=',ipot
24 cd print *,'nnt=',nnt,' nct=',nct
26 C Compute the side-chain and electrostatic interaction energy
28 goto (101,102,103,104,105,106) ipot
29 C Lennard-Jones potential.
31 cd print '(a)','Exit ELJ'
33 C Lennard-Jones-Kihara potential (shifted).
36 C Berne-Pechukas potential (dilated LJ, angular dependence).
39 C Gay-Berne potential (shifted LJ, angular dependence).
42 C Gay-Berne-Vorobjev potential (shifted LJ, angular dependence).
45 C Soft-sphere potential
46 106 call e_softsphere(evdw)
48 C Calculate electrostatic (H-bonding) energy of the main chain.
51 c print *,"Processor",myrank," computed USCSC"
53 c print *,"Processor",myrank," left VEC_AND_DERIV"
56 if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
57 & wturn3.gt.0d0.or.wturn4.gt.0d0) then
59 if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
60 & wturn3.gt.0d0.or.wturn4.gt.0d0) then
62 call eelec(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
71 c write (iout,*) "Soft-spheer ELEC potential"
72 call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
76 C Calculate excluded-volume interaction energy between peptide groups
80 call escp(evdw2,evdw2_14)
82 c write (iout,*) "Soft-sphere SCP potential"
83 call escp_soft_sphere(evdw2,evdw2_14)
86 C 12/1/95 Multi-body terms
90 if ((wcorr4.gt.0.0d0 .or. wcorr5.gt.0.0d0 .or. wcorr6.gt.0.0d0
91 & .or. wturn6.gt.0.0d0) .and. ipot.lt.6) then
92 call multibody_eello(ecorr,ecorr5,ecorr6,eturn6,n_corr,n_corr1)
93 c write (2,*) 'n_corr=',n_corr,' n_corr1=',n_corr1,
94 c &" ecorr",ecorr," ecorr5",ecorr5," ecorr6",ecorr6," eturn6",eturn6
101 if ((wcorr4.eq.0.0d0 .and. wcorr.gt.0.0d0) .and. ipot.lt.6) then
102 call multibody_hb(ecorr,ecorr5,ecorr6,n_corr,n_corr1)
108 etot=wsc*evdw+wscp*evdw2+welec*ees+wvdwpp*evdw1
109 & +wcorr*ecorr+wcorr5*ecorr5
110 & +wcorr6*ecorr6+wturn4*eello_turn4+wturn3*eello_turn3
111 & +wturn6*eturn6+wel_loc*eel_loc+edihcnstr+wtor_d*etors_d
113 etot=wsc*evdw+wscp*evdw2+welec*(ees+evdw1)
114 & +wcorr*ecorr+wcorr5*ecorr5
115 & +wcorr6*ecorr6+wturn4*eello_turn4+wturn3*eello_turn3
116 & +wturn6*eturn6+wel_loc*eel_loc+edihcnstr+wtor_d*etors_d
121 energia(2)=evdw2-evdw2_14
138 energia(8)=eello_turn3
139 energia(9)=eello_turn4
144 c if (isnan(etot)) energia(0)=1.0d+99
148 idumm=proc_proc(etot,i)
150 call proc_proc(etot,i)
152 c if(i.eq.1)energia(0)=1.0d+99
155 C Sum up the components of the Cartesian gradient.
161 gradc(j,i,icg)=wsc*gvdwc(j,i)+wscp*gvdwc_scp(j,i)+
162 & welec*gelc(j,i)+wvdwpp*gvdwpp(j,i)+
163 & wcorr*gradcorr(j,i)+
164 & wel_loc*gel_loc(j,i)+
165 & wturn3*gcorr3_turn(j,i)+
166 & wturn4*gcorr4_turn(j,i)+
167 & wcorr5*gradcorr5(j,i)+
168 & wcorr6*gradcorr6(j,i)+
169 & wturn6*gcorr6_turn(j,i)
170 gradx(j,i,icg)=wsc*gvdwx(j,i)+wscp*gradx_scp(j,i)+
171 & wcorr*gradxorr(j,i)
176 gradc(j,i,icg)=wsc*gvdwc(j,i)+wscp*gvdwc_scp(j,i)+
178 & wcorr*gradcorr(j,i)+
179 & wel_loc*gel_loc(j,i)+
180 & wturn3*gcorr3_turn(j,i)+
181 & wturn4*gcorr4_turn(j,i)+
182 & wcorr5*gradcorr5(j,i)+
183 & wcorr6*gradcorr6(j,i)+
184 & wturn6*gcorr6_turn(j,i)
185 gradx(j,i,icg)=wsc*gvdwx(j,i)+wscp*gradx_scp(j,i)+
186 & wcorr*gradxorr(j,i)
189 cd print '(i3,9(1pe12.4))',i,(gvdwc(k,i),k=1,3),(gelc(k,i),k=1,3),
190 cd & (gradc(k,i),k=1,3)
192 c write (iout,*) "Cartesian gradient"
193 c write (iout,*) "gradcorr5"
195 c write (iout,*) i,(gradcorr5(j,i),j=1,3)
197 c write (iout,*) "gradcorr6"
199 c write (iout,*) i,(gradcorr6(j,i),j=1,3)
203 cd write (iout,*) i,g_corr5_loc(i)
204 gloc(i,icg)=wcorr*gcorr_loc(i)
205 & +wcorr5*g_corr5_loc(i)
206 & +wcorr6*g_corr6_loc(i)
207 & +wturn4*gel_loc_turn4(i)
208 & +wturn3*gel_loc_turn3(i)
209 & +wturn6*gel_loc_turn6(i)
210 & +wel_loc*gel_loc_loc(i)
214 c------------------------------------------------------------------------------
215 subroutine etotal_short(energia)
216 implicit real*8 (a-h,o-z)
219 c Compute the short-range fast-varying contributions to the energy
224 cMS$ATTRIBUTES C :: proc_proc
229 double precision weights_(n_ene)
231 include 'COMMON.IOUNITS'
232 double precision energia(0:n_ene)
233 include 'COMMON.FFIELD'
234 include 'COMMON.DERIV'
235 include 'COMMON.INTERACT'
236 include 'COMMON.SBRIDGE'
237 include 'COMMON.CHAIN'
239 if (modecalc.eq.12.or.modecalc.eq.14) then
241 if (fg_rank.eq.0) call int_from_cart1(.false.)
243 call int_from_cart1(.false.)
247 write(iout,*) "ETOTAL_SHORT Processor",fg_rank,
248 & " absolute rank",myrank," nfgtasks",nfgtasks
250 if (nfgtasks.gt.1) then
252 C FG slaves call the following matching MPI_Bcast in ERGASTULUM
253 if (fg_rank.eq.0) then
254 call MPI_Bcast(0,1,MPI_INTEGER,king,FG_COMM,IERROR)
255 write (iout,*) "Processor",myrank," BROADCAST iorder"
257 C FG master sets up the WEIGHTS_ array which will be broadcast to the
258 C FG slaves as WEIGHTS array.
278 C FG Master broadcasts the WEIGHTS_ array
279 call MPI_Bcast(weights_(1),n_ene,
280 & MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
282 C FG slaves receive the WEIGHTS array
283 call MPI_Bcast(weights(1),n_ene,
284 & MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
286 write (iout,*),"Processor",myrank," BROADCAST weights"
287 call MPI_Bcast(c(1,1),maxres6,MPI_DOUBLE_PRECISION,
289 write (iout,*) "Processor",myrank," BROADCAST c"
290 call MPI_Bcast(dc(1,1),maxres6,MPI_DOUBLE_PRECISION,
292 write (iout,*) "Processor",myrank," BROADCAST dc"
293 call MPI_Bcast(dc_norm(1,1),maxres6,MPI_DOUBLE_PRECISION,
295 write (iout,*) "Processor",myrank," BROADCAST dc_norm"
296 call MPI_Bcast(theta(1),nres,MPI_DOUBLE_PRECISION,
298 write (iout,*) "Processor",myrank," BROADCAST theta"
299 call MPI_Bcast(phi(1),nres,MPI_DOUBLE_PRECISION,
301 write (iout,*) "Processor",myrank," BROADCAST phi"
302 call MPI_Bcast(alph(1),nres,MPI_DOUBLE_PRECISION,
304 write (iout,*) "Processor",myrank," BROADCAST alph"
305 call MPI_Bcast(omeg(1),nres,MPI_DOUBLE_PRECISION,
307 write (iout,*) "Processor",myrank," BROADCAST omeg"
308 call MPI_Bcast(vbld(1),2*nres,MPI_DOUBLE_PRECISION,
310 write (iout,*) "Processor",myrank," BROADCAST vbld"
311 call MPI_Bcast(vbld_inv(1),2*nres,MPI_DOUBLE_PRECISION,
313 time_Bcast=time_Bcast+MPI_Wtime()-time00
314 write (iout,*) "Processor",myrank," BROADCAST vbld_inv"
316 write (iout,*) 'Processor',myrank,
317 & ' calling etotal_short ipot=',ipot
319 print *,'Processor',myrank,' nnt=',nnt,' nct=',nct
321 c call int_from_cart1(.false.)
323 c Calculate the bond-stretching energy
327 C Calculate the disulfide-bridge and other energy and the contributions
328 C from other distance constraints.
331 C Calculate the virtual-bond-angle energy.
335 C Calculate the SC local energy.
340 C Calculate the virtual-bond torsional energy.
342 call etor(etors,edihcnstr)
344 C 6/23/01 Calculate double-torsional energy
347 etot=wang*ebe+wtor*etors+wscloc*escloc+wtor_d*etors_d+wbond*estr
348 & +edihcnstr+wstrain*ehpb+nss*ebr
358 c if (isnan(etot)) energia(0)=1.0d+99
362 idumm=proc_proc(etot,i)
364 call proc_proc(etot,i)
366 c if(i.eq.1)energia(0)=1.0d+99
369 C Sum up the components of the Cartesian gradient.
375 gradc(j,i,icg)=wbond*gradb(j,i)+wstrain*ghpbc(j,i)
376 gradx(j,i,icg)=wbond*gradbx(j,i)+wstrain*ghpbx(j,i)
378 gradc(j,i,icg)=wbond*gradb(j,i)+wstrain*ghpbc(j,i)+
379 & +wscloc*gscloc(j,i)
380 gradx(j,i,icg)=wbond*gradbx(j,i)+wstrain*ghpbx(j,i)
381 & +wscloc*gsclocx(j,i)