2 c------------------------------------------------
3 c The driver for molecular dynamics subroutines
4 c------------------------------------------------
5 implicit real*8 (a-h,o-z)
7 include 'COMMON.CONTROL'
10 include 'COMMON.LANGEVIN'
11 include 'COMMON.CHAIN'
12 include 'COMMON.DERIV'
14 include 'COMMON.LOCAL'
15 include 'COMMON.INTERACT'
16 include 'COMMON.IOUNITS'
17 include 'COMMON.NAMES'
18 include 'COMMON.TIME1'
19 double precision cm(3),L(3),vcm(3)
20 double precision energia(0:n_ene)
24 common /gucio/ cm,energia
32 write (iout,'(20(1h=),a20,20(1h=))') "MD calculation started"
34 c Determine the inverse of the inertia matrix.
35 call setup_MD_matrices
38 t_MDsetup = tcpu()-tt0
40 c Entering the MD loop
42 if (lang.eq.2 .or. lang.eq.3) then
45 call sd_verlet_p_setup
47 call sd_verlet_ciccotti_setup
51 pfric0_mat(i,j,0)=pfric_mat(i,j)
52 afric0_mat(i,j,0)=afric_mat(i,j)
53 vfric0_mat(i,j,0)=vfric_mat(i,j)
54 prand0_mat(i,j,0)=prand_mat(i,j)
55 vrand0_mat1(i,j,0)=vrand_mat1(i,j)
56 vrand0_mat2(i,j,0)=vrand_mat2(i,j)
63 else if (lang.eq.1 .or. lang.eq.4) then
66 t_langsetup=tcpu()-tt0
70 if (lang.gt.0 .and. surfarea .and.
71 & mod(itime,reset_fricmat).eq.0) then
72 if (lang.eq.2 .or. lang.eq.3) then
75 call sd_verlet_p_setup
77 call sd_verlet_ciccotti_setup
81 pfric0_mat(i,j,0)=pfric_mat(i,j)
82 afric0_mat(i,j,0)=afric_mat(i,j)
83 vfric0_mat(i,j,0)=vfric_mat(i,j)
84 prand0_mat(i,j,0)=prand_mat(i,j)
85 vrand0_mat1(i,j,0)=vrand_mat1(i,j)
86 vrand0_mat2(i,j,0)=vrand_mat2(i,j)
93 else if (lang.eq.1 .or. lang.eq.4) then
96 write (iout,'(a,i10)')
97 & "Friction matrix reset based on surface area, itime",itime
99 if (reset_vel .and. tbf .and. lang.eq.0
100 & .and. mod(itime,count_reset_vel).eq.0) then
102 write(iout,'(a,f20.2)')
103 & "Velocities reset to random values, time",totT
106 d_t_old(j,i)=d_t(j,i)
110 if (reset_moment .and. mod(itime,count_reset_moment).eq.0) then
114 d_t(j,0)=d_t(j,0)-vcm(j)
117 kinetic_T=2.0d0/(dimen*Rb)*EK
118 scalfac=dsqrt(T_bath/kinetic_T)
119 write(iout,'(a,f20.2)') "Momenta zeroed out, time",totT
122 d_t_old(j,i)=scalfac*d_t(j,i)
128 c Time-reversible RESPA algorithm
129 c (Tuckerman et al., J. Chem. Phys., 97, 1990, 1992)
130 call RESPA_step(itime)
132 c Variable time step algorithm.
133 call velverlet_step(itime)
136 call brown_step(itime)
138 if (mod(itime,ntwe).eq.0) call statout(itime)
139 if (mod(itime,ntwx).eq.0) then
140 write (tytul,'("time",f8.2)') totT
142 call pdbout(potE,tytul,ipdb)
147 if (rstcount.eq.1000.or.itime.eq.n_timestep) then
148 open(irest2,file=rest2name,status='unknown')
149 write(irest2,*) totT,EK,potE,totE
151 write (irest2,'(3e15.5)') (d_t(j,i),j=1,3)
154 write (irest2,'(3e15.5)') (dc(j,i),j=1,3)
161 write (iout,'(//35(1h=),a10,35(1h=)/10(/a40,1pe15.5))')
163 & 'MD calculations setup:',t_MDsetup,
164 & 'Energy & gradient evaluation:',t_enegrad,
165 & 'Stochastic MD setup:',t_langsetup,
166 & 'Stochastic MD step setup:',t_sdsetup,
168 write (iout,'(/28(1h=),a25,27(1h=))')
169 & ' End of MD calculation '