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_GeomW4W4_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: Buckingham
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRF_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;
119 nvdwtype = fr->ntype;
121 vdwtype = mdatoms->typeA;
123 /* Setup water-specific parameters */
124 inr = nlist->iinr[0];
125 iq1 = facel*charge[inr+1];
126 iq2 = facel*charge[inr+2];
127 iq3 = facel*charge[inr+3];
128 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
133 vdwjidx0 = 3*vdwtype[inr+0];
134 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
135 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
136 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
155 shX = shiftvec[i_shift_offset+XX];
156 shY = shiftvec[i_shift_offset+YY];
157 shZ = shiftvec[i_shift_offset+ZZ];
159 /* Load limits for loop over neighbors */
160 j_index_start = jindex[iidx];
161 j_index_end = jindex[iidx+1];
163 /* Get outer coordinate index */
165 i_coord_offset = DIM*inr;
167 /* Load i particle coords and add shift vector */
168 ix0 = shX + x[i_coord_offset+DIM*0+XX];
169 iy0 = shY + x[i_coord_offset+DIM*0+YY];
170 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
171 ix1 = shX + x[i_coord_offset+DIM*1+XX];
172 iy1 = shY + x[i_coord_offset+DIM*1+YY];
173 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
174 ix2 = shX + x[i_coord_offset+DIM*2+XX];
175 iy2 = shY + x[i_coord_offset+DIM*2+YY];
176 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
177 ix3 = shX + x[i_coord_offset+DIM*3+XX];
178 iy3 = shY + x[i_coord_offset+DIM*3+YY];
179 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
194 /* Reset potential sums */
198 /* Start inner kernel loop */
199 for(jidx=j_index_start; jidx<j_index_end; jidx++)
201 /* Get j neighbor index, and coordinate index */
203 j_coord_offset = DIM*jnr;
205 /* load j atom coordinates */
206 jx0 = x[j_coord_offset+DIM*0+XX];
207 jy0 = x[j_coord_offset+DIM*0+YY];
208 jz0 = x[j_coord_offset+DIM*0+ZZ];
209 jx1 = x[j_coord_offset+DIM*1+XX];
210 jy1 = x[j_coord_offset+DIM*1+YY];
211 jz1 = x[j_coord_offset+DIM*1+ZZ];
212 jx2 = x[j_coord_offset+DIM*2+XX];
213 jy2 = x[j_coord_offset+DIM*2+YY];
214 jz2 = x[j_coord_offset+DIM*2+ZZ];
215 jx3 = x[j_coord_offset+DIM*3+XX];
216 jy3 = x[j_coord_offset+DIM*3+YY];
217 jz3 = x[j_coord_offset+DIM*3+ZZ];
219 /* Calculate displacement vector */
251 /* Calculate squared distance and things based on it */
252 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
253 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
254 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
255 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
256 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
257 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
258 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
259 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
260 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
261 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
263 rinv00 = gmx_invsqrt(rsq00);
264 rinv11 = gmx_invsqrt(rsq11);
265 rinv12 = gmx_invsqrt(rsq12);
266 rinv13 = gmx_invsqrt(rsq13);
267 rinv21 = gmx_invsqrt(rsq21);
268 rinv22 = gmx_invsqrt(rsq22);
269 rinv23 = gmx_invsqrt(rsq23);
270 rinv31 = gmx_invsqrt(rsq31);
271 rinv32 = gmx_invsqrt(rsq32);
272 rinv33 = gmx_invsqrt(rsq33);
274 rinvsq00 = rinv00*rinv00;
275 rinvsq11 = rinv11*rinv11;
276 rinvsq12 = rinv12*rinv12;
277 rinvsq13 = rinv13*rinv13;
278 rinvsq21 = rinv21*rinv21;
279 rinvsq22 = rinv22*rinv22;
280 rinvsq23 = rinv23*rinv23;
281 rinvsq31 = rinv31*rinv31;
282 rinvsq32 = rinv32*rinv32;
283 rinvsq33 = rinv33*rinv33;
285 /**************************
286 * CALCULATE INTERACTIONS *
287 **************************/
291 /* BUCKINGHAM DISPERSION/REPULSION */
292 rinvsix = rinvsq00*rinvsq00*rinvsq00;
293 vvdw6 = c6_00*rinvsix;
295 vvdwexp = cexp1_00*exp(-br);
296 vvdw = vvdwexp - vvdw6*(1.0/6.0);
297 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
299 /* Update potential sums from outer loop */
304 /* Calculate temporary vectorial force */
309 /* Update vectorial force */
313 f[j_coord_offset+DIM*0+XX] -= tx;
314 f[j_coord_offset+DIM*0+YY] -= ty;
315 f[j_coord_offset+DIM*0+ZZ] -= tz;
317 /**************************
318 * CALCULATE INTERACTIONS *
319 **************************/
321 /* REACTION-FIELD ELECTROSTATICS */
322 velec = qq11*(rinv11+krf*rsq11-crf);
323 felec = qq11*(rinv11*rinvsq11-krf2);
325 /* Update potential sums from outer loop */
330 /* Calculate temporary vectorial force */
335 /* Update vectorial force */
339 f[j_coord_offset+DIM*1+XX] -= tx;
340 f[j_coord_offset+DIM*1+YY] -= ty;
341 f[j_coord_offset+DIM*1+ZZ] -= tz;
343 /**************************
344 * CALCULATE INTERACTIONS *
345 **************************/
347 /* REACTION-FIELD ELECTROSTATICS */
348 velec = qq12*(rinv12+krf*rsq12-crf);
349 felec = qq12*(rinv12*rinvsq12-krf2);
351 /* Update potential sums from outer loop */
356 /* Calculate temporary vectorial force */
361 /* Update vectorial force */
365 f[j_coord_offset+DIM*2+XX] -= tx;
366 f[j_coord_offset+DIM*2+YY] -= ty;
367 f[j_coord_offset+DIM*2+ZZ] -= tz;
369 /**************************
370 * CALCULATE INTERACTIONS *
371 **************************/
373 /* REACTION-FIELD ELECTROSTATICS */
374 velec = qq13*(rinv13+krf*rsq13-crf);
375 felec = qq13*(rinv13*rinvsq13-krf2);
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*3+XX] -= tx;
392 f[j_coord_offset+DIM*3+YY] -= ty;
393 f[j_coord_offset+DIM*3+ZZ] -= tz;
395 /**************************
396 * CALCULATE INTERACTIONS *
397 **************************/
399 /* REACTION-FIELD ELECTROSTATICS */
400 velec = qq21*(rinv21+krf*rsq21-crf);
401 felec = qq21*(rinv21*rinvsq21-krf2);
403 /* Update potential sums from outer loop */
408 /* Calculate temporary vectorial force */
413 /* Update vectorial force */
417 f[j_coord_offset+DIM*1+XX] -= tx;
418 f[j_coord_offset+DIM*1+YY] -= ty;
419 f[j_coord_offset+DIM*1+ZZ] -= tz;
421 /**************************
422 * CALCULATE INTERACTIONS *
423 **************************/
425 /* REACTION-FIELD ELECTROSTATICS */
426 velec = qq22*(rinv22+krf*rsq22-crf);
427 felec = qq22*(rinv22*rinvsq22-krf2);
429 /* Update potential sums from outer loop */
434 /* Calculate temporary vectorial force */
439 /* Update vectorial force */
443 f[j_coord_offset+DIM*2+XX] -= tx;
444 f[j_coord_offset+DIM*2+YY] -= ty;
445 f[j_coord_offset+DIM*2+ZZ] -= tz;
447 /**************************
448 * CALCULATE INTERACTIONS *
449 **************************/
451 /* REACTION-FIELD ELECTROSTATICS */
452 velec = qq23*(rinv23+krf*rsq23-crf);
453 felec = qq23*(rinv23*rinvsq23-krf2);
455 /* Update potential sums from outer loop */
460 /* Calculate temporary vectorial force */
465 /* Update vectorial force */
469 f[j_coord_offset+DIM*3+XX] -= tx;
470 f[j_coord_offset+DIM*3+YY] -= ty;
471 f[j_coord_offset+DIM*3+ZZ] -= tz;
473 /**************************
474 * CALCULATE INTERACTIONS *
475 **************************/
477 /* REACTION-FIELD ELECTROSTATICS */
478 velec = qq31*(rinv31+krf*rsq31-crf);
479 felec = qq31*(rinv31*rinvsq31-krf2);
481 /* Update potential sums from outer loop */
486 /* Calculate temporary vectorial force */
491 /* Update vectorial force */
495 f[j_coord_offset+DIM*1+XX] -= tx;
496 f[j_coord_offset+DIM*1+YY] -= ty;
497 f[j_coord_offset+DIM*1+ZZ] -= tz;
499 /**************************
500 * CALCULATE INTERACTIONS *
501 **************************/
503 /* REACTION-FIELD ELECTROSTATICS */
504 velec = qq32*(rinv32+krf*rsq32-crf);
505 felec = qq32*(rinv32*rinvsq32-krf2);
507 /* Update potential sums from outer loop */
512 /* Calculate temporary vectorial force */
517 /* Update vectorial force */
521 f[j_coord_offset+DIM*2+XX] -= tx;
522 f[j_coord_offset+DIM*2+YY] -= ty;
523 f[j_coord_offset+DIM*2+ZZ] -= tz;
525 /**************************
526 * CALCULATE INTERACTIONS *
527 **************************/
529 /* REACTION-FIELD ELECTROSTATICS */
530 velec = qq33*(rinv33+krf*rsq33-crf);
531 felec = qq33*(rinv33*rinvsq33-krf2);
533 /* Update potential sums from outer loop */
538 /* Calculate temporary vectorial force */
543 /* Update vectorial force */
547 f[j_coord_offset+DIM*3+XX] -= tx;
548 f[j_coord_offset+DIM*3+YY] -= ty;
549 f[j_coord_offset+DIM*3+ZZ] -= tz;
551 /* Inner loop uses 340 flops */
553 /* End of innermost loop */
556 f[i_coord_offset+DIM*0+XX] += fix0;
557 f[i_coord_offset+DIM*0+YY] += fiy0;
558 f[i_coord_offset+DIM*0+ZZ] += fiz0;
562 f[i_coord_offset+DIM*1+XX] += fix1;
563 f[i_coord_offset+DIM*1+YY] += fiy1;
564 f[i_coord_offset+DIM*1+ZZ] += fiz1;
568 f[i_coord_offset+DIM*2+XX] += fix2;
569 f[i_coord_offset+DIM*2+YY] += fiy2;
570 f[i_coord_offset+DIM*2+ZZ] += fiz2;
574 f[i_coord_offset+DIM*3+XX] += fix3;
575 f[i_coord_offset+DIM*3+YY] += fiy3;
576 f[i_coord_offset+DIM*3+ZZ] += fiz3;
580 fshift[i_shift_offset+XX] += tx;
581 fshift[i_shift_offset+YY] += ty;
582 fshift[i_shift_offset+ZZ] += tz;
585 /* Update potential energies */
586 kernel_data->energygrp_elec[ggid] += velecsum;
587 kernel_data->energygrp_vdw[ggid] += vvdwsum;
589 /* Increment number of inner iterations */
590 inneriter += j_index_end - j_index_start;
592 /* Outer loop uses 41 flops */
595 /* Increment number of outer iterations */
598 /* Update outer/inner flops */
600 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*340);
603 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW4W4_F_c
604 * Electrostatics interaction: ReactionField
605 * VdW interaction: Buckingham
606 * Geometry: Water4-Water4
607 * Calculate force/pot: Force
610 nb_kernel_ElecRF_VdwBham_GeomW4W4_F_c
611 (t_nblist * gmx_restrict nlist,
612 rvec * gmx_restrict xx,
613 rvec * gmx_restrict ff,
614 t_forcerec * gmx_restrict fr,
615 t_mdatoms * gmx_restrict mdatoms,
616 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
617 t_nrnb * gmx_restrict nrnb)
619 int i_shift_offset,i_coord_offset,j_coord_offset;
620 int j_index_start,j_index_end;
621 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
622 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
623 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
624 real *shiftvec,*fshift,*x,*f;
626 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
628 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
630 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
632 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
634 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
636 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
638 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
640 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
641 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
642 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
643 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
644 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
645 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
646 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
647 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
648 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
649 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
650 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
651 real velec,felec,velecsum,facel,crf,krf,krf2;
654 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
663 jindex = nlist->jindex;
665 shiftidx = nlist->shift;
667 shiftvec = fr->shift_vec[0];
668 fshift = fr->fshift[0];
670 charge = mdatoms->chargeA;
674 nvdwtype = fr->ntype;
676 vdwtype = mdatoms->typeA;
678 /* Setup water-specific parameters */
679 inr = nlist->iinr[0];
680 iq1 = facel*charge[inr+1];
681 iq2 = facel*charge[inr+2];
682 iq3 = facel*charge[inr+3];
683 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
688 vdwjidx0 = 3*vdwtype[inr+0];
689 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
690 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
691 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
705 /* Start outer loop over neighborlists */
706 for(iidx=0; iidx<nri; iidx++)
708 /* Load shift vector for this list */
709 i_shift_offset = DIM*shiftidx[iidx];
710 shX = shiftvec[i_shift_offset+XX];
711 shY = shiftvec[i_shift_offset+YY];
712 shZ = shiftvec[i_shift_offset+ZZ];
714 /* Load limits for loop over neighbors */
715 j_index_start = jindex[iidx];
716 j_index_end = jindex[iidx+1];
718 /* Get outer coordinate index */
720 i_coord_offset = DIM*inr;
722 /* Load i particle coords and add shift vector */
723 ix0 = shX + x[i_coord_offset+DIM*0+XX];
724 iy0 = shY + x[i_coord_offset+DIM*0+YY];
725 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
726 ix1 = shX + x[i_coord_offset+DIM*1+XX];
727 iy1 = shY + x[i_coord_offset+DIM*1+YY];
728 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
729 ix2 = shX + x[i_coord_offset+DIM*2+XX];
730 iy2 = shY + x[i_coord_offset+DIM*2+YY];
731 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
732 ix3 = shX + x[i_coord_offset+DIM*3+XX];
733 iy3 = shY + x[i_coord_offset+DIM*3+YY];
734 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
749 /* Start inner kernel loop */
750 for(jidx=j_index_start; jidx<j_index_end; jidx++)
752 /* Get j neighbor index, and coordinate index */
754 j_coord_offset = DIM*jnr;
756 /* load j atom coordinates */
757 jx0 = x[j_coord_offset+DIM*0+XX];
758 jy0 = x[j_coord_offset+DIM*0+YY];
759 jz0 = x[j_coord_offset+DIM*0+ZZ];
760 jx1 = x[j_coord_offset+DIM*1+XX];
761 jy1 = x[j_coord_offset+DIM*1+YY];
762 jz1 = x[j_coord_offset+DIM*1+ZZ];
763 jx2 = x[j_coord_offset+DIM*2+XX];
764 jy2 = x[j_coord_offset+DIM*2+YY];
765 jz2 = x[j_coord_offset+DIM*2+ZZ];
766 jx3 = x[j_coord_offset+DIM*3+XX];
767 jy3 = x[j_coord_offset+DIM*3+YY];
768 jz3 = x[j_coord_offset+DIM*3+ZZ];
770 /* Calculate displacement vector */
802 /* Calculate squared distance and things based on it */
803 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
804 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
805 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
806 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
807 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
808 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
809 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
810 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
811 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
812 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
814 rinv00 = gmx_invsqrt(rsq00);
815 rinv11 = gmx_invsqrt(rsq11);
816 rinv12 = gmx_invsqrt(rsq12);
817 rinv13 = gmx_invsqrt(rsq13);
818 rinv21 = gmx_invsqrt(rsq21);
819 rinv22 = gmx_invsqrt(rsq22);
820 rinv23 = gmx_invsqrt(rsq23);
821 rinv31 = gmx_invsqrt(rsq31);
822 rinv32 = gmx_invsqrt(rsq32);
823 rinv33 = gmx_invsqrt(rsq33);
825 rinvsq00 = rinv00*rinv00;
826 rinvsq11 = rinv11*rinv11;
827 rinvsq12 = rinv12*rinv12;
828 rinvsq13 = rinv13*rinv13;
829 rinvsq21 = rinv21*rinv21;
830 rinvsq22 = rinv22*rinv22;
831 rinvsq23 = rinv23*rinv23;
832 rinvsq31 = rinv31*rinv31;
833 rinvsq32 = rinv32*rinv32;
834 rinvsq33 = rinv33*rinv33;
836 /**************************
837 * CALCULATE INTERACTIONS *
838 **************************/
842 /* BUCKINGHAM DISPERSION/REPULSION */
843 rinvsix = rinvsq00*rinvsq00*rinvsq00;
844 vvdw6 = c6_00*rinvsix;
846 vvdwexp = cexp1_00*exp(-br);
847 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
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 /* REACTION-FIELD ELECTROSTATICS */
869 felec = qq11*(rinv11*rinvsq11-krf2);
873 /* Calculate temporary vectorial force */
878 /* Update vectorial force */
882 f[j_coord_offset+DIM*1+XX] -= tx;
883 f[j_coord_offset+DIM*1+YY] -= ty;
884 f[j_coord_offset+DIM*1+ZZ] -= tz;
886 /**************************
887 * CALCULATE INTERACTIONS *
888 **************************/
890 /* REACTION-FIELD ELECTROSTATICS */
891 felec = qq12*(rinv12*rinvsq12-krf2);
895 /* Calculate temporary vectorial force */
900 /* Update vectorial force */
904 f[j_coord_offset+DIM*2+XX] -= tx;
905 f[j_coord_offset+DIM*2+YY] -= ty;
906 f[j_coord_offset+DIM*2+ZZ] -= tz;
908 /**************************
909 * CALCULATE INTERACTIONS *
910 **************************/
912 /* REACTION-FIELD ELECTROSTATICS */
913 felec = qq13*(rinv13*rinvsq13-krf2);
917 /* Calculate temporary vectorial force */
922 /* Update vectorial force */
926 f[j_coord_offset+DIM*3+XX] -= tx;
927 f[j_coord_offset+DIM*3+YY] -= ty;
928 f[j_coord_offset+DIM*3+ZZ] -= tz;
930 /**************************
931 * CALCULATE INTERACTIONS *
932 **************************/
934 /* REACTION-FIELD ELECTROSTATICS */
935 felec = qq21*(rinv21*rinvsq21-krf2);
939 /* Calculate temporary vectorial force */
944 /* Update vectorial force */
948 f[j_coord_offset+DIM*1+XX] -= tx;
949 f[j_coord_offset+DIM*1+YY] -= ty;
950 f[j_coord_offset+DIM*1+ZZ] -= tz;
952 /**************************
953 * CALCULATE INTERACTIONS *
954 **************************/
956 /* REACTION-FIELD ELECTROSTATICS */
957 felec = qq22*(rinv22*rinvsq22-krf2);
961 /* Calculate temporary vectorial force */
966 /* Update vectorial force */
970 f[j_coord_offset+DIM*2+XX] -= tx;
971 f[j_coord_offset+DIM*2+YY] -= ty;
972 f[j_coord_offset+DIM*2+ZZ] -= tz;
974 /**************************
975 * CALCULATE INTERACTIONS *
976 **************************/
978 /* REACTION-FIELD ELECTROSTATICS */
979 felec = qq23*(rinv23*rinvsq23-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
1001 felec = qq31*(rinv31*rinvsq31-krf2);
1005 /* Calculate temporary vectorial force */
1010 /* Update vectorial force */
1014 f[j_coord_offset+DIM*1+XX] -= tx;
1015 f[j_coord_offset+DIM*1+YY] -= ty;
1016 f[j_coord_offset+DIM*1+ZZ] -= tz;
1018 /**************************
1019 * CALCULATE INTERACTIONS *
1020 **************************/
1022 /* REACTION-FIELD ELECTROSTATICS */
1023 felec = qq32*(rinv32*rinvsq32-krf2);
1027 /* Calculate temporary vectorial force */
1032 /* Update vectorial force */
1036 f[j_coord_offset+DIM*2+XX] -= tx;
1037 f[j_coord_offset+DIM*2+YY] -= ty;
1038 f[j_coord_offset+DIM*2+ZZ] -= tz;
1040 /**************************
1041 * CALCULATE INTERACTIONS *
1042 **************************/
1044 /* REACTION-FIELD ELECTROSTATICS */
1045 felec = qq33*(rinv33*rinvsq33-krf2);
1049 /* Calculate temporary vectorial force */
1054 /* Update vectorial force */
1058 f[j_coord_offset+DIM*3+XX] -= tx;
1059 f[j_coord_offset+DIM*3+YY] -= ty;
1060 f[j_coord_offset+DIM*3+ZZ] -= tz;
1062 /* Inner loop uses 292 flops */
1064 /* End of innermost loop */
1067 f[i_coord_offset+DIM*0+XX] += fix0;
1068 f[i_coord_offset+DIM*0+YY] += fiy0;
1069 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1073 f[i_coord_offset+DIM*1+XX] += fix1;
1074 f[i_coord_offset+DIM*1+YY] += fiy1;
1075 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1079 f[i_coord_offset+DIM*2+XX] += fix2;
1080 f[i_coord_offset+DIM*2+YY] += fiy2;
1081 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1085 f[i_coord_offset+DIM*3+XX] += fix3;
1086 f[i_coord_offset+DIM*3+YY] += fiy3;
1087 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1091 fshift[i_shift_offset+XX] += tx;
1092 fshift[i_shift_offset+YY] += ty;
1093 fshift[i_shift_offset+ZZ] += tz;
1095 /* Increment number of inner iterations */
1096 inneriter += j_index_end - j_index_start;
1098 /* Outer loop uses 39 flops */
1101 /* Increment number of outer iterations */
1104 /* Update outer/inner flops */
1106 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*292);