Skip to content

Commit d88d4d9

Browse files
committed
patch RATTLE to zero velocities on 4-site water extra sites
1 parent b442df8 commit d88d4d9

File tree

7 files changed

+4090
-4058
lines changed

7 files changed

+4090
-4058
lines changed

example/mm3.xyz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
3 H 0.105212 0.000000 -0.940767 21 1
55
4 O -2.940698 0.000000 -0.082189 6 5 6
66
5 H -3.491105 -0.749216 0.097557 21 4
7-
6 H -3.491105 0.749217 0.097557 21 4
7+
6 H -3.491105 0.749216 0.097557 21 4

example/tip4pbox.key

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
1-
parameters ../params/oplsaa08
2-
#verbose
1+
parameters NONE
2+
rattle WATER
33

4-
x-axis 31.1
4+
vdwtype LENNARD-JONES
5+
radiusrule GEOMETRIC
6+
radiustype SIGMA
7+
radiussize DIAMETER
8+
epsilonrule GEOMETRIC
9+
dielectric 1.0000
10+
11+
x-axis 31.125
512
ewald
6-
ewald-cutoff 9.0
7-
vdw-cutoff 12.0
8-
rattle WATER
13+
ewald-cutoff 9.0
14+
vdw-cutoff 12.0
15+
vdw-correlation
16+
17+
## TIP4P-Ew Parameters (J Chem Phys, 120, 9665-9678, 2004)
18+
19+
atom 1 O "TIP4P-Ew O" 8 15.995 3
20+
atom 2 H "TIP4P-Ew H" 1 1.008 1
21+
atom 3 M "TIP4P-Ew M" 0 0.000 1
22+
23+
bond 1 2 1000.0 0.9572
24+
bond 1 3 1000.0 0.1250
25+
angle 2 1 2 100.0 104.52
26+
angle 2 1 3 100.0 52.26
27+
28+
vdw 1 3.16435 0.162750
29+
vdw 2 0.000 0.0000
30+
vdw 3 0.000 0.0000
31+
32+
charge 1 0.000
33+
charge 2 0.52422
34+
charge 3 -1.04844

example/tip4pbox.xyz

Lines changed: 4002 additions & 4001 deletions
Large diffs are not rendered by default.

source/control.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ subroutine control
4545
c check for control parameters on the command line
4646
c
4747
exist = .false.
48-
do i = 1, narg-1
48+
do i = 1, narg
4949
string = arg(i)
5050
call upcase (string)
5151
if (string(1:2) .eq. '-D') then

source/mdinit.f

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ subroutine mdinit (dt)
185185
if (atomic(i) .le. 0) ndummy = ndummy + 1
186186
if (use(i) .and. mass(i).le.0.0d0) then
187187
mass(i) = 1.0d0
188-
totmass = totmass + 1.0d0
188+
if (atomic(i) .gt. 0) totmass = totmass + 1.0d0
189189
if (verbose) then
190190
write (iout,30) i
191191
30 format (/,' MDINIT -- Warning, Mass of Atom',

source/rattle.f

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ subroutine rattle (dt,xold,yold,zold)
150150
& ' Iterations')
151151
end if
152152
c
153-
c set four-site water extra centers from H-O-H coordinates
153+
c set position and velocity of four-site water extra centers
154154
c
155155
do i = 1, nwat4
156156
ia = iwat4(1,i)
@@ -162,6 +162,9 @@ subroutine rattle (dt,xold,yold,zold)
162162
x(ia) = oterm*x(ib) + hterm*(x(ic)+x(id))
163163
y(ia) = oterm*y(ib) + hterm*(y(ic)+y(id))
164164
z(ia) = oterm*z(ib) + hterm*(z(ic)+z(id))
165+
v(1,ia) = 0.0d0
166+
v(2,ia) = 0.0d0
167+
v(3,ia) = 0.0d0
165168
end do
166169
c
167170
c apply group position and velocity constraints via exact reset
@@ -522,7 +525,7 @@ subroutine shake (xold,yold,zold)
522525
& ' Iterations')
523526
end if
524527
c
525-
c set four-site water extra centers from H-O-H coordinates
528+
c set the position of any four-site water extra centers
526529
c
527530
do i = 1, nwat4
528531
ia = iwat4(1,i)
@@ -719,7 +722,7 @@ subroutine water4 (derivs)
719722
real*8 derivs(3,*)
720723
c
721724
c
722-
c distribute gradient on four-site water extra centers
725+
c distribute the gradient on four-site water extra centers
723726
c
724727
if (use_rattle) then
725728
do i = 1, nwat4

