1 c-------------------------------------------------------------------------------
2 subroutine RESPA_step(itime)
3 c-------------------------------------------------------------------------------
4 c Perform a single RESPA step.
5 c-------------------------------------------------------------------------------
6 implicit real*8 (a-h,o-z)
8 include 'COMMON.CONTROL'
11 include 'COMMON.LANGEVIN'
12 include 'COMMON.CHAIN'
13 include 'COMMON.DERIV'
15 include 'COMMON.LOCAL'
16 include 'COMMON.INTERACT'
17 include 'COMMON.IOUNITS'
18 include 'COMMON.NAMES'
19 include 'COMMON.TIME1'
20 double precision energia(0:n_ene),energia_short(0:n_ene),
21 & energia_long(0:n_ene)
22 double precision cm(3),L(3),vcm(3),incr(3)
23 integer ilen,count,rstcount
26 integer maxcount_scale /10/
28 double precision stochforcvec(MAXRES6)
29 double precision grad_tmp(3,0:maxres2)
30 common /stochcalc/ stochforcvec
33 double precision vtnp(maxres6), vtnp_(maxres6), vtnp_a(maxres6)
34 if (large.and. mod(itime,ntwe).eq.0) then
35 write (iout,*) "***************** RESPA itime",itime
36 write (iout,*) "Cartesian and internal coordinates: step 0"
39 write (iout,*) "Accelerations"
41 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_a(j,i),j=1,3),
42 & (d_a(j,i+nres),j=1,3)
44 write (iout,*) "Velocities, step 0"
46 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
47 & (d_t(j,i+nres),j=1,3)
51 c Perform the initial RESPA step (increment velocities)
52 c write (iout,*) "*********************** RESPA ini"
55 creview call tnp1_respa_step1
60 if (tnh.and..not.xiresp) then
61 call nhcint(EK,scale_nh,wdti,wdti2,wdti4,wdti8)
64 d_t(j,i)=d_t(j,i)*scale_nh
71 cd if(tnp .or. tnp1) then
72 cd write (iout,'(a,3f)') "EE1 NP S, pi",totT, s_np, pi_np
75 if (mod(itime,ntwe).eq.0 .and. large) then
76 write (iout,*) "Velocities, end"
78 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
79 & (d_t(j,i+nres),j=1,3)
86 cr grad_tmp(j,i)=gcart(j,i)
87 cr grad_tmp(j,i+nres)=gxcart(j,i)
92 c Compute the short-range forces
94 call etotal_short(energia_short)
95 if (tnp.or.tnp1) potE=energia_short(0)
101 if(.not.(tnp .or. tnp1)) d_t_old(j,i)=d_t(j,i)
102 d_a_old(j,i)=d_a(j,i)
106 c Split the time step
107 d_time=d_time/ntime_split
109 c Perform the short-range RESPSA steps (velocity Verlet increments of
110 c positions and velocities using short-range forces)
111 c write (iout,*) "*********************** RESPA split"
113 do itsplit=1,ntime_split
116 else if (lang.eq.2 .or. lang.eq.3) then
117 call stochastic_force(stochforcvec)
119 c First step of the velocity Verlet algorithm
122 else if (lang.eq.3) then
123 call sd_verlet1_ciccotti
124 else if (lang.eq.1) then
127 call tnp1_respa_i_step1
128 cr if(itsplit.eq.1)then
129 cr d_time_s12=d_time0*0.5*s12_np
131 cr d_t_half(j,0)=d_t_old(j,0)+d_a_old(j,0)*d_time_s12
135 cr d_t_half(j,i)=d_t_old(j,i)+d_a_old(j,i)*d_time_s12
139 cr if (itype(i).ne.10) then
142 cr d_t_half(j,inres)=d_t_old(j,inres)
143 cr & +d_a_old(j,inres)*d_time_s12
149 call tnp_respa_i_step1
151 if (tnh.and.xiresp) then
153 call nhcint(EK,scale_nh,wdtii,wdtii2,wdtii4,wdtii8)
156 d_t_old(j,i)=d_t_old(j,i)*scale_nh
159 cd write(iout,*) "SSS1",itsplit,EK,scale_nh
163 c Build the chain from the newly calculated coordinates
165 if (rattle) call rattle1
166 if (large.and. mod(itime,ntwe).eq.0) then
167 write (iout,*) "Cartesian and internal coordinates: step 1"
170 write (iout,*) "Accelerations"
172 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_a(j,i),j=1,3),
173 & (d_a(j,i+nres),j=1,3)
175 write (iout,*) "Velocities, step 1"
177 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
178 & (d_t(j,i+nres),j=1,3)
182 c Calculate energy and forces
184 c E_long aproximation
185 cr if (tnp .or. tnp1) then
186 cr dtmp=0.5*d_time*(1.0/s12_np+1.0/s_np)
189 cr E_long=E_long+d_t_new(j,i)*dtmp*grad_tmp(j,i)
193 c-------------------------------------
194 c test of reviewer's comment
196 c-------------------------------------
200 ctest call etotal_long(energia_long)
201 ctest E_long=energia_long(0)
205 call etotal_short(energia_short)
207 potE=energia_short(0)
209 c if(tnp .or. tnp1) then
210 c write (iout,*) "kkk",E_long2,E_long
215 c Get the new accelerations
217 t_enegrad=t_enegrad+tcpu()-tt0
218 c Second step of the velocity Verlet algorithm
221 else if (lang.eq.3) then
222 call sd_verlet2_ciccotti
223 else if (lang.eq.1) then
226 call tnp1_respa_i_step2
228 call tnp_respa_i_step2
231 if (tnh.and.xiresp) then
233 call nhcint(EK,scale_nh,wdtii,wdtii2,wdtii4,wdtii8)
236 d_t(j,i)=d_t(j,i)*scale_nh
239 cd write(iout,*) "SSS2",itsplit,EK,scale_nh
243 if (rattle) call rattle2
244 c Backup the coordinates, velocities, and accelerations
245 if (tnp .or. tnp1) then
248 d_t_old(j,i)=d_t(j,i)
249 if (tnp) d_t(j,i)=d_t(j,i)/s_np
250 if (tnp1) d_t(j,i)=d_t(j,i)/s_np
258 if(.not.(tnp .or. tnp1)) d_t_old(j,i)=d_t(j,i)
259 d_a_old(j,i)=d_a(j,i)
263 cd if(tnp .or. tnp1) then
265 cd HNose1=Hnose(EK,s_np,potE,pi_np,Q_np,t_bath,dimen)
266 cd H=(HNose1-H0)*s_np
267 cd write (iout,*) "jjj",EK,potE
268 cd write (iout,*) "iii H=",H,abs(HNose1-H0)/H0
269 cd write (iout,'(a,3f)')
270 cd & "III NP S, pi",totT+itsplit*d_time, s_np, pi_np
275 c Restore the time step
277 c Compute long-range forces
279 call etotal_long(energia_long)
280 E_long=energia_long(0)
281 potE=energia_short(0)+energia_long(0)
283 c Compute accelerations from long-range forces
285 if (large.and. mod(itime,ntwe).eq.0) then
286 write (iout,*) "Cartesian and internal coordinates: step 2"
289 write (iout,*) "Accelerations"
291 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_a(j,i),j=1,3),
292 & (d_a(j,i+nres),j=1,3)
294 write (iout,*) "Velocities, step 2"
296 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
297 & (d_t(j,i+nres),j=1,3)
300 c Compute the final RESPA step (increment velocities)
301 c write (iout,*) "*********************** RESPA fin"
303 creview call tnp1_respa_step2
309 if (tnh.and..not.xiresp) then
311 call nhcint(EK,scale_nh,wdti,wdti2,wdti4,wdti8)
314 d_t(j,i)=d_t(j,i)*scale_nh
320 if (tnp .or. tnp1) then
323 d_t(j,i)=d_t_old(j,i)/s_np
328 c Compute the complete potential energy
329 cc potE=energia_short(0)+energia_long(0)
331 c Calculate the kinetic and the total energy and the kinetic temperature
335 c Couple the system to Berendsen bath if needed
336 if (tbf .and. lang.eq.0) then
339 kinetic_T=2.0d0/(dimen*Rb)*EK
340 c Backup the coordinates, velocities, and accelerations
341 if (mod(itime,ntwe).eq.0 .and. large) then
342 write (iout,*) "Velocities, end"
344 write (iout,'(i3,3f10.5,3x,3f10.5)') i,(d_t(j,i),j=1,3),
345 & (d_t(j,i+nres),j=1,3)
350 c if(tnp .or. tnp1) then
351 c HNose1=Hnose(EK,s_np,energia_short(0),pi_np,Q_np,t_bath,dimen)
352 c_new_var_csplit Csplit=H0-E_long
353 c Csplit=H0-energia_short(0)
358 if (mod(itime,ntwe).eq.0) then
360 if(tnp .or. tnp1) then
361 write (iout,'(a3,7f)') "TTT",EK,s_np,potE,pi_np,Csplit,
362 & E_long,energia_short(0)
363 HNose1=Hnose(EK,s_np,potE,pi_np,Q_np,t_bath,dimen)
365 cd write (iout,'(a,10f)') "hhh",EK,s_np,potE,pi_np,H0
366 cd & ,EK+potE+pi_np**2/(2*Q_np)+dimen*0.001986d0*t_bath*log(s_np)
367 write (iout,*) "HHH H=",H,abs(HNose1-H0)/H0
368 cd write (iout,'(a,3f)') "EE2 NP S, pi",totT, s_np, pi_np
372 HNose1=Hnose_nh(EK,potE)
374 write (iout,*) "HHH H=",H,abs(HNose1-H0)/H0
391 if (itype(i).ne.10) then
395 vtnp(itnp)=d_t(j,inres)
400 c Transform velocities from UNRES coordinate space to cartesian and Gvec
407 vtnp_(i)=vtnp_(i)+Gvec(j,i)*vtnp(j)
408 vtnp_a(i)=vtnp_a(i)+A(i,j)*vtnp(j)
410 vtnp_(i)=vtnp_(i)*dsqrt(geigen(i))
414 write (iout,'("WWW",i3,3f10.5)') i,vtnp(i),vtnp_(i),vtnp_a(i)