@@ -68,22 +68,16 @@ subroutine settle (dt,xold,yold,zold)
6868 real * 8 xold(* )
6969 real * 8 yold(* )
7070 real * 8 zold(* )
71- logical dovel
7271c
7372c
74- c check for the availability of atomic velocities
73+ c check for prior allocation of atomic velocities
7574c
76- dovel = .false.
77- if (allocated(v)) then
78- if (size (v) .ne. 0 ) dovel = .true.
79- else
80- allocate (v(3 ,0 ))
81- end if
75+ if (.not. allocated(v)) allocate (v(0 ,0 ))
8276c
8377c OpenMP directives for the major loop structure
8478c
8579!$OMP PARALLEL default(private) shared(nwat,iwat,kwat,mass,
86- !$OMP& x,y,z,xold,yold,zold,dt,dovel )
80+ !$OMP& x,y,z,xold,yold,zold,dt)
8781!$OMP& shared(v)
8882!$OMP DO reduction(+ :v)
8983c
@@ -218,7 +212,7 @@ subroutine settle (dt,xold,yold,zold)
218212c
219213c use velocity correction derived from position movement
220214c
221- if (dovel ) then
215+ if (dt .ne. 0.0d0 ) then
222216 v(1 ,ia) = v(1 ,ia) + (x(ia)- xia0)/ dt
223217 v(2 ,ia) = v(2 ,ia) + (y(ia)- yia0)/ dt
224218 v(3 ,ia) = v(3 ,ia) + (z(ia)- zia0)/ dt
@@ -239,7 +233,7 @@ subroutine settle (dt,xold,yold,zold)
239233c set position and velocity for four-site water extra sites
240234c
241235 if (nwat4 .ne. 0 ) then
242- call watfour (dovel )
236+ call watfour (dt )
243237 end if
244238 return
245239 end
@@ -698,20 +692,20 @@ subroutine solve3 (a,b,p)
698692c extra site of rigid planar four-site water molecules
699693c
700694c
701- subroutine watfour (dovel )
695+ subroutine watfour (dt )
702696 use atoms
703697 use freeze
704698 use moldyn
705699 implicit none
706700 integer i
707701 integer ia,ib,ic,id
702+ real * 8 dt
708703 real * 8 oterm,hterm
709- logical dovel
710704c
711705c
712706c OpenMP directives for the major loop structure
713707c
714- !$OMP PARALLEL default(private) shared(nwat4,iwat4,kwat4,x,y,z,v,dovel )
708+ !$OMP PARALLEL default(private) shared(nwat4,iwat4,kwat4,x,y,z,v,dt )
715709!$OMP DO
716710c
717711c set the position of four-site water extra centers
@@ -726,7 +720,7 @@ subroutine watfour (dovel)
726720 x(id) = oterm* x(ia) + hterm* (x(ib)+ x(ic))
727721 y(id) = oterm* y(ia) + hterm* (y(ib)+ y(ic))
728722 z(id) = oterm* z(ia) + hterm* (z(ib)+ z(ic))
729- if (dovel ) then
723+ if (dt .ne. 0.0d0 ) then
730724 v(1 ,id) = 0.0d0
731725 v(2 ,id) = 0.0d0
732726 v(3 ,id) = 0.0d0
0 commit comments