2 C This source code is part of
6 C Copyright (c) 1991-2000, University of Groningen, The Netherlands.
7 C Copyright (c) 2001-2009, The GROMACS Development Team
9 C Gromacs is a library for molecular simulation and trajectory analysis,
10 C written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
11 C a full list of developers and information, check out http://www.gromacs.org
13 C This program is free software; you can redistribute it and/or modify it under
14 C the terms of the GNU Lesser General Public License as published by the Free
15 C Software Foundation; either version 2 of the License, or (at your option) any
17 C As a special exception, you may use this file as part of a free software
18 C library without restriction. Specifically, if other files instantiate
19 C templates or use macros or inline functions from this file, or you compile
20 C this file and link it with other files to produce an executable, this
21 C file does not by itself cause the resulting executable to be covered by
22 C the GNU Lesser General Public License.
24 C In plain-speak: do not worry about classes/macros/templates either - only
25 C changes to the library have to be LGPL, not an application linking with it.
27 C To help fund GROMACS development, we humbly ask that you cite
28 C the papers people have written on it - you can find them on the website!
32 C Gromacs nonbonded kernel f77skernel104
33 C Coulomb interaction: Normal Coulomb
34 C VdW interaction: Not calculated
35 C water optimization: pairs of TIP4P interactions
36 C Calculate forces: yes
38 subroutine f77skernel104
(
71 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
72 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
73 integer*4 gid
(*),type
(*),ntype
74 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
75 real*4 Vvdw
(*),tabscale
,VFtab
(*)
76 real*4 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
77 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
80 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
81 integer*4 nn0
,nn1
,nouter
,ninner
86 real*4 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
87 real*4 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
88 real*4 ix4
,iy4
,iz4
,fix4
,fiy4
,fiz4
89 real*4 jx2
,jy2
,jz2
,fjx2
,fjy2
,fjz2
90 real*4 jx3
,jy3
,jz3
,fjx3
,fjy3
,fjz3
91 real*4 jx4
,jy4
,jz4
,fjx4
,fjy4
,fjz4
92 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
93 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
94 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
95 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
96 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
97 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
98 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
99 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
100 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
101 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
104 C Initialize water data
113 C Reset outer and inner iteration counters
117 C Loop over thread workunits
118 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
119 if(nn1
.gt
.nri
) nn1
=nri
121 C Start outer loop over neighborlists
125 C Load shift vector for this list
128 shY
= shiftvec
(is3
+1)
129 shZ
= shiftvec
(is3
+2)
131 C Load limits for loop over neighbors
135 C Get outer coordinate index
139 C Load i atom data, add shift vector
140 ix2
= shX
+ pos
(ii3
+3)
141 iy2
= shY
+ pos
(ii3
+4)
142 iz2
= shZ
+ pos
(ii3
+5)
143 ix3
= shX
+ pos
(ii3
+6)
144 iy3
= shY
+ pos
(ii3
+7)
145 iz3
= shZ
+ pos
(ii3
+8)
146 ix4
= shX
+ pos
(ii3
+9)
147 iy4
= shY
+ pos
(ii3
+10)
148 iz4
= shZ
+ pos
(ii3
+11)
150 C Zero the potential energy for this list
153 C Clear i atom forces
166 C Get j neighbor index, and coordinate index
170 C load j atom coordinates
185 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
189 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
193 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
197 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
201 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
205 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
209 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
213 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
217 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
219 C Calculate 1/r and 1/r2
220 rinv22
= 1.0/sqrt
(rsq22
)
221 rinv23
= 1.0/sqrt
(rsq23
)
222 rinv24
= 1.0/sqrt
(rsq24
)
223 rinv32
= 1.0/sqrt
(rsq32
)
224 rinv33
= 1.0/sqrt
(rsq33
)
225 rinv34
= 1.0/sqrt
(rsq34
)
226 rinv42
= 1.0/sqrt
(rsq42
)
227 rinv43
= 1.0/sqrt
(rsq43
)
228 rinv44
= 1.0/sqrt
(rsq44
)
230 C Load parameters for j atom
232 rinvsq
= rinv22*rinv22
234 C Coulomb interaction
237 fscal
= (vcoul
)*rinvsq
239 C Calculate temporary vectorial force
244 C Increment i atom force
249 C Decrement j atom force
250 fjx2
= faction
(j3
+3) - tx
251 fjy2
= faction
(j3
+4) - ty
252 fjz2
= faction
(j3
+5) - tz
254 C Load parameters for j atom
256 rinvsq
= rinv23*rinv23
258 C Coulomb interaction
261 fscal
= (vcoul
)*rinvsq
263 C Calculate temporary vectorial force
268 C Increment i atom force
273 C Decrement j atom force
274 fjx3
= faction
(j3
+6) - tx
275 fjy3
= faction
(j3
+7) - ty
276 fjz3
= faction
(j3
+8) - tz
278 C Load parameters for j atom
280 rinvsq
= rinv24*rinv24
282 C Coulomb interaction
285 fscal
= (vcoul
)*rinvsq
287 C Calculate temporary vectorial force
292 C Increment i atom force
297 C Decrement j atom force
298 fjx4
= faction
(j3
+9) - tx
299 fjy4
= faction
(j3
+10) - ty
300 fjz4
= faction
(j3
+11) - tz
302 C Load parameters for j atom
304 rinvsq
= rinv32*rinv32
306 C Coulomb interaction
309 fscal
= (vcoul
)*rinvsq
311 C Calculate temporary vectorial force
316 C Increment i atom force
321 C Decrement j atom force
326 C Load parameters for j atom
328 rinvsq
= rinv33*rinv33
330 C Coulomb interaction
333 fscal
= (vcoul
)*rinvsq
335 C Calculate temporary vectorial force
340 C Increment i atom force
345 C Decrement j atom force
350 C Load parameters for j atom
352 rinvsq
= rinv34*rinv34
354 C Coulomb interaction
357 fscal
= (vcoul
)*rinvsq
359 C Calculate temporary vectorial force
364 C Increment i atom force
369 C Decrement j atom force
374 C Load parameters for j atom
376 rinvsq
= rinv42*rinv42
378 C Coulomb interaction
381 fscal
= (vcoul
)*rinvsq
383 C Calculate temporary vectorial force
388 C Increment i atom force
393 C Decrement j atom force
394 faction
(j3
+3) = fjx2
- tx
395 faction
(j3
+4) = fjy2
- ty
396 faction
(j3
+5) = fjz2
- tz
398 C Load parameters for j atom
400 rinvsq
= rinv43*rinv43
402 C Coulomb interaction
405 fscal
= (vcoul
)*rinvsq
407 C Calculate temporary vectorial force
412 C Increment i atom force
417 C Decrement j atom force
418 faction
(j3
+6) = fjx3
- tx
419 faction
(j3
+7) = fjy3
- ty
420 faction
(j3
+8) = fjz3
- tz
422 C Load parameters for j atom
424 rinvsq
= rinv44*rinv44
426 C Coulomb interaction
429 fscal
= (vcoul
)*rinvsq
431 C Calculate temporary vectorial force
436 C Increment i atom force
441 C Decrement j atom force
442 faction
(j3
+9) = fjx4
- tx
443 faction
(j3
+10) = fjy4
- ty
444 faction
(j3
+11) = fjz4
- tz
446 C Inner loop uses 234 flops/iteration
450 C Add i forces to mem and shifted force list
451 faction
(ii3
+3) = faction
(ii3
+3) + fix2
452 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
453 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
454 faction
(ii3
+6) = faction
(ii3
+6) + fix3
455 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
456 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
457 faction
(ii3
+9) = faction
(ii3
+9) + fix4
458 faction
(ii3
+10) = faction
(ii3
+10) + fiy4
459 faction
(ii3
+11) = faction
(ii3
+11) + fiz4
460 fshift
(is3
) = fshift
(is3
)+fix2
+fix3
+fix4
461 fshift
(is3
+1) = fshift
(is3
+1)+fiy2
+fiy3
+fiy4
462 fshift
(is3
+2) = fshift
(is3
+2)+fiz2
+fiz3
+fiz4
464 C Add potential energies to the group for this list
466 Vc
(ggid
) = Vc
(ggid
) + vctot
468 C Increment number of inner iterations
469 ninner
= ninner
+ nj1
- nj0
471 C Outer loop uses 28 flops/iteration
475 C Increment number of outer iterations
476 nouter
= nouter
+ nn1
- nn0
477 if(nn1
.lt
.nri
) goto 10
479 C Write outer/inner iteration count to pointers
491 C Gromacs nonbonded kernel f77skernel104nf
492 C Coulomb interaction: Normal Coulomb
493 C VdW interaction: Not calculated
494 C water optimization: pairs of TIP4P interactions
495 C Calculate forces: no
497 subroutine f77skernel104nf
(
530 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
531 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
532 integer*4 gid
(*),type
(*),ntype
533 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
534 real*4 Vvdw
(*),tabscale
,VFtab
(*)
535 real*4 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
536 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
539 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
540 integer*4 nn0
,nn1
,nouter
,ninner
542 real*4 qq
,vcoul
,vctot
549 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
550 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
551 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
552 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
553 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
554 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
555 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
556 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
557 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
558 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
561 C Initialize water data
570 C Reset outer and inner iteration counters
574 C Loop over thread workunits
575 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
576 if(nn1
.gt
.nri
) nn1
=nri
578 C Start outer loop over neighborlists
582 C Load shift vector for this list
585 shY
= shiftvec
(is3
+1)
586 shZ
= shiftvec
(is3
+2)
588 C Load limits for loop over neighbors
592 C Get outer coordinate index
596 C Load i atom data, add shift vector
597 ix2
= shX
+ pos
(ii3
+3)
598 iy2
= shY
+ pos
(ii3
+4)
599 iz2
= shZ
+ pos
(ii3
+5)
600 ix3
= shX
+ pos
(ii3
+6)
601 iy3
= shY
+ pos
(ii3
+7)
602 iz3
= shZ
+ pos
(ii3
+8)
603 ix4
= shX
+ pos
(ii3
+9)
604 iy4
= shY
+ pos
(ii3
+10)
605 iz4
= shZ
+ pos
(ii3
+11)
607 C Zero the potential energy for this list
610 C Clear i atom forces
614 C Get j neighbor index, and coordinate index
618 C load j atom coordinates
633 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
637 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
641 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
645 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
649 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
653 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
657 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
661 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
665 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
667 C Calculate 1/r and 1/r2
668 rinv22
= 1.0/sqrt
(rsq22
)
669 rinv23
= 1.0/sqrt
(rsq23
)
670 rinv24
= 1.0/sqrt
(rsq24
)
671 rinv32
= 1.0/sqrt
(rsq32
)
672 rinv33
= 1.0/sqrt
(rsq33
)
673 rinv34
= 1.0/sqrt
(rsq34
)
674 rinv42
= 1.0/sqrt
(rsq42
)
675 rinv43
= 1.0/sqrt
(rsq43
)
676 rinv44
= 1.0/sqrt
(rsq44
)
678 C Load parameters for j atom
681 C Coulomb interaction
685 C Load parameters for j atom
688 C Coulomb interaction
692 C Load parameters for j atom
695 C Coulomb interaction
699 C Load parameters for j atom
702 C Coulomb interaction
706 C Load parameters for j atom
709 C Coulomb interaction
713 C Load parameters for j atom
716 C Coulomb interaction
720 C Load parameters for j atom
723 C Coulomb interaction
727 C Load parameters for j atom
730 C Coulomb interaction
734 C Load parameters for j atom
737 C Coulomb interaction
741 C Inner loop uses 135 flops/iteration
745 C Add i forces to mem and shifted force list
747 C Add potential energies to the group for this list
749 Vc
(ggid
) = Vc
(ggid
) + vctot
751 C Increment number of inner iterations
752 ninner
= ninner
+ nj1
- nj0
754 C Outer loop uses 10 flops/iteration
758 C Increment number of outer iterations
759 nouter
= nouter
+ nn1
- nn0
760 if(nn1
.lt
.nri
) goto 10
762 C Write outer/inner iteration count to pointers