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_ElecRF_VdwBham_GeomW3W3_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: Buckingham
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRF_VdwBham_GeomW3W3_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 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];
110 charge = mdatoms->chargeA;
114 nvdwtype = fr->ntype;
116 vdwtype = mdatoms->typeA;
118 /* Setup water-specific parameters */
119 inr = nlist->iinr[0];
120 iq0 = facel*charge[inr+0];
121 iq1 = facel*charge[inr+1];
122 iq2 = facel*charge[inr+2];
123 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
128 vdwjidx0 = 3*vdwtype[inr+0];
130 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
131 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
132 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
145 /* Start outer loop over neighborlists */
146 for(iidx=0; iidx<nri; iidx++)
148 /* Load shift vector for this list */
149 i_shift_offset = DIM*shiftidx[iidx];
150 shX = shiftvec[i_shift_offset+XX];
151 shY = shiftvec[i_shift_offset+YY];
152 shZ = shiftvec[i_shift_offset+ZZ];
154 /* Load limits for loop over neighbors */
155 j_index_start = jindex[iidx];
156 j_index_end = jindex[iidx+1];
158 /* Get outer coordinate index */
160 i_coord_offset = DIM*inr;
162 /* Load i particle coords and add shift vector */
163 ix0 = shX + x[i_coord_offset+DIM*0+XX];
164 iy0 = shY + x[i_coord_offset+DIM*0+YY];
165 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
166 ix1 = shX + x[i_coord_offset+DIM*1+XX];
167 iy1 = shY + x[i_coord_offset+DIM*1+YY];
168 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
169 ix2 = shX + x[i_coord_offset+DIM*2+XX];
170 iy2 = shY + x[i_coord_offset+DIM*2+YY];
171 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
183 /* Reset potential sums */
187 /* Start inner kernel loop */
188 for(jidx=j_index_start; jidx<j_index_end; jidx++)
190 /* Get j neighbor index, and coordinate index */
192 j_coord_offset = DIM*jnr;
194 /* load j atom coordinates */
195 jx0 = x[j_coord_offset+DIM*0+XX];
196 jy0 = x[j_coord_offset+DIM*0+YY];
197 jz0 = x[j_coord_offset+DIM*0+ZZ];
198 jx1 = x[j_coord_offset+DIM*1+XX];
199 jy1 = x[j_coord_offset+DIM*1+YY];
200 jz1 = x[j_coord_offset+DIM*1+ZZ];
201 jx2 = x[j_coord_offset+DIM*2+XX];
202 jy2 = x[j_coord_offset+DIM*2+YY];
203 jz2 = x[j_coord_offset+DIM*2+ZZ];
205 /* Calculate displacement vector */
234 /* Calculate squared distance and things based on it */
235 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
236 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
237 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
238 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
239 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
240 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
241 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
242 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
243 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
245 rinv00 = gmx_invsqrt(rsq00);
246 rinv01 = gmx_invsqrt(rsq01);
247 rinv02 = gmx_invsqrt(rsq02);
248 rinv10 = gmx_invsqrt(rsq10);
249 rinv11 = gmx_invsqrt(rsq11);
250 rinv12 = gmx_invsqrt(rsq12);
251 rinv20 = gmx_invsqrt(rsq20);
252 rinv21 = gmx_invsqrt(rsq21);
253 rinv22 = gmx_invsqrt(rsq22);
255 rinvsq00 = rinv00*rinv00;
256 rinvsq01 = rinv01*rinv01;
257 rinvsq02 = rinv02*rinv02;
258 rinvsq10 = rinv10*rinv10;
259 rinvsq11 = rinv11*rinv11;
260 rinvsq12 = rinv12*rinv12;
261 rinvsq20 = rinv20*rinv20;
262 rinvsq21 = rinv21*rinv21;
263 rinvsq22 = rinv22*rinv22;
265 /**************************
266 * CALCULATE INTERACTIONS *
267 **************************/
271 /* REACTION-FIELD ELECTROSTATICS */
272 velec = qq00*(rinv00+krf*rsq00-crf);
273 felec = qq00*(rinv00*rinvsq00-krf2);
275 /* BUCKINGHAM DISPERSION/REPULSION */
276 rinvsix = rinvsq00*rinvsq00*rinvsq00;
277 vvdw6 = c6_00*rinvsix;
279 vvdwexp = cexp1_00*exp(-br);
280 vvdw = vvdwexp - vvdw6*(1.0/6.0);
281 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
283 /* Update potential sums from outer loop */
289 /* Calculate temporary vectorial force */
294 /* Update vectorial force */
298 f[j_coord_offset+DIM*0+XX] -= tx;
299 f[j_coord_offset+DIM*0+YY] -= ty;
300 f[j_coord_offset+DIM*0+ZZ] -= tz;
302 /**************************
303 * CALCULATE INTERACTIONS *
304 **************************/
306 /* REACTION-FIELD ELECTROSTATICS */
307 velec = qq01*(rinv01+krf*rsq01-crf);
308 felec = qq01*(rinv01*rinvsq01-krf2);
310 /* Update potential sums from outer loop */
315 /* Calculate temporary vectorial force */
320 /* Update vectorial force */
324 f[j_coord_offset+DIM*1+XX] -= tx;
325 f[j_coord_offset+DIM*1+YY] -= ty;
326 f[j_coord_offset+DIM*1+ZZ] -= tz;
328 /**************************
329 * CALCULATE INTERACTIONS *
330 **************************/
332 /* REACTION-FIELD ELECTROSTATICS */
333 velec = qq02*(rinv02+krf*rsq02-crf);
334 felec = qq02*(rinv02*rinvsq02-krf2);
336 /* Update potential sums from outer loop */
341 /* Calculate temporary vectorial force */
346 /* Update vectorial force */
350 f[j_coord_offset+DIM*2+XX] -= tx;
351 f[j_coord_offset+DIM*2+YY] -= ty;
352 f[j_coord_offset+DIM*2+ZZ] -= tz;
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
358 /* REACTION-FIELD ELECTROSTATICS */
359 velec = qq10*(rinv10+krf*rsq10-crf);
360 felec = qq10*(rinv10*rinvsq10-krf2);
362 /* Update potential sums from outer loop */
367 /* Calculate temporary vectorial force */
372 /* Update vectorial force */
376 f[j_coord_offset+DIM*0+XX] -= tx;
377 f[j_coord_offset+DIM*0+YY] -= ty;
378 f[j_coord_offset+DIM*0+ZZ] -= tz;
380 /**************************
381 * CALCULATE INTERACTIONS *
382 **************************/
384 /* REACTION-FIELD ELECTROSTATICS */
385 velec = qq11*(rinv11+krf*rsq11-crf);
386 felec = qq11*(rinv11*rinvsq11-krf2);
388 /* Update potential sums from outer loop */
393 /* Calculate temporary vectorial force */
398 /* Update vectorial force */
402 f[j_coord_offset+DIM*1+XX] -= tx;
403 f[j_coord_offset+DIM*1+YY] -= ty;
404 f[j_coord_offset+DIM*1+ZZ] -= tz;
406 /**************************
407 * CALCULATE INTERACTIONS *
408 **************************/
410 /* REACTION-FIELD ELECTROSTATICS */
411 velec = qq12*(rinv12+krf*rsq12-crf);
412 felec = qq12*(rinv12*rinvsq12-krf2);
414 /* Update potential sums from outer loop */
419 /* Calculate temporary vectorial force */
424 /* Update vectorial force */
428 f[j_coord_offset+DIM*2+XX] -= tx;
429 f[j_coord_offset+DIM*2+YY] -= ty;
430 f[j_coord_offset+DIM*2+ZZ] -= tz;
432 /**************************
433 * CALCULATE INTERACTIONS *
434 **************************/
436 /* REACTION-FIELD ELECTROSTATICS */
437 velec = qq20*(rinv20+krf*rsq20-crf);
438 felec = qq20*(rinv20*rinvsq20-krf2);
440 /* Update potential sums from outer loop */
445 /* Calculate temporary vectorial force */
450 /* Update vectorial force */
454 f[j_coord_offset+DIM*0+XX] -= tx;
455 f[j_coord_offset+DIM*0+YY] -= ty;
456 f[j_coord_offset+DIM*0+ZZ] -= tz;
458 /**************************
459 * CALCULATE INTERACTIONS *
460 **************************/
462 /* REACTION-FIELD ELECTROSTATICS */
463 velec = qq21*(rinv21+krf*rsq21-crf);
464 felec = qq21*(rinv21*rinvsq21-krf2);
466 /* Update potential sums from outer loop */
471 /* Calculate temporary vectorial force */
476 /* Update vectorial force */
480 f[j_coord_offset+DIM*1+XX] -= tx;
481 f[j_coord_offset+DIM*1+YY] -= ty;
482 f[j_coord_offset+DIM*1+ZZ] -= tz;
484 /**************************
485 * CALCULATE INTERACTIONS *
486 **************************/
488 /* REACTION-FIELD ELECTROSTATICS */
489 velec = qq22*(rinv22+krf*rsq22-crf);
490 felec = qq22*(rinv22*rinvsq22-krf2);
492 /* Update potential sums from outer loop */
497 /* Calculate temporary vectorial force */
502 /* Update vectorial force */
506 f[j_coord_offset+DIM*2+XX] -= tx;
507 f[j_coord_offset+DIM*2+YY] -= ty;
508 f[j_coord_offset+DIM*2+ZZ] -= tz;
510 /* Inner loop uses 318 flops */
512 /* End of innermost loop */
515 f[i_coord_offset+DIM*0+XX] += fix0;
516 f[i_coord_offset+DIM*0+YY] += fiy0;
517 f[i_coord_offset+DIM*0+ZZ] += fiz0;
521 f[i_coord_offset+DIM*1+XX] += fix1;
522 f[i_coord_offset+DIM*1+YY] += fiy1;
523 f[i_coord_offset+DIM*1+ZZ] += fiz1;
527 f[i_coord_offset+DIM*2+XX] += fix2;
528 f[i_coord_offset+DIM*2+YY] += fiy2;
529 f[i_coord_offset+DIM*2+ZZ] += fiz2;
533 fshift[i_shift_offset+XX] += tx;
534 fshift[i_shift_offset+YY] += ty;
535 fshift[i_shift_offset+ZZ] += tz;
538 /* Update potential energies */
539 kernel_data->energygrp_elec[ggid] += velecsum;
540 kernel_data->energygrp_vdw[ggid] += vvdwsum;
542 /* Increment number of inner iterations */
543 inneriter += j_index_end - j_index_start;
545 /* Outer loop uses 32 flops */
548 /* Increment number of outer iterations */
551 /* Update outer/inner flops */
553 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*318);
556 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW3W3_F_c
557 * Electrostatics interaction: ReactionField
558 * VdW interaction: Buckingham
559 * Geometry: Water3-Water3
560 * Calculate force/pot: Force
563 nb_kernel_ElecRF_VdwBham_GeomW3W3_F_c
564 (t_nblist * gmx_restrict nlist,
565 rvec * gmx_restrict xx,
566 rvec * gmx_restrict ff,
567 t_forcerec * gmx_restrict fr,
568 t_mdatoms * gmx_restrict mdatoms,
569 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
570 t_nrnb * gmx_restrict nrnb)
572 int i_shift_offset,i_coord_offset,j_coord_offset;
573 int j_index_start,j_index_end;
574 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
575 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
576 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
577 real *shiftvec,*fshift,*x,*f;
579 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
581 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
583 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
585 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
587 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
589 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
590 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
591 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
592 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
593 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
594 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
595 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
596 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
597 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
598 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
599 real velec,felec,velecsum,facel,crf,krf,krf2;
602 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
611 jindex = nlist->jindex;
613 shiftidx = nlist->shift;
615 shiftvec = fr->shift_vec[0];
616 fshift = fr->fshift[0];
618 charge = mdatoms->chargeA;
622 nvdwtype = fr->ntype;
624 vdwtype = mdatoms->typeA;
626 /* Setup water-specific parameters */
627 inr = nlist->iinr[0];
628 iq0 = facel*charge[inr+0];
629 iq1 = facel*charge[inr+1];
630 iq2 = facel*charge[inr+2];
631 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
636 vdwjidx0 = 3*vdwtype[inr+0];
638 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
639 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
640 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
653 /* Start outer loop over neighborlists */
654 for(iidx=0; iidx<nri; iidx++)
656 /* Load shift vector for this list */
657 i_shift_offset = DIM*shiftidx[iidx];
658 shX = shiftvec[i_shift_offset+XX];
659 shY = shiftvec[i_shift_offset+YY];
660 shZ = shiftvec[i_shift_offset+ZZ];
662 /* Load limits for loop over neighbors */
663 j_index_start = jindex[iidx];
664 j_index_end = jindex[iidx+1];
666 /* Get outer coordinate index */
668 i_coord_offset = DIM*inr;
670 /* Load i particle coords and add shift vector */
671 ix0 = shX + x[i_coord_offset+DIM*0+XX];
672 iy0 = shY + x[i_coord_offset+DIM*0+YY];
673 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
674 ix1 = shX + x[i_coord_offset+DIM*1+XX];
675 iy1 = shY + x[i_coord_offset+DIM*1+YY];
676 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
677 ix2 = shX + x[i_coord_offset+DIM*2+XX];
678 iy2 = shY + x[i_coord_offset+DIM*2+YY];
679 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
691 /* Start inner kernel loop */
692 for(jidx=j_index_start; jidx<j_index_end; jidx++)
694 /* Get j neighbor index, and coordinate index */
696 j_coord_offset = DIM*jnr;
698 /* load j atom coordinates */
699 jx0 = x[j_coord_offset+DIM*0+XX];
700 jy0 = x[j_coord_offset+DIM*0+YY];
701 jz0 = x[j_coord_offset+DIM*0+ZZ];
702 jx1 = x[j_coord_offset+DIM*1+XX];
703 jy1 = x[j_coord_offset+DIM*1+YY];
704 jz1 = x[j_coord_offset+DIM*1+ZZ];
705 jx2 = x[j_coord_offset+DIM*2+XX];
706 jy2 = x[j_coord_offset+DIM*2+YY];
707 jz2 = x[j_coord_offset+DIM*2+ZZ];
709 /* Calculate displacement vector */
738 /* Calculate squared distance and things based on it */
739 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
740 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
741 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
742 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
743 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
744 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
745 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
746 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
747 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
749 rinv00 = gmx_invsqrt(rsq00);
750 rinv01 = gmx_invsqrt(rsq01);
751 rinv02 = gmx_invsqrt(rsq02);
752 rinv10 = gmx_invsqrt(rsq10);
753 rinv11 = gmx_invsqrt(rsq11);
754 rinv12 = gmx_invsqrt(rsq12);
755 rinv20 = gmx_invsqrt(rsq20);
756 rinv21 = gmx_invsqrt(rsq21);
757 rinv22 = gmx_invsqrt(rsq22);
759 rinvsq00 = rinv00*rinv00;
760 rinvsq01 = rinv01*rinv01;
761 rinvsq02 = rinv02*rinv02;
762 rinvsq10 = rinv10*rinv10;
763 rinvsq11 = rinv11*rinv11;
764 rinvsq12 = rinv12*rinv12;
765 rinvsq20 = rinv20*rinv20;
766 rinvsq21 = rinv21*rinv21;
767 rinvsq22 = rinv22*rinv22;
769 /**************************
770 * CALCULATE INTERACTIONS *
771 **************************/
775 /* REACTION-FIELD ELECTROSTATICS */
776 felec = qq00*(rinv00*rinvsq00-krf2);
778 /* BUCKINGHAM DISPERSION/REPULSION */
779 rinvsix = rinvsq00*rinvsq00*rinvsq00;
780 vvdw6 = c6_00*rinvsix;
782 vvdwexp = cexp1_00*exp(-br);
783 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
787 /* Calculate temporary vectorial force */
792 /* Update vectorial force */
796 f[j_coord_offset+DIM*0+XX] -= tx;
797 f[j_coord_offset+DIM*0+YY] -= ty;
798 f[j_coord_offset+DIM*0+ZZ] -= tz;
800 /**************************
801 * CALCULATE INTERACTIONS *
802 **************************/
804 /* REACTION-FIELD ELECTROSTATICS */
805 felec = qq01*(rinv01*rinvsq01-krf2);
809 /* Calculate temporary vectorial force */
814 /* Update vectorial force */
818 f[j_coord_offset+DIM*1+XX] -= tx;
819 f[j_coord_offset+DIM*1+YY] -= ty;
820 f[j_coord_offset+DIM*1+ZZ] -= tz;
822 /**************************
823 * CALCULATE INTERACTIONS *
824 **************************/
826 /* REACTION-FIELD ELECTROSTATICS */
827 felec = qq02*(rinv02*rinvsq02-krf2);
831 /* Calculate temporary vectorial force */
836 /* Update vectorial force */
840 f[j_coord_offset+DIM*2+XX] -= tx;
841 f[j_coord_offset+DIM*2+YY] -= ty;
842 f[j_coord_offset+DIM*2+ZZ] -= tz;
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* REACTION-FIELD ELECTROSTATICS */
849 felec = qq10*(rinv10*rinvsq10-krf2);
853 /* Calculate temporary vectorial force */
858 /* Update vectorial force */
862 f[j_coord_offset+DIM*0+XX] -= tx;
863 f[j_coord_offset+DIM*0+YY] -= ty;
864 f[j_coord_offset+DIM*0+ZZ] -= tz;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
870 /* REACTION-FIELD ELECTROSTATICS */
871 felec = qq11*(rinv11*rinvsq11-krf2);
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*1+XX] -= tx;
885 f[j_coord_offset+DIM*1+YY] -= ty;
886 f[j_coord_offset+DIM*1+ZZ] -= tz;
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
892 /* REACTION-FIELD ELECTROSTATICS */
893 felec = qq12*(rinv12*rinvsq12-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
915 felec = qq20*(rinv20*rinvsq20-krf2);
919 /* Calculate temporary vectorial force */
924 /* Update vectorial force */
928 f[j_coord_offset+DIM*0+XX] -= tx;
929 f[j_coord_offset+DIM*0+YY] -= ty;
930 f[j_coord_offset+DIM*0+ZZ] -= tz;
932 /**************************
933 * CALCULATE INTERACTIONS *
934 **************************/
936 /* REACTION-FIELD ELECTROSTATICS */
937 felec = qq21*(rinv21*rinvsq21-krf2);
941 /* Calculate temporary vectorial force */
946 /* Update vectorial force */
950 f[j_coord_offset+DIM*1+XX] -= tx;
951 f[j_coord_offset+DIM*1+YY] -= ty;
952 f[j_coord_offset+DIM*1+ZZ] -= tz;
954 /**************************
955 * CALCULATE INTERACTIONS *
956 **************************/
958 /* REACTION-FIELD ELECTROSTATICS */
959 felec = qq22*(rinv22*rinvsq22-krf2);
963 /* Calculate temporary vectorial force */
968 /* Update vectorial force */
972 f[j_coord_offset+DIM*2+XX] -= tx;
973 f[j_coord_offset+DIM*2+YY] -= ty;
974 f[j_coord_offset+DIM*2+ZZ] -= tz;
976 /* Inner loop uses 270 flops */
978 /* End of innermost loop */
981 f[i_coord_offset+DIM*0+XX] += fix0;
982 f[i_coord_offset+DIM*0+YY] += fiy0;
983 f[i_coord_offset+DIM*0+ZZ] += fiz0;
987 f[i_coord_offset+DIM*1+XX] += fix1;
988 f[i_coord_offset+DIM*1+YY] += fiy1;
989 f[i_coord_offset+DIM*1+ZZ] += fiz1;
993 f[i_coord_offset+DIM*2+XX] += fix2;
994 f[i_coord_offset+DIM*2+YY] += fiy2;
995 f[i_coord_offset+DIM*2+ZZ] += fiz2;
999 fshift[i_shift_offset+XX] += tx;
1000 fshift[i_shift_offset+YY] += ty;
1001 fshift[i_shift_offset+ZZ] += tz;
1003 /* Increment number of inner iterations */
1004 inneriter += j_index_end - j_index_start;
1006 /* Outer loop uses 30 flops */
1009 /* Increment number of outer iterations */
1012 /* Update outer/inner flops */
1014 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*270);