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 f77skernel114
33 C Coulomb interaction: Normal Coulomb
34 C VdW interaction: Lennard-Jones
35 C water optimization: pairs of TIP4P interactions
36 C Calculate forces: yes
38 subroutine f77skernel114
(
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
90 real*4 ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
91 real*4 ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
92 real*4 ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
93 real*4 ix4
,iy4
,iz4
,fix4
,fiy4
,fiz4
95 real*4 jx2
,jy2
,jz2
,fjx2
,fjy2
,fjz2
96 real*4 jx3
,jy3
,jz3
,fjx3
,fjy3
,fjz3
97 real*4 jx4
,jy4
,jz4
,fjx4
,fjy4
,fjz4
98 real*4 dx11
,dy11
,dz11
,rsq11
99 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
100 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
101 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
102 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
103 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
104 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
105 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
106 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
107 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
108 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
112 C Initialize water data
119 tj
= 2*(ntype
+1)*type
(ii
)+1
124 C Reset outer and inner iteration counters
128 C Loop over thread workunits
129 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
130 if(nn1
.gt
.nri
) nn1
=nri
132 C Start outer loop over neighborlists
136 C Load shift vector for this list
139 shY
= shiftvec
(is3
+1)
140 shZ
= shiftvec
(is3
+2)
142 C Load limits for loop over neighbors
146 C Get outer coordinate index
150 C Load i atom data, add shift vector
151 ix1
= shX
+ pos
(ii3
+0)
152 iy1
= shY
+ pos
(ii3
+1)
153 iz1
= shZ
+ pos
(ii3
+2)
154 ix2
= shX
+ pos
(ii3
+3)
155 iy2
= shY
+ pos
(ii3
+4)
156 iz2
= shZ
+ pos
(ii3
+5)
157 ix3
= shX
+ pos
(ii3
+6)
158 iy3
= shY
+ pos
(ii3
+7)
159 iz3
= shZ
+ pos
(ii3
+8)
160 ix4
= shX
+ pos
(ii3
+9)
161 iy4
= shY
+ pos
(ii3
+10)
162 iz4
= shZ
+ pos
(ii3
+11)
164 C Zero the potential energy for this list
168 C Clear i atom forces
184 C Get j neighbor index, and coordinate index
188 C load j atom coordinates
206 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
210 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
214 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
218 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
222 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
226 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
230 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
234 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
238 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
242 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
244 C Calculate 1/r and 1/r2
246 rinv22
= 1.0/sqrt
(rsq22
)
247 rinv23
= 1.0/sqrt
(rsq23
)
248 rinv24
= 1.0/sqrt
(rsq24
)
249 rinv32
= 1.0/sqrt
(rsq32
)
250 rinv33
= 1.0/sqrt
(rsq33
)
251 rinv34
= 1.0/sqrt
(rsq34
)
252 rinv42
= 1.0/sqrt
(rsq42
)
253 rinv43
= 1.0/sqrt
(rsq43
)
254 rinv44
= 1.0/sqrt
(rsq44
)
256 C Load parameters for j atom
258 C Lennard-Jones interaction
259 rinvsix
= rinvsq*rinvsq*rinvsq
261 Vvdw12
= c12*rinvsix*rinvsix
262 Vvdwtot
= Vvdwtot
+Vvdw12
-Vvdw6
263 fscal
= (12.0*Vvdw12
-6.0*Vvdw6
)*rinvsq
265 C Calculate temporary vectorial force
270 C Increment i atom force
275 C Decrement j atom force
276 faction
(j3
+0) = faction
(j3
+0) - tx
277 faction
(j3
+1) = faction
(j3
+1) - ty
278 faction
(j3
+2) = faction
(j3
+2) - tz
280 C Load parameters for j atom
282 rinvsq
= rinv22*rinv22
284 C Coulomb interaction
287 fscal
= (vcoul
)*rinvsq
289 C Calculate temporary vectorial force
294 C Increment i atom force
299 C Decrement j atom force
300 fjx2
= faction
(j3
+3) - tx
301 fjy2
= faction
(j3
+4) - ty
302 fjz2
= faction
(j3
+5) - tz
304 C Load parameters for j atom
306 rinvsq
= rinv23*rinv23
308 C Coulomb interaction
311 fscal
= (vcoul
)*rinvsq
313 C Calculate temporary vectorial force
318 C Increment i atom force
323 C Decrement j atom force
324 fjx3
= faction
(j3
+6) - tx
325 fjy3
= faction
(j3
+7) - ty
326 fjz3
= faction
(j3
+8) - tz
328 C Load parameters for j atom
330 rinvsq
= rinv24*rinv24
332 C Coulomb interaction
335 fscal
= (vcoul
)*rinvsq
337 C Calculate temporary vectorial force
342 C Increment i atom force
347 C Decrement j atom force
348 fjx4
= faction
(j3
+9) - tx
349 fjy4
= faction
(j3
+10) - ty
350 fjz4
= faction
(j3
+11) - tz
352 C Load parameters for j atom
354 rinvsq
= rinv32*rinv32
356 C Coulomb interaction
359 fscal
= (vcoul
)*rinvsq
361 C Calculate temporary vectorial force
366 C Increment i atom force
371 C Decrement j atom force
376 C Load parameters for j atom
378 rinvsq
= rinv33*rinv33
380 C Coulomb interaction
383 fscal
= (vcoul
)*rinvsq
385 C Calculate temporary vectorial force
390 C Increment i atom force
395 C Decrement j atom force
400 C Load parameters for j atom
402 rinvsq
= rinv34*rinv34
404 C Coulomb interaction
407 fscal
= (vcoul
)*rinvsq
409 C Calculate temporary vectorial force
414 C Increment i atom force
419 C Decrement j atom force
424 C Load parameters for j atom
426 rinvsq
= rinv42*rinv42
428 C Coulomb interaction
431 fscal
= (vcoul
)*rinvsq
433 C Calculate temporary vectorial force
438 C Increment i atom force
443 C Decrement j atom force
444 faction
(j3
+3) = fjx2
- tx
445 faction
(j3
+4) = fjy2
- ty
446 faction
(j3
+5) = fjz2
- tz
448 C Load parameters for j atom
450 rinvsq
= rinv43*rinv43
452 C Coulomb interaction
455 fscal
= (vcoul
)*rinvsq
457 C Calculate temporary vectorial force
462 C Increment i atom force
467 C Decrement j atom force
468 faction
(j3
+6) = fjx3
- tx
469 faction
(j3
+7) = fjy3
- ty
470 faction
(j3
+8) = fjz3
- tz
472 C Load parameters for j atom
474 rinvsq
= rinv44*rinv44
476 C Coulomb interaction
479 fscal
= (vcoul
)*rinvsq
481 C Calculate temporary vectorial force
486 C Increment i atom force
491 C Decrement j atom force
492 faction
(j3
+9) = fjx4
- tx
493 faction
(j3
+10) = fjy4
- ty
494 faction
(j3
+11) = fjz4
- tz
496 C Inner loop uses 267 flops/iteration
500 C Add i forces to mem and shifted force list
501 faction
(ii3
+0) = faction
(ii3
+0) + fix1
502 faction
(ii3
+1) = faction
(ii3
+1) + fiy1
503 faction
(ii3
+2) = faction
(ii3
+2) + fiz1
504 faction
(ii3
+3) = faction
(ii3
+3) + fix2
505 faction
(ii3
+4) = faction
(ii3
+4) + fiy2
506 faction
(ii3
+5) = faction
(ii3
+5) + fiz2
507 faction
(ii3
+6) = faction
(ii3
+6) + fix3
508 faction
(ii3
+7) = faction
(ii3
+7) + fiy3
509 faction
(ii3
+8) = faction
(ii3
+8) + fiz3
510 faction
(ii3
+9) = faction
(ii3
+9) + fix4
511 faction
(ii3
+10) = faction
(ii3
+10) + fiy4
512 faction
(ii3
+11) = faction
(ii3
+11) + fiz4
513 fshift
(is3
) = fshift
(is3
)+fix1
+fix2
+fix3
+fix4
514 fshift
(is3
+1) = fshift
(is3
+1)+fiy1
+fiy2
+fiy3
+fiy4
515 fshift
(is3
+2) = fshift
(is3
+2)+fiz1
+fiz2
+fiz3
+fiz4
517 C Add potential energies to the group for this list
519 Vc
(ggid
) = Vc
(ggid
) + vctot
520 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
522 C Increment number of inner iterations
523 ninner
= ninner
+ nj1
- nj0
525 C Outer loop uses 38 flops/iteration
529 C Increment number of outer iterations
530 nouter
= nouter
+ nn1
- nn0
531 if(nn1
.lt
.nri
) goto 10
533 C Write outer/inner iteration count to pointers
545 C Gromacs nonbonded kernel f77skernel114nf
546 C Coulomb interaction: Normal Coulomb
547 C VdW interaction: Lennard-Jones
548 C water optimization: pairs of TIP4P interactions
549 C Calculate forces: no
551 subroutine f77skernel114nf
(
584 integer*4 nri
,iinr
(*),jindex
(*),jjnr
(*),shift
(*)
585 real*4 shiftvec
(*),fshift
(*),pos
(*),faction
(*)
586 integer*4 gid
(*),type
(*),ntype
587 real*4 charge
(*),facel
,krf
,crf
,Vc
(*),vdwparam
(*)
588 real*4 Vvdw
(*),tabscale
,VFtab
(*)
589 real*4 invsqrta
(*),dvda
(*),gbtabscale
,GBtab
(*)
590 integer*4 nthreads
,count
,mtx
,outeriter
,inneriter
593 integer*4 n
,ii
,is3
,ii3
,k
,nj0
,nj1
,jnr
,j3
,ggid
594 integer*4 nn0
,nn1
,nouter
,ninner
597 real*4 qq
,vcoul
,vctot
610 real*4 dx11
,dy11
,dz11
,rsq11
611 real*4 dx22
,dy22
,dz22
,rsq22
,rinv22
612 real*4 dx23
,dy23
,dz23
,rsq23
,rinv23
613 real*4 dx24
,dy24
,dz24
,rsq24
,rinv24
614 real*4 dx32
,dy32
,dz32
,rsq32
,rinv32
615 real*4 dx33
,dy33
,dz33
,rsq33
,rinv33
616 real*4 dx34
,dy34
,dz34
,rsq34
,rinv34
617 real*4 dx42
,dy42
,dz42
,rsq42
,rinv42
618 real*4 dx43
,dy43
,dz43
,rsq43
,rinv43
619 real*4 dx44
,dy44
,dz44
,rsq44
,rinv44
620 real*4 qH
,qM
,qqMM
,qqMH
,qqHH
624 C Initialize water data
631 tj
= 2*(ntype
+1)*type
(ii
)+1
636 C Reset outer and inner iteration counters
640 C Loop over thread workunits
641 10 call f77kernelsync
(mtx
,count
,nri
,nthreads
,nn0
,nn1
)
642 if(nn1
.gt
.nri
) nn1
=nri
644 C Start outer loop over neighborlists
648 C Load shift vector for this list
651 shY
= shiftvec
(is3
+1)
652 shZ
= shiftvec
(is3
+2)
654 C Load limits for loop over neighbors
658 C Get outer coordinate index
662 C Load i atom data, add shift vector
663 ix1
= shX
+ pos
(ii3
+0)
664 iy1
= shY
+ pos
(ii3
+1)
665 iz1
= shZ
+ pos
(ii3
+2)
666 ix2
= shX
+ pos
(ii3
+3)
667 iy2
= shY
+ pos
(ii3
+4)
668 iz2
= shZ
+ pos
(ii3
+5)
669 ix3
= shX
+ pos
(ii3
+6)
670 iy3
= shY
+ pos
(ii3
+7)
671 iz3
= shZ
+ pos
(ii3
+8)
672 ix4
= shX
+ pos
(ii3
+9)
673 iy4
= shY
+ pos
(ii3
+10)
674 iz4
= shZ
+ pos
(ii3
+11)
676 C Zero the potential energy for this list
680 C Clear i atom forces
684 C Get j neighbor index, and coordinate index
688 C load j atom coordinates
706 rsq11
= dx11*dx11
+dy11*dy11
+dz11*dz11
710 rsq22
= dx22*dx22
+dy22*dy22
+dz22*dz22
714 rsq23
= dx23*dx23
+dy23*dy23
+dz23*dz23
718 rsq24
= dx24*dx24
+dy24*dy24
+dz24*dz24
722 rsq32
= dx32*dx32
+dy32*dy32
+dz32*dz32
726 rsq33
= dx33*dx33
+dy33*dy33
+dz33*dz33
730 rsq34
= dx34*dx34
+dy34*dy34
+dz34*dz34
734 rsq42
= dx42*dx42
+dy42*dy42
+dz42*dz42
738 rsq43
= dx43*dx43
+dy43*dy43
+dz43*dz43
742 rsq44
= dx44*dx44
+dy44*dy44
+dz44*dz44
744 C Calculate 1/r and 1/r2
746 rinv22
= 1.0/sqrt
(rsq22
)
747 rinv23
= 1.0/sqrt
(rsq23
)
748 rinv24
= 1.0/sqrt
(rsq24
)
749 rinv32
= 1.0/sqrt
(rsq32
)
750 rinv33
= 1.0/sqrt
(rsq33
)
751 rinv34
= 1.0/sqrt
(rsq34
)
752 rinv42
= 1.0/sqrt
(rsq42
)
753 rinv43
= 1.0/sqrt
(rsq43
)
754 rinv44
= 1.0/sqrt
(rsq44
)
756 C Load parameters for j atom
758 C Lennard-Jones interaction
759 rinvsix
= rinvsq*rinvsq*rinvsq
761 Vvdw12
= c12*rinvsix*rinvsix
762 Vvdwtot
= Vvdwtot
+Vvdw12
-Vvdw6
764 C Load parameters for j atom
767 C Coulomb interaction
771 C Load parameters for j atom
774 C Coulomb interaction
778 C Load parameters for j atom
781 C Coulomb interaction
785 C Load parameters for j atom
788 C Coulomb interaction
792 C Load parameters for j atom
795 C Coulomb interaction
799 C Load parameters for j atom
802 C Coulomb interaction
806 C Load parameters for j atom
809 C Coulomb interaction
813 C Load parameters for j atom
816 C Coulomb interaction
820 C Load parameters for j atom
823 C Coulomb interaction
827 C Inner loop uses 154 flops/iteration
831 C Add i forces to mem and shifted force list
833 C Add potential energies to the group for this list
835 Vc
(ggid
) = Vc
(ggid
) + vctot
836 Vvdw
(ggid
) = Vvdw
(ggid
) + Vvdwtot
838 C Increment number of inner iterations
839 ninner
= ninner
+ nj1
- nj0
841 C Outer loop uses 14 flops/iteration
845 C Increment number of outer iterations
846 nouter
= nouter
+ nn1
- nn0
847 if(nn1
.lt
.nri
) goto 10
849 C Write outer/inner iteration count to pointers