2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, 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.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_VF_c
49 * Electrostatics interaction: Coulomb
50 * VdW interaction: Buckingham
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCoul_VdwBham_GeomW4W4_VF_c
56 (t_nblist * gmx_restrict nlist,
57 rvec * gmx_restrict xx,
58 rvec * gmx_restrict ff,
59 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 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
79 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
81 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
83 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
85 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
86 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
87 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
88 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
89 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
90 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
91 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
92 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
93 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
94 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
95 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
96 real velec,felec,velecsum,facel,crf,krf,krf2;
99 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
108 jindex = nlist->jindex;
110 shiftidx = nlist->shift;
112 shiftvec = fr->shift_vec[0];
113 fshift = fr->fshift[0];
115 charge = mdatoms->chargeA;
116 nvdwtype = fr->ntype;
118 vdwtype = mdatoms->typeA;
120 /* Setup water-specific parameters */
121 inr = nlist->iinr[0];
122 iq1 = facel*charge[inr+1];
123 iq2 = facel*charge[inr+2];
124 iq3 = facel*charge[inr+3];
125 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
130 vdwjidx0 = 3*vdwtype[inr+0];
131 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
132 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
133 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
147 /* Start outer loop over neighborlists */
148 for(iidx=0; iidx<nri; iidx++)
150 /* Load shift vector for this list */
151 i_shift_offset = DIM*shiftidx[iidx];
152 shX = shiftvec[i_shift_offset+XX];
153 shY = shiftvec[i_shift_offset+YY];
154 shZ = shiftvec[i_shift_offset+ZZ];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 ix0 = shX + x[i_coord_offset+DIM*0+XX];
166 iy0 = shY + x[i_coord_offset+DIM*0+YY];
167 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
168 ix1 = shX + x[i_coord_offset+DIM*1+XX];
169 iy1 = shY + x[i_coord_offset+DIM*1+YY];
170 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
171 ix2 = shX + x[i_coord_offset+DIM*2+XX];
172 iy2 = shY + x[i_coord_offset+DIM*2+YY];
173 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
174 ix3 = shX + x[i_coord_offset+DIM*3+XX];
175 iy3 = shY + x[i_coord_offset+DIM*3+YY];
176 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
191 /* Reset potential sums */
195 /* Start inner kernel loop */
196 for(jidx=j_index_start; jidx<j_index_end; jidx++)
198 /* Get j neighbor index, and coordinate index */
200 j_coord_offset = DIM*jnr;
202 /* load j atom coordinates */
203 jx0 = x[j_coord_offset+DIM*0+XX];
204 jy0 = x[j_coord_offset+DIM*0+YY];
205 jz0 = x[j_coord_offset+DIM*0+ZZ];
206 jx1 = x[j_coord_offset+DIM*1+XX];
207 jy1 = x[j_coord_offset+DIM*1+YY];
208 jz1 = x[j_coord_offset+DIM*1+ZZ];
209 jx2 = x[j_coord_offset+DIM*2+XX];
210 jy2 = x[j_coord_offset+DIM*2+YY];
211 jz2 = x[j_coord_offset+DIM*2+ZZ];
212 jx3 = x[j_coord_offset+DIM*3+XX];
213 jy3 = x[j_coord_offset+DIM*3+YY];
214 jz3 = x[j_coord_offset+DIM*3+ZZ];
216 /* Calculate displacement vector */
248 /* Calculate squared distance and things based on it */
249 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
250 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
251 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
252 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
253 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
254 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
255 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
256 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
257 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
258 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
260 rinv00 = gmx_invsqrt(rsq00);
261 rinv11 = gmx_invsqrt(rsq11);
262 rinv12 = gmx_invsqrt(rsq12);
263 rinv13 = gmx_invsqrt(rsq13);
264 rinv21 = gmx_invsqrt(rsq21);
265 rinv22 = gmx_invsqrt(rsq22);
266 rinv23 = gmx_invsqrt(rsq23);
267 rinv31 = gmx_invsqrt(rsq31);
268 rinv32 = gmx_invsqrt(rsq32);
269 rinv33 = gmx_invsqrt(rsq33);
271 rinvsq00 = rinv00*rinv00;
272 rinvsq11 = rinv11*rinv11;
273 rinvsq12 = rinv12*rinv12;
274 rinvsq13 = rinv13*rinv13;
275 rinvsq21 = rinv21*rinv21;
276 rinvsq22 = rinv22*rinv22;
277 rinvsq23 = rinv23*rinv23;
278 rinvsq31 = rinv31*rinv31;
279 rinvsq32 = rinv32*rinv32;
280 rinvsq33 = rinv33*rinv33;
282 /**************************
283 * CALCULATE INTERACTIONS *
284 **************************/
288 /* BUCKINGHAM DISPERSION/REPULSION */
289 rinvsix = rinvsq00*rinvsq00*rinvsq00;
290 vvdw6 = c6_00*rinvsix;
292 vvdwexp = cexp1_00*exp(-br);
293 vvdw = vvdwexp - vvdw6*(1.0/6.0);
294 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
296 /* Update potential sums from outer loop */
301 /* Calculate temporary vectorial force */
306 /* Update vectorial force */
310 f[j_coord_offset+DIM*0+XX] -= tx;
311 f[j_coord_offset+DIM*0+YY] -= ty;
312 f[j_coord_offset+DIM*0+ZZ] -= tz;
314 /**************************
315 * CALCULATE INTERACTIONS *
316 **************************/
318 /* COULOMB ELECTROSTATICS */
320 felec = velec*rinvsq11;
322 /* Update potential sums from outer loop */
327 /* Calculate temporary vectorial force */
332 /* Update vectorial force */
336 f[j_coord_offset+DIM*1+XX] -= tx;
337 f[j_coord_offset+DIM*1+YY] -= ty;
338 f[j_coord_offset+DIM*1+ZZ] -= tz;
340 /**************************
341 * CALCULATE INTERACTIONS *
342 **************************/
344 /* COULOMB ELECTROSTATICS */
346 felec = velec*rinvsq12;
348 /* Update potential sums from outer loop */
353 /* Calculate temporary vectorial force */
358 /* Update vectorial force */
362 f[j_coord_offset+DIM*2+XX] -= tx;
363 f[j_coord_offset+DIM*2+YY] -= ty;
364 f[j_coord_offset+DIM*2+ZZ] -= tz;
366 /**************************
367 * CALCULATE INTERACTIONS *
368 **************************/
370 /* COULOMB ELECTROSTATICS */
372 felec = velec*rinvsq13;
374 /* Update potential sums from outer loop */
379 /* Calculate temporary vectorial force */
384 /* Update vectorial force */
388 f[j_coord_offset+DIM*3+XX] -= tx;
389 f[j_coord_offset+DIM*3+YY] -= ty;
390 f[j_coord_offset+DIM*3+ZZ] -= tz;
392 /**************************
393 * CALCULATE INTERACTIONS *
394 **************************/
396 /* COULOMB ELECTROSTATICS */
398 felec = velec*rinvsq21;
400 /* Update potential sums from outer loop */
405 /* Calculate temporary vectorial force */
410 /* Update vectorial force */
414 f[j_coord_offset+DIM*1+XX] -= tx;
415 f[j_coord_offset+DIM*1+YY] -= ty;
416 f[j_coord_offset+DIM*1+ZZ] -= tz;
418 /**************************
419 * CALCULATE INTERACTIONS *
420 **************************/
422 /* COULOMB ELECTROSTATICS */
424 felec = velec*rinvsq22;
426 /* Update potential sums from outer loop */
431 /* Calculate temporary vectorial force */
436 /* Update vectorial force */
440 f[j_coord_offset+DIM*2+XX] -= tx;
441 f[j_coord_offset+DIM*2+YY] -= ty;
442 f[j_coord_offset+DIM*2+ZZ] -= tz;
444 /**************************
445 * CALCULATE INTERACTIONS *
446 **************************/
448 /* COULOMB ELECTROSTATICS */
450 felec = velec*rinvsq23;
452 /* Update potential sums from outer loop */
457 /* Calculate temporary vectorial force */
462 /* Update vectorial force */
466 f[j_coord_offset+DIM*3+XX] -= tx;
467 f[j_coord_offset+DIM*3+YY] -= ty;
468 f[j_coord_offset+DIM*3+ZZ] -= tz;
470 /**************************
471 * CALCULATE INTERACTIONS *
472 **************************/
474 /* COULOMB ELECTROSTATICS */
476 felec = velec*rinvsq31;
478 /* Update potential sums from outer loop */
483 /* Calculate temporary vectorial force */
488 /* Update vectorial force */
492 f[j_coord_offset+DIM*1+XX] -= tx;
493 f[j_coord_offset+DIM*1+YY] -= ty;
494 f[j_coord_offset+DIM*1+ZZ] -= tz;
496 /**************************
497 * CALCULATE INTERACTIONS *
498 **************************/
500 /* COULOMB ELECTROSTATICS */
502 felec = velec*rinvsq32;
504 /* Update potential sums from outer loop */
509 /* Calculate temporary vectorial force */
514 /* Update vectorial force */
518 f[j_coord_offset+DIM*2+XX] -= tx;
519 f[j_coord_offset+DIM*2+YY] -= ty;
520 f[j_coord_offset+DIM*2+ZZ] -= tz;
522 /**************************
523 * CALCULATE INTERACTIONS *
524 **************************/
526 /* COULOMB ELECTROSTATICS */
528 felec = velec*rinvsq33;
530 /* Update potential sums from outer loop */
535 /* Calculate temporary vectorial force */
540 /* Update vectorial force */
544 f[j_coord_offset+DIM*3+XX] -= tx;
545 f[j_coord_offset+DIM*3+YY] -= ty;
546 f[j_coord_offset+DIM*3+ZZ] -= tz;
548 /* Inner loop uses 304 flops */
550 /* End of innermost loop */
553 f[i_coord_offset+DIM*0+XX] += fix0;
554 f[i_coord_offset+DIM*0+YY] += fiy0;
555 f[i_coord_offset+DIM*0+ZZ] += fiz0;
559 f[i_coord_offset+DIM*1+XX] += fix1;
560 f[i_coord_offset+DIM*1+YY] += fiy1;
561 f[i_coord_offset+DIM*1+ZZ] += fiz1;
565 f[i_coord_offset+DIM*2+XX] += fix2;
566 f[i_coord_offset+DIM*2+YY] += fiy2;
567 f[i_coord_offset+DIM*2+ZZ] += fiz2;
571 f[i_coord_offset+DIM*3+XX] += fix3;
572 f[i_coord_offset+DIM*3+YY] += fiy3;
573 f[i_coord_offset+DIM*3+ZZ] += fiz3;
577 fshift[i_shift_offset+XX] += tx;
578 fshift[i_shift_offset+YY] += ty;
579 fshift[i_shift_offset+ZZ] += tz;
582 /* Update potential energies */
583 kernel_data->energygrp_elec[ggid] += velecsum;
584 kernel_data->energygrp_vdw[ggid] += vvdwsum;
586 /* Increment number of inner iterations */
587 inneriter += j_index_end - j_index_start;
589 /* Outer loop uses 41 flops */
592 /* Increment number of outer iterations */
595 /* Update outer/inner flops */
597 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*304);
600 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
601 * Electrostatics interaction: Coulomb
602 * VdW interaction: Buckingham
603 * Geometry: Water4-Water4
604 * Calculate force/pot: Force
607 nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
608 (t_nblist * gmx_restrict nlist,
609 rvec * gmx_restrict xx,
610 rvec * gmx_restrict ff,
611 t_forcerec * gmx_restrict fr,
612 t_mdatoms * gmx_restrict mdatoms,
613 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
614 t_nrnb * gmx_restrict nrnb)
616 int i_shift_offset,i_coord_offset,j_coord_offset;
617 int j_index_start,j_index_end;
618 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
619 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
620 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
621 real *shiftvec,*fshift,*x,*f;
623 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
625 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
627 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
629 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
631 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
633 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
635 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
637 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
638 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
639 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
640 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
641 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
642 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
643 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
644 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
645 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
646 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
647 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
648 real velec,felec,velecsum,facel,crf,krf,krf2;
651 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
660 jindex = nlist->jindex;
662 shiftidx = nlist->shift;
664 shiftvec = fr->shift_vec[0];
665 fshift = fr->fshift[0];
667 charge = mdatoms->chargeA;
668 nvdwtype = fr->ntype;
670 vdwtype = mdatoms->typeA;
672 /* Setup water-specific parameters */
673 inr = nlist->iinr[0];
674 iq1 = facel*charge[inr+1];
675 iq2 = facel*charge[inr+2];
676 iq3 = facel*charge[inr+3];
677 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
682 vdwjidx0 = 3*vdwtype[inr+0];
683 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
684 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
685 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
699 /* Start outer loop over neighborlists */
700 for(iidx=0; iidx<nri; iidx++)
702 /* Load shift vector for this list */
703 i_shift_offset = DIM*shiftidx[iidx];
704 shX = shiftvec[i_shift_offset+XX];
705 shY = shiftvec[i_shift_offset+YY];
706 shZ = shiftvec[i_shift_offset+ZZ];
708 /* Load limits for loop over neighbors */
709 j_index_start = jindex[iidx];
710 j_index_end = jindex[iidx+1];
712 /* Get outer coordinate index */
714 i_coord_offset = DIM*inr;
716 /* Load i particle coords and add shift vector */
717 ix0 = shX + x[i_coord_offset+DIM*0+XX];
718 iy0 = shY + x[i_coord_offset+DIM*0+YY];
719 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
720 ix1 = shX + x[i_coord_offset+DIM*1+XX];
721 iy1 = shY + x[i_coord_offset+DIM*1+YY];
722 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
723 ix2 = shX + x[i_coord_offset+DIM*2+XX];
724 iy2 = shY + x[i_coord_offset+DIM*2+YY];
725 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
726 ix3 = shX + x[i_coord_offset+DIM*3+XX];
727 iy3 = shY + x[i_coord_offset+DIM*3+YY];
728 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
743 /* Start inner kernel loop */
744 for(jidx=j_index_start; jidx<j_index_end; jidx++)
746 /* Get j neighbor index, and coordinate index */
748 j_coord_offset = DIM*jnr;
750 /* load j atom coordinates */
751 jx0 = x[j_coord_offset+DIM*0+XX];
752 jy0 = x[j_coord_offset+DIM*0+YY];
753 jz0 = x[j_coord_offset+DIM*0+ZZ];
754 jx1 = x[j_coord_offset+DIM*1+XX];
755 jy1 = x[j_coord_offset+DIM*1+YY];
756 jz1 = x[j_coord_offset+DIM*1+ZZ];
757 jx2 = x[j_coord_offset+DIM*2+XX];
758 jy2 = x[j_coord_offset+DIM*2+YY];
759 jz2 = x[j_coord_offset+DIM*2+ZZ];
760 jx3 = x[j_coord_offset+DIM*3+XX];
761 jy3 = x[j_coord_offset+DIM*3+YY];
762 jz3 = x[j_coord_offset+DIM*3+ZZ];
764 /* Calculate displacement vector */
796 /* Calculate squared distance and things based on it */
797 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
798 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
799 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
800 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
801 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
802 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
803 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
804 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
805 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
806 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
808 rinv00 = gmx_invsqrt(rsq00);
809 rinv11 = gmx_invsqrt(rsq11);
810 rinv12 = gmx_invsqrt(rsq12);
811 rinv13 = gmx_invsqrt(rsq13);
812 rinv21 = gmx_invsqrt(rsq21);
813 rinv22 = gmx_invsqrt(rsq22);
814 rinv23 = gmx_invsqrt(rsq23);
815 rinv31 = gmx_invsqrt(rsq31);
816 rinv32 = gmx_invsqrt(rsq32);
817 rinv33 = gmx_invsqrt(rsq33);
819 rinvsq00 = rinv00*rinv00;
820 rinvsq11 = rinv11*rinv11;
821 rinvsq12 = rinv12*rinv12;
822 rinvsq13 = rinv13*rinv13;
823 rinvsq21 = rinv21*rinv21;
824 rinvsq22 = rinv22*rinv22;
825 rinvsq23 = rinv23*rinv23;
826 rinvsq31 = rinv31*rinv31;
827 rinvsq32 = rinv32*rinv32;
828 rinvsq33 = rinv33*rinv33;
830 /**************************
831 * CALCULATE INTERACTIONS *
832 **************************/
836 /* BUCKINGHAM DISPERSION/REPULSION */
837 rinvsix = rinvsq00*rinvsq00*rinvsq00;
838 vvdw6 = c6_00*rinvsix;
840 vvdwexp = cexp1_00*exp(-br);
841 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
845 /* Calculate temporary vectorial force */
850 /* Update vectorial force */
854 f[j_coord_offset+DIM*0+XX] -= tx;
855 f[j_coord_offset+DIM*0+YY] -= ty;
856 f[j_coord_offset+DIM*0+ZZ] -= tz;
858 /**************************
859 * CALCULATE INTERACTIONS *
860 **************************/
862 /* COULOMB ELECTROSTATICS */
864 felec = velec*rinvsq11;
868 /* Calculate temporary vectorial force */
873 /* Update vectorial force */
877 f[j_coord_offset+DIM*1+XX] -= tx;
878 f[j_coord_offset+DIM*1+YY] -= ty;
879 f[j_coord_offset+DIM*1+ZZ] -= tz;
881 /**************************
882 * CALCULATE INTERACTIONS *
883 **************************/
885 /* COULOMB ELECTROSTATICS */
887 felec = velec*rinvsq12;
891 /* Calculate temporary vectorial force */
896 /* Update vectorial force */
900 f[j_coord_offset+DIM*2+XX] -= tx;
901 f[j_coord_offset+DIM*2+YY] -= ty;
902 f[j_coord_offset+DIM*2+ZZ] -= tz;
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
908 /* COULOMB ELECTROSTATICS */
910 felec = velec*rinvsq13;
914 /* Calculate temporary vectorial force */
919 /* Update vectorial force */
923 f[j_coord_offset+DIM*3+XX] -= tx;
924 f[j_coord_offset+DIM*3+YY] -= ty;
925 f[j_coord_offset+DIM*3+ZZ] -= tz;
927 /**************************
928 * CALCULATE INTERACTIONS *
929 **************************/
931 /* COULOMB ELECTROSTATICS */
933 felec = velec*rinvsq21;
937 /* Calculate temporary vectorial force */
942 /* Update vectorial force */
946 f[j_coord_offset+DIM*1+XX] -= tx;
947 f[j_coord_offset+DIM*1+YY] -= ty;
948 f[j_coord_offset+DIM*1+ZZ] -= tz;
950 /**************************
951 * CALCULATE INTERACTIONS *
952 **************************/
954 /* COULOMB ELECTROSTATICS */
956 felec = velec*rinvsq22;
960 /* Calculate temporary vectorial force */
965 /* Update vectorial force */
969 f[j_coord_offset+DIM*2+XX] -= tx;
970 f[j_coord_offset+DIM*2+YY] -= ty;
971 f[j_coord_offset+DIM*2+ZZ] -= tz;
973 /**************************
974 * CALCULATE INTERACTIONS *
975 **************************/
977 /* COULOMB ELECTROSTATICS */
979 felec = velec*rinvsq23;
983 /* Calculate temporary vectorial force */
988 /* Update vectorial force */
992 f[j_coord_offset+DIM*3+XX] -= tx;
993 f[j_coord_offset+DIM*3+YY] -= ty;
994 f[j_coord_offset+DIM*3+ZZ] -= tz;
996 /**************************
997 * CALCULATE INTERACTIONS *
998 **************************/
1000 /* COULOMB ELECTROSTATICS */
1001 velec = qq31*rinv31;
1002 felec = velec*rinvsq31;
1006 /* Calculate temporary vectorial force */
1011 /* Update vectorial force */
1015 f[j_coord_offset+DIM*1+XX] -= tx;
1016 f[j_coord_offset+DIM*1+YY] -= ty;
1017 f[j_coord_offset+DIM*1+ZZ] -= tz;
1019 /**************************
1020 * CALCULATE INTERACTIONS *
1021 **************************/
1023 /* COULOMB ELECTROSTATICS */
1024 velec = qq32*rinv32;
1025 felec = velec*rinvsq32;
1029 /* Calculate temporary vectorial force */
1034 /* Update vectorial force */
1038 f[j_coord_offset+DIM*2+XX] -= tx;
1039 f[j_coord_offset+DIM*2+YY] -= ty;
1040 f[j_coord_offset+DIM*2+ZZ] -= tz;
1042 /**************************
1043 * CALCULATE INTERACTIONS *
1044 **************************/
1046 /* COULOMB ELECTROSTATICS */
1047 velec = qq33*rinv33;
1048 felec = velec*rinvsq33;
1052 /* Calculate temporary vectorial force */
1057 /* Update vectorial force */
1061 f[j_coord_offset+DIM*3+XX] -= tx;
1062 f[j_coord_offset+DIM*3+YY] -= ty;
1063 f[j_coord_offset+DIM*3+ZZ] -= tz;
1065 /* Inner loop uses 292 flops */
1067 /* End of innermost loop */
1070 f[i_coord_offset+DIM*0+XX] += fix0;
1071 f[i_coord_offset+DIM*0+YY] += fiy0;
1072 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1076 f[i_coord_offset+DIM*1+XX] += fix1;
1077 f[i_coord_offset+DIM*1+YY] += fiy1;
1078 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1082 f[i_coord_offset+DIM*2+XX] += fix2;
1083 f[i_coord_offset+DIM*2+YY] += fiy2;
1084 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1088 f[i_coord_offset+DIM*3+XX] += fix3;
1089 f[i_coord_offset+DIM*3+YY] += fiy3;
1090 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1094 fshift[i_shift_offset+XX] += tx;
1095 fshift[i_shift_offset+YY] += ty;
1096 fshift[i_shift_offset+ZZ] += tz;
1098 /* Increment number of inner iterations */
1099 inneriter += j_index_end - j_index_start;
1101 /* Outer loop uses 39 flops */
1104 /* Increment number of outer iterations */
1107 /* Update outer/inner flops */
1109 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*292);