2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014.2015,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS c kernel generator.
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW3W3_VF_c
49 * Electrostatics interaction: Coulomb
50 * VdW interaction: Buckingham
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCoul_VdwBham_GeomW3W3_VF_c
56 (t_nblist
* gmx_restrict nlist
,
57 rvec
* gmx_restrict xx
,
58 rvec
* gmx_restrict ff
,
59 struct t_forcerec
* gmx_restrict fr
,
60 t_mdatoms
* gmx_restrict mdatoms
,
61 nb_kernel_data_t gmx_unused
* gmx_restrict kernel_data
,
62 t_nrnb
* gmx_restrict nrnb
)
64 int i_shift_offset
,i_coord_offset
,j_coord_offset
;
65 int j_index_start
,j_index_end
;
66 int nri
,inr
,ggid
,iidx
,jidx
,jnr
,outeriter
,inneriter
;
67 real shX
,shY
,shZ
,tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
;
68 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
69 real
*shiftvec
,*fshift
,*x
,*f
;
71 real ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
73 real ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
,iq1
,isai1
;
75 real ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
,iq2
,isai2
;
77 real jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
79 real jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
,jq1
,isaj1
;
81 real jx2
,jy2
,jz2
,fjx2
,fjy2
,fjz2
,jq2
,isaj2
;
82 real dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
,cexp1_00
,cexp2_00
;
83 real dx01
,dy01
,dz01
,rsq01
,rinv01
,rinvsq01
,r01
,qq01
,c6_01
,c12_01
,cexp1_01
,cexp2_01
;
84 real dx02
,dy02
,dz02
,rsq02
,rinv02
,rinvsq02
,r02
,qq02
,c6_02
,c12_02
,cexp1_02
,cexp2_02
;
85 real dx10
,dy10
,dz10
,rsq10
,rinv10
,rinvsq10
,r10
,qq10
,c6_10
,c12_10
,cexp1_10
,cexp2_10
;
86 real dx11
,dy11
,dz11
,rsq11
,rinv11
,rinvsq11
,r11
,qq11
,c6_11
,c12_11
,cexp1_11
,cexp2_11
;
87 real dx12
,dy12
,dz12
,rsq12
,rinv12
,rinvsq12
,r12
,qq12
,c6_12
,c12_12
,cexp1_12
,cexp2_12
;
88 real dx20
,dy20
,dz20
,rsq20
,rinv20
,rinvsq20
,r20
,qq20
,c6_20
,c12_20
,cexp1_20
,cexp2_20
;
89 real dx21
,dy21
,dz21
,rsq21
,rinv21
,rinvsq21
,r21
,qq21
,c6_21
,c12_21
,cexp1_21
,cexp2_21
;
90 real dx22
,dy22
,dz22
,rsq22
,rinv22
,rinvsq22
,r22
,qq22
,c6_22
,c12_22
,cexp1_22
,cexp2_22
;
91 real velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
94 real rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,br
,vvdwexp
,sh_vdw_invrcut6
;
103 jindex
= nlist
->jindex
;
105 shiftidx
= nlist
->shift
;
107 shiftvec
= fr
->shift_vec
[0];
108 fshift
= fr
->fshift
[0];
109 facel
= fr
->ic
->epsfac
;
110 charge
= mdatoms
->chargeA
;
111 nvdwtype
= fr
->ntype
;
113 vdwtype
= mdatoms
->typeA
;
115 /* Setup water-specific parameters */
116 inr
= nlist
->iinr
[0];
117 iq0
= facel
*charge
[inr
+0];
118 iq1
= facel
*charge
[inr
+1];
119 iq2
= facel
*charge
[inr
+2];
120 vdwioffset0
= 3*nvdwtype
*vdwtype
[inr
+0];
125 vdwjidx0
= 3*vdwtype
[inr
+0];
127 c6_00
= vdwparam
[vdwioffset0
+vdwjidx0
];
128 cexp1_00
= vdwparam
[vdwioffset0
+vdwjidx0
+1];
129 cexp2_00
= vdwparam
[vdwioffset0
+vdwjidx0
+2];
142 /* Start outer loop over neighborlists */
143 for(iidx
=0; iidx
<nri
; iidx
++)
145 /* Load shift vector for this list */
146 i_shift_offset
= DIM
*shiftidx
[iidx
];
147 shX
= shiftvec
[i_shift_offset
+XX
];
148 shY
= shiftvec
[i_shift_offset
+YY
];
149 shZ
= shiftvec
[i_shift_offset
+ZZ
];
151 /* Load limits for loop over neighbors */
152 j_index_start
= jindex
[iidx
];
153 j_index_end
= jindex
[iidx
+1];
155 /* Get outer coordinate index */
157 i_coord_offset
= DIM
*inr
;
159 /* Load i particle coords and add shift vector */
160 ix0
= shX
+ x
[i_coord_offset
+DIM
*0+XX
];
161 iy0
= shY
+ x
[i_coord_offset
+DIM
*0+YY
];
162 iz0
= shZ
+ x
[i_coord_offset
+DIM
*0+ZZ
];
163 ix1
= shX
+ x
[i_coord_offset
+DIM
*1+XX
];
164 iy1
= shY
+ x
[i_coord_offset
+DIM
*1+YY
];
165 iz1
= shZ
+ x
[i_coord_offset
+DIM
*1+ZZ
];
166 ix2
= shX
+ x
[i_coord_offset
+DIM
*2+XX
];
167 iy2
= shY
+ x
[i_coord_offset
+DIM
*2+YY
];
168 iz2
= shZ
+ x
[i_coord_offset
+DIM
*2+ZZ
];
180 /* Reset potential sums */
184 /* Start inner kernel loop */
185 for(jidx
=j_index_start
; jidx
<j_index_end
; jidx
++)
187 /* Get j neighbor index, and coordinate index */
189 j_coord_offset
= DIM
*jnr
;
191 /* load j atom coordinates */
192 jx0
= x
[j_coord_offset
+DIM
*0+XX
];
193 jy0
= x
[j_coord_offset
+DIM
*0+YY
];
194 jz0
= x
[j_coord_offset
+DIM
*0+ZZ
];
195 jx1
= x
[j_coord_offset
+DIM
*1+XX
];
196 jy1
= x
[j_coord_offset
+DIM
*1+YY
];
197 jz1
= x
[j_coord_offset
+DIM
*1+ZZ
];
198 jx2
= x
[j_coord_offset
+DIM
*2+XX
];
199 jy2
= x
[j_coord_offset
+DIM
*2+YY
];
200 jz2
= x
[j_coord_offset
+DIM
*2+ZZ
];
202 /* Calculate displacement vector */
231 /* Calculate squared distance and things based on it */
232 rsq00
= dx00
*dx00
+dy00
*dy00
+dz00
*dz00
;
233 rsq01
= dx01
*dx01
+dy01
*dy01
+dz01
*dz01
;
234 rsq02
= dx02
*dx02
+dy02
*dy02
+dz02
*dz02
;
235 rsq10
= dx10
*dx10
+dy10
*dy10
+dz10
*dz10
;
236 rsq11
= dx11
*dx11
+dy11
*dy11
+dz11
*dz11
;
237 rsq12
= dx12
*dx12
+dy12
*dy12
+dz12
*dz12
;
238 rsq20
= dx20
*dx20
+dy20
*dy20
+dz20
*dz20
;
239 rsq21
= dx21
*dx21
+dy21
*dy21
+dz21
*dz21
;
240 rsq22
= dx22
*dx22
+dy22
*dy22
+dz22
*dz22
;
242 rinv00
= 1.0/sqrt(rsq00
);
243 rinv01
= 1.0/sqrt(rsq01
);
244 rinv02
= 1.0/sqrt(rsq02
);
245 rinv10
= 1.0/sqrt(rsq10
);
246 rinv11
= 1.0/sqrt(rsq11
);
247 rinv12
= 1.0/sqrt(rsq12
);
248 rinv20
= 1.0/sqrt(rsq20
);
249 rinv21
= 1.0/sqrt(rsq21
);
250 rinv22
= 1.0/sqrt(rsq22
);
252 rinvsq00
= rinv00
*rinv00
;
253 rinvsq01
= rinv01
*rinv01
;
254 rinvsq02
= rinv02
*rinv02
;
255 rinvsq10
= rinv10
*rinv10
;
256 rinvsq11
= rinv11
*rinv11
;
257 rinvsq12
= rinv12
*rinv12
;
258 rinvsq20
= rinv20
*rinv20
;
259 rinvsq21
= rinv21
*rinv21
;
260 rinvsq22
= rinv22
*rinv22
;
262 /**************************
263 * CALCULATE INTERACTIONS *
264 **************************/
268 /* COULOMB ELECTROSTATICS */
270 felec
= velec
*rinvsq00
;
272 /* BUCKINGHAM DISPERSION/REPULSION */
273 rinvsix
= rinvsq00
*rinvsq00
*rinvsq00
;
274 vvdw6
= c6_00
*rinvsix
;
276 vvdwexp
= cexp1_00
*exp(-br
);
277 vvdw
= vvdwexp
- vvdw6
*(1.0/6.0);
278 fvdw
= (br
*vvdwexp
-vvdw6
)*rinvsq00
;
280 /* Update potential sums from outer loop */
286 /* Calculate temporary vectorial force */
291 /* Update vectorial force */
295 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
296 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
297 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
299 /**************************
300 * CALCULATE INTERACTIONS *
301 **************************/
303 /* COULOMB ELECTROSTATICS */
305 felec
= velec
*rinvsq01
;
307 /* Update potential sums from outer loop */
312 /* Calculate temporary vectorial force */
317 /* Update vectorial force */
321 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
322 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
323 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
325 /**************************
326 * CALCULATE INTERACTIONS *
327 **************************/
329 /* COULOMB ELECTROSTATICS */
331 felec
= velec
*rinvsq02
;
333 /* Update potential sums from outer loop */
338 /* Calculate temporary vectorial force */
343 /* Update vectorial force */
347 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
348 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
349 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
351 /**************************
352 * CALCULATE INTERACTIONS *
353 **************************/
355 /* COULOMB ELECTROSTATICS */
357 felec
= velec
*rinvsq10
;
359 /* Update potential sums from outer loop */
364 /* Calculate temporary vectorial force */
369 /* Update vectorial force */
373 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
374 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
375 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
377 /**************************
378 * CALCULATE INTERACTIONS *
379 **************************/
381 /* COULOMB ELECTROSTATICS */
383 felec
= velec
*rinvsq11
;
385 /* Update potential sums from outer loop */
390 /* Calculate temporary vectorial force */
395 /* Update vectorial force */
399 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
400 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
401 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
403 /**************************
404 * CALCULATE INTERACTIONS *
405 **************************/
407 /* COULOMB ELECTROSTATICS */
409 felec
= velec
*rinvsq12
;
411 /* Update potential sums from outer loop */
416 /* Calculate temporary vectorial force */
421 /* Update vectorial force */
425 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
426 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
427 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
429 /**************************
430 * CALCULATE INTERACTIONS *
431 **************************/
433 /* COULOMB ELECTROSTATICS */
435 felec
= velec
*rinvsq20
;
437 /* Update potential sums from outer loop */
442 /* Calculate temporary vectorial force */
447 /* Update vectorial force */
451 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
452 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
453 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
455 /**************************
456 * CALCULATE INTERACTIONS *
457 **************************/
459 /* COULOMB ELECTROSTATICS */
461 felec
= velec
*rinvsq21
;
463 /* Update potential sums from outer loop */
468 /* Calculate temporary vectorial force */
473 /* Update vectorial force */
477 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
478 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
479 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
481 /**************************
482 * CALCULATE INTERACTIONS *
483 **************************/
485 /* COULOMB ELECTROSTATICS */
487 felec
= velec
*rinvsq22
;
489 /* Update potential sums from outer loop */
494 /* Calculate temporary vectorial force */
499 /* Update vectorial force */
503 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
504 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
505 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
507 /* Inner loop uses 282 flops */
509 /* End of innermost loop */
512 f
[i_coord_offset
+DIM
*0+XX
] += fix0
;
513 f
[i_coord_offset
+DIM
*0+YY
] += fiy0
;
514 f
[i_coord_offset
+DIM
*0+ZZ
] += fiz0
;
518 f
[i_coord_offset
+DIM
*1+XX
] += fix1
;
519 f
[i_coord_offset
+DIM
*1+YY
] += fiy1
;
520 f
[i_coord_offset
+DIM
*1+ZZ
] += fiz1
;
524 f
[i_coord_offset
+DIM
*2+XX
] += fix2
;
525 f
[i_coord_offset
+DIM
*2+YY
] += fiy2
;
526 f
[i_coord_offset
+DIM
*2+ZZ
] += fiz2
;
530 fshift
[i_shift_offset
+XX
] += tx
;
531 fshift
[i_shift_offset
+YY
] += ty
;
532 fshift
[i_shift_offset
+ZZ
] += tz
;
535 /* Update potential energies */
536 kernel_data
->energygrp_elec
[ggid
] += velecsum
;
537 kernel_data
->energygrp_vdw
[ggid
] += vvdwsum
;
539 /* Increment number of inner iterations */
540 inneriter
+= j_index_end
- j_index_start
;
542 /* Outer loop uses 32 flops */
545 /* Increment number of outer iterations */
548 /* Update outer/inner flops */
550 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_W3W3_VF
,outeriter
*32 + inneriter
*282);
553 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW3W3_F_c
554 * Electrostatics interaction: Coulomb
555 * VdW interaction: Buckingham
556 * Geometry: Water3-Water3
557 * Calculate force/pot: Force
560 nb_kernel_ElecCoul_VdwBham_GeomW3W3_F_c
561 (t_nblist
* gmx_restrict nlist
,
562 rvec
* gmx_restrict xx
,
563 rvec
* gmx_restrict ff
,
564 struct t_forcerec
* gmx_restrict fr
,
565 t_mdatoms
* gmx_restrict mdatoms
,
566 nb_kernel_data_t gmx_unused
* gmx_restrict kernel_data
,
567 t_nrnb
* gmx_restrict nrnb
)
569 int i_shift_offset
,i_coord_offset
,j_coord_offset
;
570 int j_index_start
,j_index_end
;
571 int nri
,inr
,ggid
,iidx
,jidx
,jnr
,outeriter
,inneriter
;
572 real shX
,shY
,shZ
,tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
;
573 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
574 real
*shiftvec
,*fshift
,*x
,*f
;
576 real ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
578 real ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
,iq1
,isai1
;
580 real ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
,iq2
,isai2
;
582 real jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
584 real jx1
,jy1
,jz1
,fjx1
,fjy1
,fjz1
,jq1
,isaj1
;
586 real jx2
,jy2
,jz2
,fjx2
,fjy2
,fjz2
,jq2
,isaj2
;
587 real dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
,cexp1_00
,cexp2_00
;
588 real dx01
,dy01
,dz01
,rsq01
,rinv01
,rinvsq01
,r01
,qq01
,c6_01
,c12_01
,cexp1_01
,cexp2_01
;
589 real dx02
,dy02
,dz02
,rsq02
,rinv02
,rinvsq02
,r02
,qq02
,c6_02
,c12_02
,cexp1_02
,cexp2_02
;
590 real dx10
,dy10
,dz10
,rsq10
,rinv10
,rinvsq10
,r10
,qq10
,c6_10
,c12_10
,cexp1_10
,cexp2_10
;
591 real dx11
,dy11
,dz11
,rsq11
,rinv11
,rinvsq11
,r11
,qq11
,c6_11
,c12_11
,cexp1_11
,cexp2_11
;
592 real dx12
,dy12
,dz12
,rsq12
,rinv12
,rinvsq12
,r12
,qq12
,c6_12
,c12_12
,cexp1_12
,cexp2_12
;
593 real dx20
,dy20
,dz20
,rsq20
,rinv20
,rinvsq20
,r20
,qq20
,c6_20
,c12_20
,cexp1_20
,cexp2_20
;
594 real dx21
,dy21
,dz21
,rsq21
,rinv21
,rinvsq21
,r21
,qq21
,c6_21
,c12_21
,cexp1_21
,cexp2_21
;
595 real dx22
,dy22
,dz22
,rsq22
,rinv22
,rinvsq22
,r22
,qq22
,c6_22
,c12_22
,cexp1_22
,cexp2_22
;
596 real velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
599 real rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,br
,vvdwexp
,sh_vdw_invrcut6
;
608 jindex
= nlist
->jindex
;
610 shiftidx
= nlist
->shift
;
612 shiftvec
= fr
->shift_vec
[0];
613 fshift
= fr
->fshift
[0];
614 facel
= fr
->ic
->epsfac
;
615 charge
= mdatoms
->chargeA
;
616 nvdwtype
= fr
->ntype
;
618 vdwtype
= mdatoms
->typeA
;
620 /* Setup water-specific parameters */
621 inr
= nlist
->iinr
[0];
622 iq0
= facel
*charge
[inr
+0];
623 iq1
= facel
*charge
[inr
+1];
624 iq2
= facel
*charge
[inr
+2];
625 vdwioffset0
= 3*nvdwtype
*vdwtype
[inr
+0];
630 vdwjidx0
= 3*vdwtype
[inr
+0];
632 c6_00
= vdwparam
[vdwioffset0
+vdwjidx0
];
633 cexp1_00
= vdwparam
[vdwioffset0
+vdwjidx0
+1];
634 cexp2_00
= vdwparam
[vdwioffset0
+vdwjidx0
+2];
647 /* Start outer loop over neighborlists */
648 for(iidx
=0; iidx
<nri
; iidx
++)
650 /* Load shift vector for this list */
651 i_shift_offset
= DIM
*shiftidx
[iidx
];
652 shX
= shiftvec
[i_shift_offset
+XX
];
653 shY
= shiftvec
[i_shift_offset
+YY
];
654 shZ
= shiftvec
[i_shift_offset
+ZZ
];
656 /* Load limits for loop over neighbors */
657 j_index_start
= jindex
[iidx
];
658 j_index_end
= jindex
[iidx
+1];
660 /* Get outer coordinate index */
662 i_coord_offset
= DIM
*inr
;
664 /* Load i particle coords and add shift vector */
665 ix0
= shX
+ x
[i_coord_offset
+DIM
*0+XX
];
666 iy0
= shY
+ x
[i_coord_offset
+DIM
*0+YY
];
667 iz0
= shZ
+ x
[i_coord_offset
+DIM
*0+ZZ
];
668 ix1
= shX
+ x
[i_coord_offset
+DIM
*1+XX
];
669 iy1
= shY
+ x
[i_coord_offset
+DIM
*1+YY
];
670 iz1
= shZ
+ x
[i_coord_offset
+DIM
*1+ZZ
];
671 ix2
= shX
+ x
[i_coord_offset
+DIM
*2+XX
];
672 iy2
= shY
+ x
[i_coord_offset
+DIM
*2+YY
];
673 iz2
= shZ
+ x
[i_coord_offset
+DIM
*2+ZZ
];
685 /* Start inner kernel loop */
686 for(jidx
=j_index_start
; jidx
<j_index_end
; jidx
++)
688 /* Get j neighbor index, and coordinate index */
690 j_coord_offset
= DIM
*jnr
;
692 /* load j atom coordinates */
693 jx0
= x
[j_coord_offset
+DIM
*0+XX
];
694 jy0
= x
[j_coord_offset
+DIM
*0+YY
];
695 jz0
= x
[j_coord_offset
+DIM
*0+ZZ
];
696 jx1
= x
[j_coord_offset
+DIM
*1+XX
];
697 jy1
= x
[j_coord_offset
+DIM
*1+YY
];
698 jz1
= x
[j_coord_offset
+DIM
*1+ZZ
];
699 jx2
= x
[j_coord_offset
+DIM
*2+XX
];
700 jy2
= x
[j_coord_offset
+DIM
*2+YY
];
701 jz2
= x
[j_coord_offset
+DIM
*2+ZZ
];
703 /* Calculate displacement vector */
732 /* Calculate squared distance and things based on it */
733 rsq00
= dx00
*dx00
+dy00
*dy00
+dz00
*dz00
;
734 rsq01
= dx01
*dx01
+dy01
*dy01
+dz01
*dz01
;
735 rsq02
= dx02
*dx02
+dy02
*dy02
+dz02
*dz02
;
736 rsq10
= dx10
*dx10
+dy10
*dy10
+dz10
*dz10
;
737 rsq11
= dx11
*dx11
+dy11
*dy11
+dz11
*dz11
;
738 rsq12
= dx12
*dx12
+dy12
*dy12
+dz12
*dz12
;
739 rsq20
= dx20
*dx20
+dy20
*dy20
+dz20
*dz20
;
740 rsq21
= dx21
*dx21
+dy21
*dy21
+dz21
*dz21
;
741 rsq22
= dx22
*dx22
+dy22
*dy22
+dz22
*dz22
;
743 rinv00
= 1.0/sqrt(rsq00
);
744 rinv01
= 1.0/sqrt(rsq01
);
745 rinv02
= 1.0/sqrt(rsq02
);
746 rinv10
= 1.0/sqrt(rsq10
);
747 rinv11
= 1.0/sqrt(rsq11
);
748 rinv12
= 1.0/sqrt(rsq12
);
749 rinv20
= 1.0/sqrt(rsq20
);
750 rinv21
= 1.0/sqrt(rsq21
);
751 rinv22
= 1.0/sqrt(rsq22
);
753 rinvsq00
= rinv00
*rinv00
;
754 rinvsq01
= rinv01
*rinv01
;
755 rinvsq02
= rinv02
*rinv02
;
756 rinvsq10
= rinv10
*rinv10
;
757 rinvsq11
= rinv11
*rinv11
;
758 rinvsq12
= rinv12
*rinv12
;
759 rinvsq20
= rinv20
*rinv20
;
760 rinvsq21
= rinv21
*rinv21
;
761 rinvsq22
= rinv22
*rinv22
;
763 /**************************
764 * CALCULATE INTERACTIONS *
765 **************************/
769 /* COULOMB ELECTROSTATICS */
771 felec
= velec
*rinvsq00
;
773 /* BUCKINGHAM DISPERSION/REPULSION */
774 rinvsix
= rinvsq00
*rinvsq00
*rinvsq00
;
775 vvdw6
= c6_00
*rinvsix
;
777 vvdwexp
= cexp1_00
*exp(-br
);
778 fvdw
= (br
*vvdwexp
-vvdw6
)*rinvsq00
;
782 /* Calculate temporary vectorial force */
787 /* Update vectorial force */
791 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
792 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
793 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
795 /**************************
796 * CALCULATE INTERACTIONS *
797 **************************/
799 /* COULOMB ELECTROSTATICS */
801 felec
= velec
*rinvsq01
;
805 /* Calculate temporary vectorial force */
810 /* Update vectorial force */
814 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
815 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
816 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
818 /**************************
819 * CALCULATE INTERACTIONS *
820 **************************/
822 /* COULOMB ELECTROSTATICS */
824 felec
= velec
*rinvsq02
;
828 /* Calculate temporary vectorial force */
833 /* Update vectorial force */
837 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
838 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
839 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
841 /**************************
842 * CALCULATE INTERACTIONS *
843 **************************/
845 /* COULOMB ELECTROSTATICS */
847 felec
= velec
*rinvsq10
;
851 /* Calculate temporary vectorial force */
856 /* Update vectorial force */
860 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
861 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
862 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
864 /**************************
865 * CALCULATE INTERACTIONS *
866 **************************/
868 /* COULOMB ELECTROSTATICS */
870 felec
= velec
*rinvsq11
;
874 /* Calculate temporary vectorial force */
879 /* Update vectorial force */
883 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
884 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
885 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
887 /**************************
888 * CALCULATE INTERACTIONS *
889 **************************/
891 /* COULOMB ELECTROSTATICS */
893 felec
= velec
*rinvsq12
;
897 /* Calculate temporary vectorial force */
902 /* Update vectorial force */
906 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
907 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
908 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
910 /**************************
911 * CALCULATE INTERACTIONS *
912 **************************/
914 /* COULOMB ELECTROSTATICS */
916 felec
= velec
*rinvsq20
;
920 /* Calculate temporary vectorial force */
925 /* Update vectorial force */
929 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
930 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
931 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
933 /**************************
934 * CALCULATE INTERACTIONS *
935 **************************/
937 /* COULOMB ELECTROSTATICS */
939 felec
= velec
*rinvsq21
;
943 /* Calculate temporary vectorial force */
948 /* Update vectorial force */
952 f
[j_coord_offset
+DIM
*1+XX
] -= tx
;
953 f
[j_coord_offset
+DIM
*1+YY
] -= ty
;
954 f
[j_coord_offset
+DIM
*1+ZZ
] -= tz
;
956 /**************************
957 * CALCULATE INTERACTIONS *
958 **************************/
960 /* COULOMB ELECTROSTATICS */
962 felec
= velec
*rinvsq22
;
966 /* Calculate temporary vectorial force */
971 /* Update vectorial force */
975 f
[j_coord_offset
+DIM
*2+XX
] -= tx
;
976 f
[j_coord_offset
+DIM
*2+YY
] -= ty
;
977 f
[j_coord_offset
+DIM
*2+ZZ
] -= tz
;
979 /* Inner loop uses 270 flops */
981 /* End of innermost loop */
984 f
[i_coord_offset
+DIM
*0+XX
] += fix0
;
985 f
[i_coord_offset
+DIM
*0+YY
] += fiy0
;
986 f
[i_coord_offset
+DIM
*0+ZZ
] += fiz0
;
990 f
[i_coord_offset
+DIM
*1+XX
] += fix1
;
991 f
[i_coord_offset
+DIM
*1+YY
] += fiy1
;
992 f
[i_coord_offset
+DIM
*1+ZZ
] += fiz1
;
996 f
[i_coord_offset
+DIM
*2+XX
] += fix2
;
997 f
[i_coord_offset
+DIM
*2+YY
] += fiy2
;
998 f
[i_coord_offset
+DIM
*2+ZZ
] += fiz2
;
1002 fshift
[i_shift_offset
+XX
] += tx
;
1003 fshift
[i_shift_offset
+YY
] += ty
;
1004 fshift
[i_shift_offset
+ZZ
] += tz
;
1006 /* Increment number of inner iterations */
1007 inneriter
+= j_index_end
- j_index_start
;
1009 /* Outer loop uses 30 flops */
1012 /* Increment number of outer iterations */
1015 /* Update outer/inner flops */
1017 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_W3W3_F
,outeriter
*30 + inneriter
*270);