source/readxyz.f

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -235,71 +235,73 @@ subroutine readxyz (ixyz)
235235
c
236236
c for each atom, count and sort its attached atoms
237237
c
238-
do i = 1, n
239-
do j = maxval, 1, -1
240-
if (i12(j,i) .ne. 0) then
241-
n12(i) = j
242-
goto 150
243-
end if
238+
if (.not. abort) then
239+
do i = 1, n
240+
do j = maxval, 1, -1
241+
if (i12(j,i) .ne. 0) then
242+
n12(i) = j
243+
goto 150
244+
end if
245+
end do
246+
150 continue
247+
call sort (n12(i),i12(1,i))
244248
end do
245-
150 continue
246-
call sort (n12(i),i12(1,i))
247-
end do
248249
c
249250
c perform dynamic allocation of some local arrays
250251
c
251-
nmax = 0
252-
do i = 1, n
253-
nmax = max(tag(i),nmax)
254-
do j = 1, n12(i)
255-
nmax = max(i12(j,i),nmax)
252+
nmax = 0
253+
do i = 1, n
254+
nmax = max(tag(i),nmax)
255+
do j = 1, n12(i)
256+
nmax = max(i12(j,i),nmax)
257+
end do
256258
end do
257-
end do
258-
allocate (list(nmax))
259+
allocate (list(nmax))
259260
c
260261
c check for scrambled atom order and attempt to renumber
261262
c
262-
reorder = .false.
263-
do i = 1, n
264-
list(tag(i)) = i
265-
if (tag(i) .ne. i) reorder = .true.
266-
end do
267-
if (reorder) then
268-
write (iout,160)
269-
160 format (/,' READXYZ -- Atom Labels not Sequential,',
270-
& ' Attempting to Renumber')
263+
reorder = .false.
271264
do i = 1, n
272-
tag(i) = i
273-
do j = 1, n12(i)
274-
i12(j,i) = list(i12(j,i))
275-
end do
276-
call sort (n12(i),i12(1,i))
265+
list(tag(i)) = i
266+
if (tag(i) .ne. i) reorder = .true.
277267
end do
278-
end if
268+
if (reorder) then
269+
write (iout,160)
270+
160 format (/,' READXYZ -- Atom Labels not Sequential,',
271+
& ' Attempting to Renumber')
272+
do i = 1, n
273+
tag(i) = i
274+
do j = 1, n12(i)
275+
i12(j,i) = list(i12(j,i))
276+
end do
277+
call sort (n12(i),i12(1,i))
278+
end do
279+
end if
279280
c
280281
c perform deallocation of some local arrays
281282
c
282-
deallocate (list)
283+
deallocate (list)
283284
c
284285
c check for atom pairs with identical coordinates
285286
c
286-
clash = .false.
287-
if (n .le. 10000) call chkxyz (clash)
287+
clash = .false.
288+
if (n .le. 10000) call chkxyz (clash)
288289
c
289290
c make sure all atom connectivities are bidirectional
290291
c
291-
do i = 1, n
292-
do j = 1, n12(i)
293-
k = i12(j,i)
294-
do m = 1, n12(k)
295-
if (i12(m,k) .eq. i) goto 180
292+
do i = 1, n
293+
do j = 1, n12(i)
294+
k = i12(j,i)
295+
do m = 1, n12(k)
296+
if (i12(m,k) .eq. i) goto 180
297+
end do
298+
write (iout,170) k,i
299+
170 format (/,' READXYZ -- Check Connection of Atoms',
300+
& i9,' and',i9)
301+
call fatal
302+
180 continue
296303
end do
297-
write (iout,170) k,i
298-
170 format (/,' READXYZ -- Check Connection of Atoms',
299-
& i9,' and',i9)
300-
call fatal
301-
180 continue
302304
end do
303-
end do
305+
end if
304306
return
305307
end

0 commit comments

Comments
 (0)