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.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "gromacs/math/vec.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW3W3_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: Buckingham
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwBham_GeomW3W3_VF_c
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 int i_shift_offset,i_coord_offset,j_coord_offset;
67 int j_index_start,j_index_end;
68 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
69 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
70 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
71 real *shiftvec,*fshift,*x,*f;
73 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
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;
84 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
93 real velec,felec,velecsum,facel,crf,krf,krf2;
96 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
105 jindex = nlist->jindex;
107 shiftidx = nlist->shift;
109 shiftvec = fr->shift_vec[0];
110 fshift = fr->fshift[0];
112 charge = mdatoms->chargeA;
116 nvdwtype = fr->ntype;
118 vdwtype = mdatoms->typeA;
120 /* Setup water-specific parameters */
121 inr = nlist->iinr[0];
122 iq0 = facel*charge[inr+0];
123 iq1 = facel*charge[inr+1];
124 iq2 = facel*charge[inr+2];
125 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
130 vdwjidx0 = 3*vdwtype[inr+0];
132 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
133 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
134 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];
185 /* Reset potential sums */
189 /* Start inner kernel loop */
190 for(jidx=j_index_start; jidx<j_index_end; jidx++)
192 /* Get j neighbor index, and coordinate index */
194 j_coord_offset = DIM*jnr;
196 /* load j atom coordinates */
197 jx0 = x[j_coord_offset+DIM*0+XX];
198 jy0 = x[j_coord_offset+DIM*0+YY];
199 jz0 = x[j_coord_offset+DIM*0+ZZ];
200 jx1 = x[j_coord_offset+DIM*1+XX];
201 jy1 = x[j_coord_offset+DIM*1+YY];
202 jz1 = x[j_coord_offset+DIM*1+ZZ];
203 jx2 = x[j_coord_offset+DIM*2+XX];
204 jy2 = x[j_coord_offset+DIM*2+YY];
205 jz2 = x[j_coord_offset+DIM*2+ZZ];
207 /* Calculate displacement vector */
236 /* Calculate squared distance and things based on it */
237 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
238 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
239 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
240 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
241 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
242 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
243 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
244 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
245 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
247 rinv00 = gmx_invsqrt(rsq00);
248 rinv01 = gmx_invsqrt(rsq01);
249 rinv02 = gmx_invsqrt(rsq02);
250 rinv10 = gmx_invsqrt(rsq10);
251 rinv11 = gmx_invsqrt(rsq11);
252 rinv12 = gmx_invsqrt(rsq12);
253 rinv20 = gmx_invsqrt(rsq20);
254 rinv21 = gmx_invsqrt(rsq21);
255 rinv22 = gmx_invsqrt(rsq22);
257 rinvsq00 = rinv00*rinv00;
258 rinvsq01 = rinv01*rinv01;
259 rinvsq02 = rinv02*rinv02;
260 rinvsq10 = rinv10*rinv10;
261 rinvsq11 = rinv11*rinv11;
262 rinvsq12 = rinv12*rinv12;
263 rinvsq20 = rinv20*rinv20;
264 rinvsq21 = rinv21*rinv21;
265 rinvsq22 = rinv22*rinv22;
267 /**************************
268 * CALCULATE INTERACTIONS *
269 **************************/
273 /* REACTION-FIELD ELECTROSTATICS */
274 velec = qq00*(rinv00+krf*rsq00-crf);
275 felec = qq00*(rinv00*rinvsq00-krf2);
277 /* BUCKINGHAM DISPERSION/REPULSION */
278 rinvsix = rinvsq00*rinvsq00*rinvsq00;
279 vvdw6 = c6_00*rinvsix;
281 vvdwexp = cexp1_00*exp(-br);
282 vvdw = vvdwexp - vvdw6*(1.0/6.0);
283 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
285 /* Update potential sums from outer loop */
291 /* Calculate temporary vectorial force */
296 /* Update vectorial force */
300 f[j_coord_offset+DIM*0+XX] -= tx;
301 f[j_coord_offset+DIM*0+YY] -= ty;
302 f[j_coord_offset+DIM*0+ZZ] -= tz;
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 /* REACTION-FIELD ELECTROSTATICS */
309 velec = qq01*(rinv01+krf*rsq01-crf);
310 felec = qq01*(rinv01*rinvsq01-krf2);
312 /* Update potential sums from outer loop */
317 /* Calculate temporary vectorial force */
322 /* Update vectorial force */
326 f[j_coord_offset+DIM*1+XX] -= tx;
327 f[j_coord_offset+DIM*1+YY] -= ty;
328 f[j_coord_offset+DIM*1+ZZ] -= tz;
330 /**************************
331 * CALCULATE INTERACTIONS *
332 **************************/
334 /* REACTION-FIELD ELECTROSTATICS */
335 velec = qq02*(rinv02+krf*rsq02-crf);
336 felec = qq02*(rinv02*rinvsq02-krf2);
338 /* Update potential sums from outer loop */
343 /* Calculate temporary vectorial force */
348 /* Update vectorial force */
352 f[j_coord_offset+DIM*2+XX] -= tx;
353 f[j_coord_offset+DIM*2+YY] -= ty;
354 f[j_coord_offset+DIM*2+ZZ] -= tz;
356 /**************************
357 * CALCULATE INTERACTIONS *
358 **************************/
360 /* REACTION-FIELD ELECTROSTATICS */
361 velec = qq10*(rinv10+krf*rsq10-crf);
362 felec = qq10*(rinv10*rinvsq10-krf2);
364 /* Update potential sums from outer loop */
369 /* Calculate temporary vectorial force */
374 /* Update vectorial force */
378 f[j_coord_offset+DIM*0+XX] -= tx;
379 f[j_coord_offset+DIM*0+YY] -= ty;
380 f[j_coord_offset+DIM*0+ZZ] -= tz;
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 /* REACTION-FIELD ELECTROSTATICS */
387 velec = qq11*(rinv11+krf*rsq11-crf);
388 felec = qq11*(rinv11*rinvsq11-krf2);
390 /* Update potential sums from outer loop */
395 /* Calculate temporary vectorial force */
400 /* Update vectorial force */
404 f[j_coord_offset+DIM*1+XX] -= tx;
405 f[j_coord_offset+DIM*1+YY] -= ty;
406 f[j_coord_offset+DIM*1+ZZ] -= tz;
408 /**************************
409 * CALCULATE INTERACTIONS *
410 **************************/
412 /* REACTION-FIELD ELECTROSTATICS */
413 velec = qq12*(rinv12+krf*rsq12-crf);
414 felec = qq12*(rinv12*rinvsq12-krf2);
416 /* Update potential sums from outer loop */
421 /* Calculate temporary vectorial force */
426 /* Update vectorial force */
430 f[j_coord_offset+DIM*2+XX] -= tx;
431 f[j_coord_offset+DIM*2+YY] -= ty;
432 f[j_coord_offset+DIM*2+ZZ] -= tz;
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
438 /* REACTION-FIELD ELECTROSTATICS */
439 velec = qq20*(rinv20+krf*rsq20-crf);
440 felec = qq20*(rinv20*rinvsq20-krf2);
442 /* Update potential sums from outer loop */
447 /* Calculate temporary vectorial force */
452 /* Update vectorial force */
456 f[j_coord_offset+DIM*0+XX] -= tx;
457 f[j_coord_offset+DIM*0+YY] -= ty;
458 f[j_coord_offset+DIM*0+ZZ] -= tz;
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 /* REACTION-FIELD ELECTROSTATICS */
465 velec = qq21*(rinv21+krf*rsq21-crf);
466 felec = qq21*(rinv21*rinvsq21-krf2);
468 /* Update potential sums from outer loop */
473 /* Calculate temporary vectorial force */
478 /* Update vectorial force */
482 f[j_coord_offset+DIM*1+XX] -= tx;
483 f[j_coord_offset+DIM*1+YY] -= ty;
484 f[j_coord_offset+DIM*1+ZZ] -= tz;
486 /**************************
487 * CALCULATE INTERACTIONS *
488 **************************/
490 /* REACTION-FIELD ELECTROSTATICS */
491 velec = qq22*(rinv22+krf*rsq22-crf);
492 felec = qq22*(rinv22*rinvsq22-krf2);
494 /* Update potential sums from outer loop */
499 /* Calculate temporary vectorial force */
504 /* Update vectorial force */
508 f[j_coord_offset+DIM*2+XX] -= tx;
509 f[j_coord_offset+DIM*2+YY] -= ty;
510 f[j_coord_offset+DIM*2+ZZ] -= tz;
512 /* Inner loop uses 318 flops */
514 /* End of innermost loop */
517 f[i_coord_offset+DIM*0+XX] += fix0;
518 f[i_coord_offset+DIM*0+YY] += fiy0;
519 f[i_coord_offset+DIM*0+ZZ] += fiz0;
523 f[i_coord_offset+DIM*1+XX] += fix1;
524 f[i_coord_offset+DIM*1+YY] += fiy1;
525 f[i_coord_offset+DIM*1+ZZ] += fiz1;
529 f[i_coord_offset+DIM*2+XX] += fix2;
530 f[i_coord_offset+DIM*2+YY] += fiy2;
531 f[i_coord_offset+DIM*2+ZZ] += fiz2;
535 fshift[i_shift_offset+XX] += tx;
536 fshift[i_shift_offset+YY] += ty;
537 fshift[i_shift_offset+ZZ] += tz;
540 /* Update potential energies */
541 kernel_data->energygrp_elec[ggid] += velecsum;
542 kernel_data->energygrp_vdw[ggid] += vvdwsum;
544 /* Increment number of inner iterations */
545 inneriter += j_index_end - j_index_start;
547 /* Outer loop uses 32 flops */
550 /* Increment number of outer iterations */
553 /* Update outer/inner flops */
555 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*318);
558 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW3W3_F_c
559 * Electrostatics interaction: ReactionField
560 * VdW interaction: Buckingham
561 * Geometry: Water3-Water3
562 * Calculate force/pot: Force
565 nb_kernel_ElecRF_VdwBham_GeomW3W3_F_c
566 (t_nblist * gmx_restrict nlist,
567 rvec * gmx_restrict xx,
568 rvec * gmx_restrict ff,
569 t_forcerec * gmx_restrict fr,
570 t_mdatoms * gmx_restrict mdatoms,
571 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
572 t_nrnb * gmx_restrict nrnb)
574 int i_shift_offset,i_coord_offset,j_coord_offset;
575 int j_index_start,j_index_end;
576 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
577 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
578 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
579 real *shiftvec,*fshift,*x,*f;
581 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
583 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
585 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
587 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
589 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
591 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
592 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
593 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
594 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
595 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
596 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
597 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
598 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
599 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
600 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
601 real velec,felec,velecsum,facel,crf,krf,krf2;
604 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
613 jindex = nlist->jindex;
615 shiftidx = nlist->shift;
617 shiftvec = fr->shift_vec[0];
618 fshift = fr->fshift[0];
620 charge = mdatoms->chargeA;
624 nvdwtype = fr->ntype;
626 vdwtype = mdatoms->typeA;
628 /* Setup water-specific parameters */
629 inr = nlist->iinr[0];
630 iq0 = facel*charge[inr+0];
631 iq1 = facel*charge[inr+1];
632 iq2 = facel*charge[inr+2];
633 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
638 vdwjidx0 = 3*vdwtype[inr+0];
640 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
641 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
642 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
655 /* Start outer loop over neighborlists */
656 for(iidx=0; iidx<nri; iidx++)
658 /* Load shift vector for this list */
659 i_shift_offset = DIM*shiftidx[iidx];
660 shX = shiftvec[i_shift_offset+XX];
661 shY = shiftvec[i_shift_offset+YY];
662 shZ = shiftvec[i_shift_offset+ZZ];
664 /* Load limits for loop over neighbors */
665 j_index_start = jindex[iidx];
666 j_index_end = jindex[iidx+1];
668 /* Get outer coordinate index */
670 i_coord_offset = DIM*inr;
672 /* Load i particle coords and add shift vector */
673 ix0 = shX + x[i_coord_offset+DIM*0+XX];
674 iy0 = shY + x[i_coord_offset+DIM*0+YY];
675 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
676 ix1 = shX + x[i_coord_offset+DIM*1+XX];
677 iy1 = shY + x[i_coord_offset+DIM*1+YY];
678 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
679 ix2 = shX + x[i_coord_offset+DIM*2+XX];
680 iy2 = shY + x[i_coord_offset+DIM*2+YY];
681 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
693 /* Start inner kernel loop */
694 for(jidx=j_index_start; jidx<j_index_end; jidx++)
696 /* Get j neighbor index, and coordinate index */
698 j_coord_offset = DIM*jnr;
700 /* load j atom coordinates */
701 jx0 = x[j_coord_offset+DIM*0+XX];
702 jy0 = x[j_coord_offset+DIM*0+YY];
703 jz0 = x[j_coord_offset+DIM*0+ZZ];
704 jx1 = x[j_coord_offset+DIM*1+XX];
705 jy1 = x[j_coord_offset+DIM*1+YY];
706 jz1 = x[j_coord_offset+DIM*1+ZZ];
707 jx2 = x[j_coord_offset+DIM*2+XX];
708 jy2 = x[j_coord_offset+DIM*2+YY];
709 jz2 = x[j_coord_offset+DIM*2+ZZ];
711 /* Calculate displacement vector */
740 /* Calculate squared distance and things based on it */
741 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
742 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
743 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
744 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
745 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
746 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
747 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
748 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
749 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
751 rinv00 = gmx_invsqrt(rsq00);
752 rinv01 = gmx_invsqrt(rsq01);
753 rinv02 = gmx_invsqrt(rsq02);
754 rinv10 = gmx_invsqrt(rsq10);
755 rinv11 = gmx_invsqrt(rsq11);
756 rinv12 = gmx_invsqrt(rsq12);
757 rinv20 = gmx_invsqrt(rsq20);
758 rinv21 = gmx_invsqrt(rsq21);
759 rinv22 = gmx_invsqrt(rsq22);
761 rinvsq00 = rinv00*rinv00;
762 rinvsq01 = rinv01*rinv01;
763 rinvsq02 = rinv02*rinv02;
764 rinvsq10 = rinv10*rinv10;
765 rinvsq11 = rinv11*rinv11;
766 rinvsq12 = rinv12*rinv12;
767 rinvsq20 = rinv20*rinv20;
768 rinvsq21 = rinv21*rinv21;
769 rinvsq22 = rinv22*rinv22;
771 /**************************
772 * CALCULATE INTERACTIONS *
773 **************************/
777 /* REACTION-FIELD ELECTROSTATICS */
778 felec = qq00*(rinv00*rinvsq00-krf2);
780 /* BUCKINGHAM DISPERSION/REPULSION */
781 rinvsix = rinvsq00*rinvsq00*rinvsq00;
782 vvdw6 = c6_00*rinvsix;
784 vvdwexp = cexp1_00*exp(-br);
785 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
789 /* Calculate temporary vectorial force */
794 /* Update vectorial force */
798 f[j_coord_offset+DIM*0+XX] -= tx;
799 f[j_coord_offset+DIM*0+YY] -= ty;
800 f[j_coord_offset+DIM*0+ZZ] -= tz;
802 /**************************
803 * CALCULATE INTERACTIONS *
804 **************************/
806 /* REACTION-FIELD ELECTROSTATICS */
807 felec = qq01*(rinv01*rinvsq01-krf2);
811 /* Calculate temporary vectorial force */
816 /* Update vectorial force */
820 f[j_coord_offset+DIM*1+XX] -= tx;
821 f[j_coord_offset+DIM*1+YY] -= ty;
822 f[j_coord_offset+DIM*1+ZZ] -= tz;
824 /**************************
825 * CALCULATE INTERACTIONS *
826 **************************/
828 /* REACTION-FIELD ELECTROSTATICS */
829 felec = qq02*(rinv02*rinvsq02-krf2);
833 /* Calculate temporary vectorial force */
838 /* Update vectorial force */
842 f[j_coord_offset+DIM*2+XX] -= tx;
843 f[j_coord_offset+DIM*2+YY] -= ty;
844 f[j_coord_offset+DIM*2+ZZ] -= tz;
846 /**************************
847 * CALCULATE INTERACTIONS *
848 **************************/
850 /* REACTION-FIELD ELECTROSTATICS */
851 felec = qq10*(rinv10*rinvsq10-krf2);
855 /* Calculate temporary vectorial force */
860 /* Update vectorial force */
864 f[j_coord_offset+DIM*0+XX] -= tx;
865 f[j_coord_offset+DIM*0+YY] -= ty;
866 f[j_coord_offset+DIM*0+ZZ] -= tz;
868 /**************************
869 * CALCULATE INTERACTIONS *
870 **************************/
872 /* REACTION-FIELD ELECTROSTATICS */
873 felec = qq11*(rinv11*rinvsq11-krf2);
877 /* Calculate temporary vectorial force */
882 /* Update vectorial force */
886 f[j_coord_offset+DIM*1+XX] -= tx;
887 f[j_coord_offset+DIM*1+YY] -= ty;
888 f[j_coord_offset+DIM*1+ZZ] -= tz;
890 /**************************
891 * CALCULATE INTERACTIONS *
892 **************************/
894 /* REACTION-FIELD ELECTROSTATICS */
895 felec = qq12*(rinv12*rinvsq12-krf2);
899 /* Calculate temporary vectorial force */
904 /* Update vectorial force */
908 f[j_coord_offset+DIM*2+XX] -= tx;
909 f[j_coord_offset+DIM*2+YY] -= ty;
910 f[j_coord_offset+DIM*2+ZZ] -= tz;
912 /**************************
913 * CALCULATE INTERACTIONS *
914 **************************/
916 /* REACTION-FIELD ELECTROSTATICS */
917 felec = qq20*(rinv20*rinvsq20-krf2);
921 /* Calculate temporary vectorial force */
926 /* Update vectorial force */
930 f[j_coord_offset+DIM*0+XX] -= tx;
931 f[j_coord_offset+DIM*0+YY] -= ty;
932 f[j_coord_offset+DIM*0+ZZ] -= tz;
934 /**************************
935 * CALCULATE INTERACTIONS *
936 **************************/
938 /* REACTION-FIELD ELECTROSTATICS */
939 felec = qq21*(rinv21*rinvsq21-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
961 felec = qq22*(rinv22*rinvsq22-krf2);
965 /* Calculate temporary vectorial force */
970 /* Update vectorial force */
974 f[j_coord_offset+DIM*2+XX] -= tx;
975 f[j_coord_offset+DIM*2+YY] -= ty;
976 f[j_coord_offset+DIM*2+ZZ] -= tz;
978 /* Inner loop uses 270 flops */
980 /* End of innermost loop */
983 f[i_coord_offset+DIM*0+XX] += fix0;
984 f[i_coord_offset+DIM*0+YY] += fiy0;
985 f[i_coord_offset+DIM*0+ZZ] += fiz0;
989 f[i_coord_offset+DIM*1+XX] += fix1;
990 f[i_coord_offset+DIM*1+YY] += fiy1;
991 f[i_coord_offset+DIM*1+ZZ] += fiz1;
995 f[i_coord_offset+DIM*2+XX] += fix2;
996 f[i_coord_offset+DIM*2+YY] += fiy2;
997 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1001 fshift[i_shift_offset+XX] += tx;
1002 fshift[i_shift_offset+YY] += ty;
1003 fshift[i_shift_offset+ZZ] += tz;
1005 /* Increment number of inner iterations */
1006 inneriter += j_index_end - j_index_start;
1008 /* Outer loop uses 30 flops */
1011 /* Increment number of outer iterations */
1014 /* Update outer/inner flops */
1016 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*270);