2 * Note: this file was generated by the Gromacs c kernel generator.
4 * This source code is part of
8 * Copyright (c) 2001-2012, The GROMACS Development Team
10 * Gromacs is a library for molecular simulation and trajectory analysis,
11 * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12 * a full list of developers and information, check out http://www.gromacs.org
14 * This program is free software; you can redistribute it and/or modify it under
15 * the terms of the GNU Lesser General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option) any
19 * To help fund GROMACS development, we humbly ask that you cite
20 * the papers people have written on it - you can find them on the website.
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
34 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_VF_c
35 * Electrostatics interaction: Coulomb
36 * VdW interaction: Buckingham
37 * Geometry: Water4-Water4
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCoul_VdwBham_GeomW4W4_VF_c
42 (t_nblist * gmx_restrict nlist,
43 rvec * gmx_restrict xx,
44 rvec * gmx_restrict ff,
45 t_forcerec * gmx_restrict fr,
46 t_mdatoms * gmx_restrict mdatoms,
47 nb_kernel_data_t * gmx_restrict kernel_data,
48 t_nrnb * gmx_restrict nrnb)
50 int i_shift_offset,i_coord_offset,j_coord_offset;
51 int j_index_start,j_index_end;
52 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
55 real *shiftvec,*fshift,*x,*f;
57 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
59 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
61 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
63 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
65 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
67 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
69 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
71 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
72 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
73 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
74 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
75 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
76 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
77 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
78 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
79 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
80 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
81 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
82 real velec,felec,velecsum,facel,crf,krf,krf2;
85 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
94 jindex = nlist->jindex;
96 shiftidx = nlist->shift;
98 shiftvec = fr->shift_vec[0];
99 fshift = fr->fshift[0];
101 charge = mdatoms->chargeA;
102 nvdwtype = fr->ntype;
104 vdwtype = mdatoms->typeA;
106 /* Setup water-specific parameters */
107 inr = nlist->iinr[0];
108 iq1 = facel*charge[inr+1];
109 iq2 = facel*charge[inr+2];
110 iq3 = facel*charge[inr+3];
111 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
116 vdwjidx0 = 3*vdwtype[inr+0];
117 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
118 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
119 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
136 /* Load shift vector for this list */
137 i_shift_offset = DIM*shiftidx[iidx];
138 shX = shiftvec[i_shift_offset+XX];
139 shY = shiftvec[i_shift_offset+YY];
140 shZ = shiftvec[i_shift_offset+ZZ];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 ix0 = shX + x[i_coord_offset+DIM*0+XX];
152 iy0 = shY + x[i_coord_offset+DIM*0+YY];
153 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
154 ix1 = shX + x[i_coord_offset+DIM*1+XX];
155 iy1 = shY + x[i_coord_offset+DIM*1+YY];
156 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
157 ix2 = shX + x[i_coord_offset+DIM*2+XX];
158 iy2 = shY + x[i_coord_offset+DIM*2+YY];
159 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
160 ix3 = shX + x[i_coord_offset+DIM*3+XX];
161 iy3 = shY + x[i_coord_offset+DIM*3+YY];
162 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
177 /* Reset potential sums */
181 /* Start inner kernel loop */
182 for(jidx=j_index_start; jidx<j_index_end; jidx++)
184 /* Get j neighbor index, and coordinate index */
186 j_coord_offset = DIM*jnr;
188 /* load j atom coordinates */
189 jx0 = x[j_coord_offset+DIM*0+XX];
190 jy0 = x[j_coord_offset+DIM*0+YY];
191 jz0 = x[j_coord_offset+DIM*0+ZZ];
192 jx1 = x[j_coord_offset+DIM*1+XX];
193 jy1 = x[j_coord_offset+DIM*1+YY];
194 jz1 = x[j_coord_offset+DIM*1+ZZ];
195 jx2 = x[j_coord_offset+DIM*2+XX];
196 jy2 = x[j_coord_offset+DIM*2+YY];
197 jz2 = x[j_coord_offset+DIM*2+ZZ];
198 jx3 = x[j_coord_offset+DIM*3+XX];
199 jy3 = x[j_coord_offset+DIM*3+YY];
200 jz3 = x[j_coord_offset+DIM*3+ZZ];
202 /* Calculate displacement vector */
234 /* Calculate squared distance and things based on it */
235 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
236 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
237 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
238 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
239 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
240 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
241 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
242 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
243 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
244 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
246 rinv00 = gmx_invsqrt(rsq00);
247 rinv11 = gmx_invsqrt(rsq11);
248 rinv12 = gmx_invsqrt(rsq12);
249 rinv13 = gmx_invsqrt(rsq13);
250 rinv21 = gmx_invsqrt(rsq21);
251 rinv22 = gmx_invsqrt(rsq22);
252 rinv23 = gmx_invsqrt(rsq23);
253 rinv31 = gmx_invsqrt(rsq31);
254 rinv32 = gmx_invsqrt(rsq32);
255 rinv33 = gmx_invsqrt(rsq33);
257 rinvsq00 = rinv00*rinv00;
258 rinvsq11 = rinv11*rinv11;
259 rinvsq12 = rinv12*rinv12;
260 rinvsq13 = rinv13*rinv13;
261 rinvsq21 = rinv21*rinv21;
262 rinvsq22 = rinv22*rinv22;
263 rinvsq23 = rinv23*rinv23;
264 rinvsq31 = rinv31*rinv31;
265 rinvsq32 = rinv32*rinv32;
266 rinvsq33 = rinv33*rinv33;
268 /**************************
269 * CALCULATE INTERACTIONS *
270 **************************/
274 /* BUCKINGHAM DISPERSION/REPULSION */
275 rinvsix = rinvsq00*rinvsq00*rinvsq00;
276 vvdw6 = c6_00*rinvsix;
278 vvdwexp = cexp1_00*exp(-br);
279 vvdw = vvdwexp - vvdw6*(1.0/6.0);
280 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
282 /* Update potential sums from outer loop */
287 /* Calculate temporary vectorial force */
292 /* Update vectorial force */
296 f[j_coord_offset+DIM*0+XX] -= tx;
297 f[j_coord_offset+DIM*0+YY] -= ty;
298 f[j_coord_offset+DIM*0+ZZ] -= tz;
300 /**************************
301 * CALCULATE INTERACTIONS *
302 **************************/
304 /* COULOMB ELECTROSTATICS */
306 felec = velec*rinvsq11;
308 /* Update potential sums from outer loop */
313 /* Calculate temporary vectorial force */
318 /* Update vectorial force */
322 f[j_coord_offset+DIM*1+XX] -= tx;
323 f[j_coord_offset+DIM*1+YY] -= ty;
324 f[j_coord_offset+DIM*1+ZZ] -= tz;
326 /**************************
327 * CALCULATE INTERACTIONS *
328 **************************/
330 /* COULOMB ELECTROSTATICS */
332 felec = velec*rinvsq12;
334 /* Update potential sums from outer loop */
339 /* Calculate temporary vectorial force */
344 /* Update vectorial force */
348 f[j_coord_offset+DIM*2+XX] -= tx;
349 f[j_coord_offset+DIM*2+YY] -= ty;
350 f[j_coord_offset+DIM*2+ZZ] -= tz;
352 /**************************
353 * CALCULATE INTERACTIONS *
354 **************************/
356 /* COULOMB ELECTROSTATICS */
358 felec = velec*rinvsq13;
360 /* Update potential sums from outer loop */
365 /* Calculate temporary vectorial force */
370 /* Update vectorial force */
374 f[j_coord_offset+DIM*3+XX] -= tx;
375 f[j_coord_offset+DIM*3+YY] -= ty;
376 f[j_coord_offset+DIM*3+ZZ] -= tz;
378 /**************************
379 * CALCULATE INTERACTIONS *
380 **************************/
382 /* COULOMB ELECTROSTATICS */
384 felec = velec*rinvsq21;
386 /* Update potential sums from outer loop */
391 /* Calculate temporary vectorial force */
396 /* Update vectorial force */
400 f[j_coord_offset+DIM*1+XX] -= tx;
401 f[j_coord_offset+DIM*1+YY] -= ty;
402 f[j_coord_offset+DIM*1+ZZ] -= tz;
404 /**************************
405 * CALCULATE INTERACTIONS *
406 **************************/
408 /* COULOMB ELECTROSTATICS */
410 felec = velec*rinvsq22;
412 /* Update potential sums from outer loop */
417 /* Calculate temporary vectorial force */
422 /* Update vectorial force */
426 f[j_coord_offset+DIM*2+XX] -= tx;
427 f[j_coord_offset+DIM*2+YY] -= ty;
428 f[j_coord_offset+DIM*2+ZZ] -= tz;
430 /**************************
431 * CALCULATE INTERACTIONS *
432 **************************/
434 /* COULOMB ELECTROSTATICS */
436 felec = velec*rinvsq23;
438 /* Update potential sums from outer loop */
443 /* Calculate temporary vectorial force */
448 /* Update vectorial force */
452 f[j_coord_offset+DIM*3+XX] -= tx;
453 f[j_coord_offset+DIM*3+YY] -= ty;
454 f[j_coord_offset+DIM*3+ZZ] -= tz;
456 /**************************
457 * CALCULATE INTERACTIONS *
458 **************************/
460 /* COULOMB ELECTROSTATICS */
462 felec = velec*rinvsq31;
464 /* Update potential sums from outer loop */
469 /* Calculate temporary vectorial force */
474 /* Update vectorial force */
478 f[j_coord_offset+DIM*1+XX] -= tx;
479 f[j_coord_offset+DIM*1+YY] -= ty;
480 f[j_coord_offset+DIM*1+ZZ] -= tz;
482 /**************************
483 * CALCULATE INTERACTIONS *
484 **************************/
486 /* COULOMB ELECTROSTATICS */
488 felec = velec*rinvsq32;
490 /* Update potential sums from outer loop */
495 /* Calculate temporary vectorial force */
500 /* Update vectorial force */
504 f[j_coord_offset+DIM*2+XX] -= tx;
505 f[j_coord_offset+DIM*2+YY] -= ty;
506 f[j_coord_offset+DIM*2+ZZ] -= tz;
508 /**************************
509 * CALCULATE INTERACTIONS *
510 **************************/
512 /* COULOMB ELECTROSTATICS */
514 felec = velec*rinvsq33;
516 /* Update potential sums from outer loop */
521 /* Calculate temporary vectorial force */
526 /* Update vectorial force */
530 f[j_coord_offset+DIM*3+XX] -= tx;
531 f[j_coord_offset+DIM*3+YY] -= ty;
532 f[j_coord_offset+DIM*3+ZZ] -= tz;
534 /* Inner loop uses 304 flops */
536 /* End of innermost loop */
539 f[i_coord_offset+DIM*0+XX] += fix0;
540 f[i_coord_offset+DIM*0+YY] += fiy0;
541 f[i_coord_offset+DIM*0+ZZ] += fiz0;
545 f[i_coord_offset+DIM*1+XX] += fix1;
546 f[i_coord_offset+DIM*1+YY] += fiy1;
547 f[i_coord_offset+DIM*1+ZZ] += fiz1;
551 f[i_coord_offset+DIM*2+XX] += fix2;
552 f[i_coord_offset+DIM*2+YY] += fiy2;
553 f[i_coord_offset+DIM*2+ZZ] += fiz2;
557 f[i_coord_offset+DIM*3+XX] += fix3;
558 f[i_coord_offset+DIM*3+YY] += fiy3;
559 f[i_coord_offset+DIM*3+ZZ] += fiz3;
563 fshift[i_shift_offset+XX] += tx;
564 fshift[i_shift_offset+YY] += ty;
565 fshift[i_shift_offset+ZZ] += tz;
568 /* Update potential energies */
569 kernel_data->energygrp_elec[ggid] += velecsum;
570 kernel_data->energygrp_vdw[ggid] += vvdwsum;
572 /* Increment number of inner iterations */
573 inneriter += j_index_end - j_index_start;
575 /* Outer loop uses 41 flops */
578 /* Increment number of outer iterations */
581 /* Update outer/inner flops */
583 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*304);
586 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
587 * Electrostatics interaction: Coulomb
588 * VdW interaction: Buckingham
589 * Geometry: Water4-Water4
590 * Calculate force/pot: Force
593 nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
594 (t_nblist * gmx_restrict nlist,
595 rvec * gmx_restrict xx,
596 rvec * gmx_restrict ff,
597 t_forcerec * gmx_restrict fr,
598 t_mdatoms * gmx_restrict mdatoms,
599 nb_kernel_data_t * gmx_restrict kernel_data,
600 t_nrnb * gmx_restrict nrnb)
602 int i_shift_offset,i_coord_offset,j_coord_offset;
603 int j_index_start,j_index_end;
604 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
605 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
606 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
607 real *shiftvec,*fshift,*x,*f;
609 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
611 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
613 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
615 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
617 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
619 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
621 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
623 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
624 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
625 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
626 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
627 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
628 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
629 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
630 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
631 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
632 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
633 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
634 real velec,felec,velecsum,facel,crf,krf,krf2;
637 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
646 jindex = nlist->jindex;
648 shiftidx = nlist->shift;
650 shiftvec = fr->shift_vec[0];
651 fshift = fr->fshift[0];
653 charge = mdatoms->chargeA;
654 nvdwtype = fr->ntype;
656 vdwtype = mdatoms->typeA;
658 /* Setup water-specific parameters */
659 inr = nlist->iinr[0];
660 iq1 = facel*charge[inr+1];
661 iq2 = facel*charge[inr+2];
662 iq3 = facel*charge[inr+3];
663 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
668 vdwjidx0 = 3*vdwtype[inr+0];
669 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
670 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
671 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
685 /* Start outer loop over neighborlists */
686 for(iidx=0; iidx<nri; iidx++)
688 /* Load shift vector for this list */
689 i_shift_offset = DIM*shiftidx[iidx];
690 shX = shiftvec[i_shift_offset+XX];
691 shY = shiftvec[i_shift_offset+YY];
692 shZ = shiftvec[i_shift_offset+ZZ];
694 /* Load limits for loop over neighbors */
695 j_index_start = jindex[iidx];
696 j_index_end = jindex[iidx+1];
698 /* Get outer coordinate index */
700 i_coord_offset = DIM*inr;
702 /* Load i particle coords and add shift vector */
703 ix0 = shX + x[i_coord_offset+DIM*0+XX];
704 iy0 = shY + x[i_coord_offset+DIM*0+YY];
705 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
706 ix1 = shX + x[i_coord_offset+DIM*1+XX];
707 iy1 = shY + x[i_coord_offset+DIM*1+YY];
708 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
709 ix2 = shX + x[i_coord_offset+DIM*2+XX];
710 iy2 = shY + x[i_coord_offset+DIM*2+YY];
711 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
712 ix3 = shX + x[i_coord_offset+DIM*3+XX];
713 iy3 = shY + x[i_coord_offset+DIM*3+YY];
714 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
729 /* Start inner kernel loop */
730 for(jidx=j_index_start; jidx<j_index_end; jidx++)
732 /* Get j neighbor index, and coordinate index */
734 j_coord_offset = DIM*jnr;
736 /* load j atom coordinates */
737 jx0 = x[j_coord_offset+DIM*0+XX];
738 jy0 = x[j_coord_offset+DIM*0+YY];
739 jz0 = x[j_coord_offset+DIM*0+ZZ];
740 jx1 = x[j_coord_offset+DIM*1+XX];
741 jy1 = x[j_coord_offset+DIM*1+YY];
742 jz1 = x[j_coord_offset+DIM*1+ZZ];
743 jx2 = x[j_coord_offset+DIM*2+XX];
744 jy2 = x[j_coord_offset+DIM*2+YY];
745 jz2 = x[j_coord_offset+DIM*2+ZZ];
746 jx3 = x[j_coord_offset+DIM*3+XX];
747 jy3 = x[j_coord_offset+DIM*3+YY];
748 jz3 = x[j_coord_offset+DIM*3+ZZ];
750 /* Calculate displacement vector */
782 /* Calculate squared distance and things based on it */
783 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
784 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
785 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
786 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
787 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
788 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
789 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
790 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
791 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
792 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
794 rinv00 = gmx_invsqrt(rsq00);
795 rinv11 = gmx_invsqrt(rsq11);
796 rinv12 = gmx_invsqrt(rsq12);
797 rinv13 = gmx_invsqrt(rsq13);
798 rinv21 = gmx_invsqrt(rsq21);
799 rinv22 = gmx_invsqrt(rsq22);
800 rinv23 = gmx_invsqrt(rsq23);
801 rinv31 = gmx_invsqrt(rsq31);
802 rinv32 = gmx_invsqrt(rsq32);
803 rinv33 = gmx_invsqrt(rsq33);
805 rinvsq00 = rinv00*rinv00;
806 rinvsq11 = rinv11*rinv11;
807 rinvsq12 = rinv12*rinv12;
808 rinvsq13 = rinv13*rinv13;
809 rinvsq21 = rinv21*rinv21;
810 rinvsq22 = rinv22*rinv22;
811 rinvsq23 = rinv23*rinv23;
812 rinvsq31 = rinv31*rinv31;
813 rinvsq32 = rinv32*rinv32;
814 rinvsq33 = rinv33*rinv33;
816 /**************************
817 * CALCULATE INTERACTIONS *
818 **************************/
822 /* BUCKINGHAM DISPERSION/REPULSION */
823 rinvsix = rinvsq00*rinvsq00*rinvsq00;
824 vvdw6 = c6_00*rinvsix;
826 vvdwexp = cexp1_00*exp(-br);
827 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
831 /* Calculate temporary vectorial force */
836 /* Update vectorial force */
840 f[j_coord_offset+DIM*0+XX] -= tx;
841 f[j_coord_offset+DIM*0+YY] -= ty;
842 f[j_coord_offset+DIM*0+ZZ] -= tz;
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* COULOMB ELECTROSTATICS */
850 felec = velec*rinvsq11;
854 /* Calculate temporary vectorial force */
859 /* Update vectorial force */
863 f[j_coord_offset+DIM*1+XX] -= tx;
864 f[j_coord_offset+DIM*1+YY] -= ty;
865 f[j_coord_offset+DIM*1+ZZ] -= tz;
867 /**************************
868 * CALCULATE INTERACTIONS *
869 **************************/
871 /* COULOMB ELECTROSTATICS */
873 felec = velec*rinvsq12;
877 /* Calculate temporary vectorial force */
882 /* Update vectorial force */
886 f[j_coord_offset+DIM*2+XX] -= tx;
887 f[j_coord_offset+DIM*2+YY] -= ty;
888 f[j_coord_offset+DIM*2+ZZ] -= tz;
890 /**************************
891 * CALCULATE INTERACTIONS *
892 **************************/
894 /* COULOMB ELECTROSTATICS */
896 felec = velec*rinvsq13;
900 /* Calculate temporary vectorial force */
905 /* Update vectorial force */
909 f[j_coord_offset+DIM*3+XX] -= tx;
910 f[j_coord_offset+DIM*3+YY] -= ty;
911 f[j_coord_offset+DIM*3+ZZ] -= tz;
913 /**************************
914 * CALCULATE INTERACTIONS *
915 **************************/
917 /* COULOMB ELECTROSTATICS */
919 felec = velec*rinvsq21;
923 /* Calculate temporary vectorial force */
928 /* Update vectorial force */
932 f[j_coord_offset+DIM*1+XX] -= tx;
933 f[j_coord_offset+DIM*1+YY] -= ty;
934 f[j_coord_offset+DIM*1+ZZ] -= tz;
936 /**************************
937 * CALCULATE INTERACTIONS *
938 **************************/
940 /* COULOMB ELECTROSTATICS */
942 felec = velec*rinvsq22;
946 /* Calculate temporary vectorial force */
951 /* Update vectorial force */
955 f[j_coord_offset+DIM*2+XX] -= tx;
956 f[j_coord_offset+DIM*2+YY] -= ty;
957 f[j_coord_offset+DIM*2+ZZ] -= tz;
959 /**************************
960 * CALCULATE INTERACTIONS *
961 **************************/
963 /* COULOMB ELECTROSTATICS */
965 felec = velec*rinvsq23;
969 /* Calculate temporary vectorial force */
974 /* Update vectorial force */
978 f[j_coord_offset+DIM*3+XX] -= tx;
979 f[j_coord_offset+DIM*3+YY] -= ty;
980 f[j_coord_offset+DIM*3+ZZ] -= tz;
982 /**************************
983 * CALCULATE INTERACTIONS *
984 **************************/
986 /* COULOMB ELECTROSTATICS */
988 felec = velec*rinvsq31;
992 /* Calculate temporary vectorial force */
997 /* Update vectorial force */
1001 f[j_coord_offset+DIM*1+XX] -= tx;
1002 f[j_coord_offset+DIM*1+YY] -= ty;
1003 f[j_coord_offset+DIM*1+ZZ] -= tz;
1005 /**************************
1006 * CALCULATE INTERACTIONS *
1007 **************************/
1009 /* COULOMB ELECTROSTATICS */
1010 velec = qq32*rinv32;
1011 felec = velec*rinvsq32;
1015 /* Calculate temporary vectorial force */
1020 /* Update vectorial force */
1024 f[j_coord_offset+DIM*2+XX] -= tx;
1025 f[j_coord_offset+DIM*2+YY] -= ty;
1026 f[j_coord_offset+DIM*2+ZZ] -= tz;
1028 /**************************
1029 * CALCULATE INTERACTIONS *
1030 **************************/
1032 /* COULOMB ELECTROSTATICS */
1033 velec = qq33*rinv33;
1034 felec = velec*rinvsq33;
1038 /* Calculate temporary vectorial force */
1043 /* Update vectorial force */
1047 f[j_coord_offset+DIM*3+XX] -= tx;
1048 f[j_coord_offset+DIM*3+YY] -= ty;
1049 f[j_coord_offset+DIM*3+ZZ] -= tz;
1051 /* Inner loop uses 292 flops */
1053 /* End of innermost loop */
1056 f[i_coord_offset+DIM*0+XX] += fix0;
1057 f[i_coord_offset+DIM*0+YY] += fiy0;
1058 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1062 f[i_coord_offset+DIM*1+XX] += fix1;
1063 f[i_coord_offset+DIM*1+YY] += fiy1;
1064 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1068 f[i_coord_offset+DIM*2+XX] += fix2;
1069 f[i_coord_offset+DIM*2+YY] += fiy2;
1070 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1074 f[i_coord_offset+DIM*3+XX] += fix3;
1075 f[i_coord_offset+DIM*3+YY] += fiy3;
1076 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1080 fshift[i_shift_offset+XX] += tx;
1081 fshift[i_shift_offset+YY] += ty;
1082 fshift[i_shift_offset+ZZ] += tz;
1084 /* Increment number of inner iterations */
1085 inneriter += j_index_end - j_index_start;
1087 /* Outer loop uses 39 flops */
1090 /* Increment number of outer iterations */
1093 /* Update outer/inner flops */
1095 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*292);