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 f77skernel134
33 C Coulomb interaction: Normal Coulomb
34 C VdW interaction: Tabulated
35 C water optimization: pairs of TIP4P interactions
36 C Calculate forces: yes
38 subroutine f77skernel134
(
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
91 real*4 Y
,F
,Geps
,Heps2
,Fp
,VV
94 real*4 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
95 real*4 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
96 real*4 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
97 real*4 ix4
,iy4
,iz4
,fix4
,fiy4
,fiz4
99 real*4 jx2
,jy2
,jz2
,fjx2
,fjy2
,fjz2
100 real*4 jx3
,jy3
,jz3
,fjx3
,fjy3
,fjz3
101 real*4 jx4
,jy4
,jz4
,fjx4
,fjy4
,fjz4
102 real*4 dx11
,dy11
,dz11
,rsq11
,rinv11
103 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
104 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
105 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
106 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
107 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
108 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
109 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
110 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
111 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
112 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
116 C Initialize water data
123 tj
= 2*(ntype
+1)*type
(ii
)+1
128 C Reset outer and inner iteration counters
132 C Loop over thread workunits
133 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
134 if(nn1
.gt
.nri
) nn1
=nri
136 C Start outer loop over neighborlists
140 C Load shift vector for this list
143 shY
= shiftvec
(is3
+1)
144 shZ
= shiftvec
(is3
+2)
146 C Load limits for loop over neighbors
150 C Get outer coordinate index
154 C Load i atom data, add shift vector
155 ix1
= shX
+ pos
(ii3
+0)
156 iy1
= shY
+ pos
(ii3
+1)
157 iz1
= shZ
+ pos
(ii3
+2)
158 ix2
= shX
+ pos
(ii3
+3)
159 iy2
= shY
+ pos
(ii3
+4)
160 iz2
= shZ
+ pos
(ii3
+5)
161 ix3
= shX
+ pos
(ii3
+6)
162 iy3
= shY
+ pos
(ii3
+7)
163 iz3
= shZ
+ pos
(ii3
+8)
164 ix4
= shX
+ pos
(ii3
+9)
165 iy4
= shY
+ pos
(ii3
+10)
166 iz4
= shZ
+ pos
(ii3
+11)
168 C Zero the potential energy for this list
172 C Clear i atom forces
188 C Get j neighbor index, and coordinate index
192 C load j atom coordinates
210 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
214 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
218 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
222 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
226 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
230 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
234 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
238 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
242 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
246 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
248 C Calculate 1/r and 1/r2
249 rinv11
= 1.0/sqrt
(rsq11
)
250 rinv22
= 1.0/sqrt
(rsq22
)
251 rinv23
= 1.0/sqrt
(rsq23
)
252 rinv24
= 1.0/sqrt
(rsq24
)
253 rinv32
= 1.0/sqrt
(rsq32
)
254 rinv33
= 1.0/sqrt
(rsq33
)
255 rinv34
= 1.0/sqrt
(rsq34
)
256 rinv42
= 1.0/sqrt
(rsq42
)
257 rinv43
= 1.0/sqrt
(rsq43
)
258 rinv44
= 1.0/sqrt
(rsq44
)
260 C Load parameters for j atom
262 C Calculate table index
265 C Calculate table index
272 C Tabulated VdW interaction - dispersion
275 Geps
= eps*VFtab
(nnn
+2)
276 Heps2
= eps2*VFtab
(nnn
+3)
279 FF
= Fp
+Geps
+2.0*Heps2
283 C Tabulated VdW interaction - repulsion
287 Geps
= eps*VFtab
(nnn
+2)
288 Heps2
= eps2*VFtab
(nnn
+3)
291 FF
= Fp
+Geps
+2.0*Heps2
294 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
295 fscal
= -((fijD
+fijR
)*tabscale
)*rinv11
297 C Calculate temporary vectorial force
302 C Increment i atom force
307 C Decrement j atom force
308 faction
(j3
+0) = faction
(j3
+0) - tx
309 faction
(j3
+1) = faction
(j3
+1) - ty
310 faction
(j3
+2) = faction
(j3
+2) - tz
312 C Load parameters for j atom
314 rinvsq
= rinv22*rinv22
316 C Coulomb interaction
319 fscal
= (vcoul
)*rinvsq
321 C Calculate temporary vectorial force
326 C Increment i atom force
331 C Decrement j atom force
332 fjx2
= faction
(j3
+3) - tx
333 fjy2
= faction
(j3
+4) - ty
334 fjz2
= faction
(j3
+5) - tz
336 C Load parameters for j atom
338 rinvsq
= rinv23*rinv23
340 C Coulomb interaction
343 fscal
= (vcoul
)*rinvsq
345 C Calculate temporary vectorial force
350 C Increment i atom force
355 C Decrement j atom force
356 fjx3
= faction
(j3
+6) - tx
357 fjy3
= faction
(j3
+7) - ty
358 fjz3
= faction
(j3
+8) - tz
360 C Load parameters for j atom
362 rinvsq
= rinv24*rinv24
364 C Coulomb interaction
367 fscal
= (vcoul
)*rinvsq
369 C Calculate temporary vectorial force
374 C Increment i atom force
379 C Decrement j atom force
380 fjx4
= faction
(j3
+9) - tx
381 fjy4
= faction
(j3
+10) - ty
382 fjz4
= faction
(j3
+11) - tz
384 C Load parameters for j atom
386 rinvsq
= rinv32*rinv32
388 C Coulomb interaction
391 fscal
= (vcoul
)*rinvsq
393 C Calculate temporary vectorial force
398 C Increment i atom force
403 C Decrement j atom force
408 C Load parameters for j atom
410 rinvsq
= rinv33*rinv33
412 C Coulomb interaction
415 fscal
= (vcoul
)*rinvsq
417 C Calculate temporary vectorial force
422 C Increment i atom force
427 C Decrement j atom force
432 C Load parameters for j atom
434 rinvsq
= rinv34*rinv34
436 C Coulomb interaction
439 fscal
= (vcoul
)*rinvsq
441 C Calculate temporary vectorial force
446 C Increment i atom force
451 C Decrement j atom force
456 C Load parameters for j atom
458 rinvsq
= rinv42*rinv42
460 C Coulomb interaction
463 fscal
= (vcoul
)*rinvsq
465 C Calculate temporary vectorial force
470 C Increment i atom force
475 C Decrement j atom force
476 faction
(j3
+3) = fjx2
- tx
477 faction
(j3
+4) = fjy2
- ty
478 faction
(j3
+5) = fjz2
- tz
480 C Load parameters for j atom
482 rinvsq
= rinv43*rinv43
484 C Coulomb interaction
487 fscal
= (vcoul
)*rinvsq
489 C Calculate temporary vectorial force
494 C Increment i atom force
499 C Decrement j atom force
500 faction
(j3
+6) = fjx3
- tx
501 faction
(j3
+7) = fjy3
- ty
502 faction
(j3
+8) = fjz3
- tz
504 C Load parameters for j atom
506 rinvsq
= rinv44*rinv44
508 C Coulomb interaction
511 fscal
= (vcoul
)*rinvsq
513 C Calculate temporary vectorial force
518 C Increment i atom force
523 C Decrement j atom force
524 faction
(j3
+9) = fjx4
- tx
525 faction
(j3
+10) = fjy4
- ty
526 faction
(j3
+11) = fjz4
- tz
528 C Inner loop uses 288 flops/iteration
532 C Add i forces to mem and shifted force list
533 faction
(ii3
+0) = faction
(ii3
+0) + fix1
534 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
535 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
536 faction
(ii3
+3) = faction
(ii3
+3) + fix2
537 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
538 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
539 faction
(ii3
+6) = faction
(ii3
+6) + fix3
540 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
541 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
542 faction
(ii3
+9) = faction
(ii3
+9) + fix4
543 faction
(ii3
+10) = faction
(ii3
+10) + fiy4
544 faction
(ii3
+11) = faction
(ii3
+11) + fiz4
545 fshift
(is3
) = fshift
(is3
)+fix1
+fix2
+fix3
+fix4
546 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
+fiy2
+fiy3
+fiy4
547 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
+fiz2
+fiz3
+fiz4
549 C Add potential energies to the group for this list
551 Vc
(ggid
) = Vc
(ggid
) + vctot
552 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
554 C Increment number of inner iterations
555 ninner
= ninner
+ nj1
- nj0
557 C Outer loop uses 38 flops/iteration
561 C Increment number of outer iterations
562 nouter
= nouter
+ nn1
- nn0
563 if(nn1
.lt
.nri
) goto 10
565 C Write outer/inner iteration count to pointers
577 C Gromacs nonbonded kernel f77skernel134nf
578 C Coulomb interaction: Normal Coulomb
579 C VdW interaction: Tabulated
580 C water optimization: pairs of TIP4P interactions
581 C Calculate forces: no
583 subroutine f77skernel134nf
(
616 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
617 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
618 integer*4 gid
(*),type
(*),ntype
619 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
620 real*4 Vvdw
(*),tabscale
,VFtab
(*)
621 real*4 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
622 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
625 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
626 integer*4 nn0
,nn1
,nouter
,ninner
628 real*4 qq
,vcoul
,vctot
634 real*4 Y
,F
,Geps
,Heps2
,Fp
,VV
643 real*4 dx11
,dy11
,dz11
,rsq11
,rinv11
644 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
645 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
646 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
647 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
648 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
649 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
650 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
651 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
652 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
653 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
657 C Initialize water data
664 tj
= 2*(ntype
+1)*type
(ii
)+1
669 C Reset outer and inner iteration counters
673 C Loop over thread workunits
674 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
675 if(nn1
.gt
.nri
) nn1
=nri
677 C Start outer loop over neighborlists
681 C Load shift vector for this list
684 shY
= shiftvec
(is3
+1)
685 shZ
= shiftvec
(is3
+2)
687 C Load limits for loop over neighbors
691 C Get outer coordinate index
695 C Load i atom data, add shift vector
696 ix1
= shX
+ pos
(ii3
+0)
697 iy1
= shY
+ pos
(ii3
+1)
698 iz1
= shZ
+ pos
(ii3
+2)
699 ix2
= shX
+ pos
(ii3
+3)
700 iy2
= shY
+ pos
(ii3
+4)
701 iz2
= shZ
+ pos
(ii3
+5)
702 ix3
= shX
+ pos
(ii3
+6)
703 iy3
= shY
+ pos
(ii3
+7)
704 iz3
= shZ
+ pos
(ii3
+8)
705 ix4
= shX
+ pos
(ii3
+9)
706 iy4
= shY
+ pos
(ii3
+10)
707 iz4
= shZ
+ pos
(ii3
+11)
709 C Zero the potential energy for this list
713 C Clear i atom forces
717 C Get j neighbor index, and coordinate index
721 C load j atom coordinates
739 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
743 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
747 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
751 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
755 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
759 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
763 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
767 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
771 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
775 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
777 C Calculate 1/r and 1/r2
778 rinv11
= 1.0/sqrt
(rsq11
)
779 rinv22
= 1.0/sqrt
(rsq22
)
780 rinv23
= 1.0/sqrt
(rsq23
)
781 rinv24
= 1.0/sqrt
(rsq24
)
782 rinv32
= 1.0/sqrt
(rsq32
)
783 rinv33
= 1.0/sqrt
(rsq33
)
784 rinv34
= 1.0/sqrt
(rsq34
)
785 rinv42
= 1.0/sqrt
(rsq42
)
786 rinv43
= 1.0/sqrt
(rsq43
)
787 rinv44
= 1.0/sqrt
(rsq44
)
789 C Load parameters for j atom
791 C Calculate table index
794 C Calculate table index
801 C Tabulated VdW interaction - dispersion
804 Geps
= eps*VFtab
(nnn
+2)
805 Heps2
= eps2*VFtab
(nnn
+3)
810 C Tabulated VdW interaction - repulsion
814 Geps
= eps*VFtab
(nnn
+2)
815 Heps2
= eps2*VFtab
(nnn
+3)
819 Vvdwtot
= Vvdwtot
+ Vvdw6
+ Vvdw12
821 C Load parameters for j atom
824 C Coulomb interaction
828 C Load parameters for j atom
831 C Coulomb interaction
835 C Load parameters for j atom
838 C Coulomb interaction
842 C Load parameters for j atom
845 C Coulomb interaction
849 C Load parameters for j atom
852 C Coulomb interaction
856 C Load parameters for j atom
859 C Coulomb interaction
863 C Load parameters for j atom
866 C Coulomb interaction
870 C Load parameters for j atom
873 C Coulomb interaction
877 C Load parameters for j atom
880 C Coulomb interaction
884 C Inner loop uses 168 flops/iteration
888 C Add i forces to mem and shifted force list
890 C Add potential energies to the group for this list
892 Vc
(ggid
) = Vc
(ggid
) + vctot
893 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
895 C Increment number of inner iterations
896 ninner
= ninner
+ nj1
- nj0
898 C Outer loop uses 14 flops/iteration
902 C Increment number of outer iterations
903 nouter
= nouter
+ nn1
- nn0
904 if(nn1
.lt
.nri
) goto 10
906 C Write outer/inner iteration count to pointers