2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW4W4_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: Buckingham
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwBham_GeomW4W4_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 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
81 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
85 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
87 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
88 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
89 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
90 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
91 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
92 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
93 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
94 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
95 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
96 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
97 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
98 real velec,felec,velecsum,facel,crf,krf,krf2;
101 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
110 jindex = nlist->jindex;
112 shiftidx = nlist->shift;
114 shiftvec = fr->shift_vec[0];
115 fshift = fr->fshift[0];
117 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 /* Setup water-specific parameters */
126 inr = nlist->iinr[0];
127 iq1 = facel*charge[inr+1];
128 iq2 = facel*charge[inr+2];
129 iq3 = facel*charge[inr+3];
130 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
135 vdwjidx0 = 3*vdwtype[inr+0];
136 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
137 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
138 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
152 /* Start outer loop over neighborlists */
153 for(iidx=0; iidx<nri; iidx++)
155 /* Load shift vector for this list */
156 i_shift_offset = DIM*shiftidx[iidx];
157 shX = shiftvec[i_shift_offset+XX];
158 shY = shiftvec[i_shift_offset+YY];
159 shZ = shiftvec[i_shift_offset+ZZ];
161 /* Load limits for loop over neighbors */
162 j_index_start = jindex[iidx];
163 j_index_end = jindex[iidx+1];
165 /* Get outer coordinate index */
167 i_coord_offset = DIM*inr;
169 /* Load i particle coords and add shift vector */
170 ix0 = shX + x[i_coord_offset+DIM*0+XX];
171 iy0 = shY + x[i_coord_offset+DIM*0+YY];
172 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
173 ix1 = shX + x[i_coord_offset+DIM*1+XX];
174 iy1 = shY + x[i_coord_offset+DIM*1+YY];
175 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
176 ix2 = shX + x[i_coord_offset+DIM*2+XX];
177 iy2 = shY + x[i_coord_offset+DIM*2+YY];
178 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
179 ix3 = shX + x[i_coord_offset+DIM*3+XX];
180 iy3 = shY + x[i_coord_offset+DIM*3+YY];
181 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
196 /* Reset potential sums */
200 /* Start inner kernel loop */
201 for(jidx=j_index_start; jidx<j_index_end; jidx++)
203 /* Get j neighbor index, and coordinate index */
205 j_coord_offset = DIM*jnr;
207 /* load j atom coordinates */
208 jx0 = x[j_coord_offset+DIM*0+XX];
209 jy0 = x[j_coord_offset+DIM*0+YY];
210 jz0 = x[j_coord_offset+DIM*0+ZZ];
211 jx1 = x[j_coord_offset+DIM*1+XX];
212 jy1 = x[j_coord_offset+DIM*1+YY];
213 jz1 = x[j_coord_offset+DIM*1+ZZ];
214 jx2 = x[j_coord_offset+DIM*2+XX];
215 jy2 = x[j_coord_offset+DIM*2+YY];
216 jz2 = x[j_coord_offset+DIM*2+ZZ];
217 jx3 = x[j_coord_offset+DIM*3+XX];
218 jy3 = x[j_coord_offset+DIM*3+YY];
219 jz3 = x[j_coord_offset+DIM*3+ZZ];
221 /* Calculate displacement vector */
253 /* Calculate squared distance and things based on it */
254 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
255 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
256 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
257 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
258 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
259 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
260 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
261 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
262 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
263 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
265 rinv00 = gmx_invsqrt(rsq00);
266 rinv11 = gmx_invsqrt(rsq11);
267 rinv12 = gmx_invsqrt(rsq12);
268 rinv13 = gmx_invsqrt(rsq13);
269 rinv21 = gmx_invsqrt(rsq21);
270 rinv22 = gmx_invsqrt(rsq22);
271 rinv23 = gmx_invsqrt(rsq23);
272 rinv31 = gmx_invsqrt(rsq31);
273 rinv32 = gmx_invsqrt(rsq32);
274 rinv33 = gmx_invsqrt(rsq33);
276 rinvsq00 = rinv00*rinv00;
277 rinvsq11 = rinv11*rinv11;
278 rinvsq12 = rinv12*rinv12;
279 rinvsq13 = rinv13*rinv13;
280 rinvsq21 = rinv21*rinv21;
281 rinvsq22 = rinv22*rinv22;
282 rinvsq23 = rinv23*rinv23;
283 rinvsq31 = rinv31*rinv31;
284 rinvsq32 = rinv32*rinv32;
285 rinvsq33 = rinv33*rinv33;
287 /**************************
288 * CALCULATE INTERACTIONS *
289 **************************/
293 /* BUCKINGHAM DISPERSION/REPULSION */
294 rinvsix = rinvsq00*rinvsq00*rinvsq00;
295 vvdw6 = c6_00*rinvsix;
297 vvdwexp = cexp1_00*exp(-br);
298 vvdw = vvdwexp - vvdw6*(1.0/6.0);
299 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
301 /* Update potential sums from outer loop */
306 /* Calculate temporary vectorial force */
311 /* Update vectorial force */
315 f[j_coord_offset+DIM*0+XX] -= tx;
316 f[j_coord_offset+DIM*0+YY] -= ty;
317 f[j_coord_offset+DIM*0+ZZ] -= tz;
319 /**************************
320 * CALCULATE INTERACTIONS *
321 **************************/
323 /* REACTION-FIELD ELECTROSTATICS */
324 velec = qq11*(rinv11+krf*rsq11-crf);
325 felec = qq11*(rinv11*rinvsq11-krf2);
327 /* Update potential sums from outer loop */
332 /* Calculate temporary vectorial force */
337 /* Update vectorial force */
341 f[j_coord_offset+DIM*1+XX] -= tx;
342 f[j_coord_offset+DIM*1+YY] -= ty;
343 f[j_coord_offset+DIM*1+ZZ] -= tz;
345 /**************************
346 * CALCULATE INTERACTIONS *
347 **************************/
349 /* REACTION-FIELD ELECTROSTATICS */
350 velec = qq12*(rinv12+krf*rsq12-crf);
351 felec = qq12*(rinv12*rinvsq12-krf2);
353 /* Update potential sums from outer loop */
358 /* Calculate temporary vectorial force */
363 /* Update vectorial force */
367 f[j_coord_offset+DIM*2+XX] -= tx;
368 f[j_coord_offset+DIM*2+YY] -= ty;
369 f[j_coord_offset+DIM*2+ZZ] -= tz;
371 /**************************
372 * CALCULATE INTERACTIONS *
373 **************************/
375 /* REACTION-FIELD ELECTROSTATICS */
376 velec = qq13*(rinv13+krf*rsq13-crf);
377 felec = qq13*(rinv13*rinvsq13-krf2);
379 /* Update potential sums from outer loop */
384 /* Calculate temporary vectorial force */
389 /* Update vectorial force */
393 f[j_coord_offset+DIM*3+XX] -= tx;
394 f[j_coord_offset+DIM*3+YY] -= ty;
395 f[j_coord_offset+DIM*3+ZZ] -= tz;
397 /**************************
398 * CALCULATE INTERACTIONS *
399 **************************/
401 /* REACTION-FIELD ELECTROSTATICS */
402 velec = qq21*(rinv21+krf*rsq21-crf);
403 felec = qq21*(rinv21*rinvsq21-krf2);
405 /* Update potential sums from outer loop */
410 /* Calculate temporary vectorial force */
415 /* Update vectorial force */
419 f[j_coord_offset+DIM*1+XX] -= tx;
420 f[j_coord_offset+DIM*1+YY] -= ty;
421 f[j_coord_offset+DIM*1+ZZ] -= tz;
423 /**************************
424 * CALCULATE INTERACTIONS *
425 **************************/
427 /* REACTION-FIELD ELECTROSTATICS */
428 velec = qq22*(rinv22+krf*rsq22-crf);
429 felec = qq22*(rinv22*rinvsq22-krf2);
431 /* Update potential sums from outer loop */
436 /* Calculate temporary vectorial force */
441 /* Update vectorial force */
445 f[j_coord_offset+DIM*2+XX] -= tx;
446 f[j_coord_offset+DIM*2+YY] -= ty;
447 f[j_coord_offset+DIM*2+ZZ] -= tz;
449 /**************************
450 * CALCULATE INTERACTIONS *
451 **************************/
453 /* REACTION-FIELD ELECTROSTATICS */
454 velec = qq23*(rinv23+krf*rsq23-crf);
455 felec = qq23*(rinv23*rinvsq23-krf2);
457 /* Update potential sums from outer loop */
462 /* Calculate temporary vectorial force */
467 /* Update vectorial force */
471 f[j_coord_offset+DIM*3+XX] -= tx;
472 f[j_coord_offset+DIM*3+YY] -= ty;
473 f[j_coord_offset+DIM*3+ZZ] -= tz;
475 /**************************
476 * CALCULATE INTERACTIONS *
477 **************************/
479 /* REACTION-FIELD ELECTROSTATICS */
480 velec = qq31*(rinv31+krf*rsq31-crf);
481 felec = qq31*(rinv31*rinvsq31-krf2);
483 /* Update potential sums from outer loop */
488 /* Calculate temporary vectorial force */
493 /* Update vectorial force */
497 f[j_coord_offset+DIM*1+XX] -= tx;
498 f[j_coord_offset+DIM*1+YY] -= ty;
499 f[j_coord_offset+DIM*1+ZZ] -= tz;
501 /**************************
502 * CALCULATE INTERACTIONS *
503 **************************/
505 /* REACTION-FIELD ELECTROSTATICS */
506 velec = qq32*(rinv32+krf*rsq32-crf);
507 felec = qq32*(rinv32*rinvsq32-krf2);
509 /* Update potential sums from outer loop */
514 /* Calculate temporary vectorial force */
519 /* Update vectorial force */
523 f[j_coord_offset+DIM*2+XX] -= tx;
524 f[j_coord_offset+DIM*2+YY] -= ty;
525 f[j_coord_offset+DIM*2+ZZ] -= tz;
527 /**************************
528 * CALCULATE INTERACTIONS *
529 **************************/
531 /* REACTION-FIELD ELECTROSTATICS */
532 velec = qq33*(rinv33+krf*rsq33-crf);
533 felec = qq33*(rinv33*rinvsq33-krf2);
535 /* Update potential sums from outer loop */
540 /* Calculate temporary vectorial force */
545 /* Update vectorial force */
549 f[j_coord_offset+DIM*3+XX] -= tx;
550 f[j_coord_offset+DIM*3+YY] -= ty;
551 f[j_coord_offset+DIM*3+ZZ] -= tz;
553 /* Inner loop uses 340 flops */
555 /* End of innermost loop */
558 f[i_coord_offset+DIM*0+XX] += fix0;
559 f[i_coord_offset+DIM*0+YY] += fiy0;
560 f[i_coord_offset+DIM*0+ZZ] += fiz0;
564 f[i_coord_offset+DIM*1+XX] += fix1;
565 f[i_coord_offset+DIM*1+YY] += fiy1;
566 f[i_coord_offset+DIM*1+ZZ] += fiz1;
570 f[i_coord_offset+DIM*2+XX] += fix2;
571 f[i_coord_offset+DIM*2+YY] += fiy2;
572 f[i_coord_offset+DIM*2+ZZ] += fiz2;
576 f[i_coord_offset+DIM*3+XX] += fix3;
577 f[i_coord_offset+DIM*3+YY] += fiy3;
578 f[i_coord_offset+DIM*3+ZZ] += fiz3;
582 fshift[i_shift_offset+XX] += tx;
583 fshift[i_shift_offset+YY] += ty;
584 fshift[i_shift_offset+ZZ] += tz;
587 /* Update potential energies */
588 kernel_data->energygrp_elec[ggid] += velecsum;
589 kernel_data->energygrp_vdw[ggid] += vvdwsum;
591 /* Increment number of inner iterations */
592 inneriter += j_index_end - j_index_start;
594 /* Outer loop uses 41 flops */
597 /* Increment number of outer iterations */
600 /* Update outer/inner flops */
602 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*340);
605 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwBham_GeomW4W4_F_c
606 * Electrostatics interaction: ReactionField
607 * VdW interaction: Buckingham
608 * Geometry: Water4-Water4
609 * Calculate force/pot: Force
612 nb_kernel_ElecRF_VdwBham_GeomW4W4_F_c
613 (t_nblist * gmx_restrict nlist,
614 rvec * gmx_restrict xx,
615 rvec * gmx_restrict ff,
616 t_forcerec * gmx_restrict fr,
617 t_mdatoms * gmx_restrict mdatoms,
618 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
619 t_nrnb * gmx_restrict nrnb)
621 int i_shift_offset,i_coord_offset,j_coord_offset;
622 int j_index_start,j_index_end;
623 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
624 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
625 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
626 real *shiftvec,*fshift,*x,*f;
628 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
630 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
632 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
634 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
636 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
638 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
640 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
642 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
643 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
644 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
645 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
646 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
647 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
648 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
649 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
650 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
651 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
652 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
653 real velec,felec,velecsum,facel,crf,krf,krf2;
656 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
665 jindex = nlist->jindex;
667 shiftidx = nlist->shift;
669 shiftvec = fr->shift_vec[0];
670 fshift = fr->fshift[0];
672 charge = mdatoms->chargeA;
676 nvdwtype = fr->ntype;
678 vdwtype = mdatoms->typeA;
680 /* Setup water-specific parameters */
681 inr = nlist->iinr[0];
682 iq1 = facel*charge[inr+1];
683 iq2 = facel*charge[inr+2];
684 iq3 = facel*charge[inr+3];
685 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
690 vdwjidx0 = 3*vdwtype[inr+0];
691 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
692 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
693 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
707 /* Start outer loop over neighborlists */
708 for(iidx=0; iidx<nri; iidx++)
710 /* Load shift vector for this list */
711 i_shift_offset = DIM*shiftidx[iidx];
712 shX = shiftvec[i_shift_offset+XX];
713 shY = shiftvec[i_shift_offset+YY];
714 shZ = shiftvec[i_shift_offset+ZZ];
716 /* Load limits for loop over neighbors */
717 j_index_start = jindex[iidx];
718 j_index_end = jindex[iidx+1];
720 /* Get outer coordinate index */
722 i_coord_offset = DIM*inr;
724 /* Load i particle coords and add shift vector */
725 ix0 = shX + x[i_coord_offset+DIM*0+XX];
726 iy0 = shY + x[i_coord_offset+DIM*0+YY];
727 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
728 ix1 = shX + x[i_coord_offset+DIM*1+XX];
729 iy1 = shY + x[i_coord_offset+DIM*1+YY];
730 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
731 ix2 = shX + x[i_coord_offset+DIM*2+XX];
732 iy2 = shY + x[i_coord_offset+DIM*2+YY];
733 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
734 ix3 = shX + x[i_coord_offset+DIM*3+XX];
735 iy3 = shY + x[i_coord_offset+DIM*3+YY];
736 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
751 /* Start inner kernel loop */
752 for(jidx=j_index_start; jidx<j_index_end; jidx++)
754 /* Get j neighbor index, and coordinate index */
756 j_coord_offset = DIM*jnr;
758 /* load j atom coordinates */
759 jx0 = x[j_coord_offset+DIM*0+XX];
760 jy0 = x[j_coord_offset+DIM*0+YY];
761 jz0 = x[j_coord_offset+DIM*0+ZZ];
762 jx1 = x[j_coord_offset+DIM*1+XX];
763 jy1 = x[j_coord_offset+DIM*1+YY];
764 jz1 = x[j_coord_offset+DIM*1+ZZ];
765 jx2 = x[j_coord_offset+DIM*2+XX];
766 jy2 = x[j_coord_offset+DIM*2+YY];
767 jz2 = x[j_coord_offset+DIM*2+ZZ];
768 jx3 = x[j_coord_offset+DIM*3+XX];
769 jy3 = x[j_coord_offset+DIM*3+YY];
770 jz3 = x[j_coord_offset+DIM*3+ZZ];
772 /* Calculate displacement vector */
804 /* Calculate squared distance and things based on it */
805 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
806 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
807 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
808 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
809 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
810 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
811 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
812 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
813 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
814 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
816 rinv00 = gmx_invsqrt(rsq00);
817 rinv11 = gmx_invsqrt(rsq11);
818 rinv12 = gmx_invsqrt(rsq12);
819 rinv13 = gmx_invsqrt(rsq13);
820 rinv21 = gmx_invsqrt(rsq21);
821 rinv22 = gmx_invsqrt(rsq22);
822 rinv23 = gmx_invsqrt(rsq23);
823 rinv31 = gmx_invsqrt(rsq31);
824 rinv32 = gmx_invsqrt(rsq32);
825 rinv33 = gmx_invsqrt(rsq33);
827 rinvsq00 = rinv00*rinv00;
828 rinvsq11 = rinv11*rinv11;
829 rinvsq12 = rinv12*rinv12;
830 rinvsq13 = rinv13*rinv13;
831 rinvsq21 = rinv21*rinv21;
832 rinvsq22 = rinv22*rinv22;
833 rinvsq23 = rinv23*rinv23;
834 rinvsq31 = rinv31*rinv31;
835 rinvsq32 = rinv32*rinv32;
836 rinvsq33 = rinv33*rinv33;
838 /**************************
839 * CALCULATE INTERACTIONS *
840 **************************/
844 /* BUCKINGHAM DISPERSION/REPULSION */
845 rinvsix = rinvsq00*rinvsq00*rinvsq00;
846 vvdw6 = c6_00*rinvsix;
848 vvdwexp = cexp1_00*exp(-br);
849 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
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 = qq13*(rinv13*rinvsq13-krf2);
919 /* Calculate temporary vectorial force */
924 /* Update vectorial force */
928 f[j_coord_offset+DIM*3+XX] -= tx;
929 f[j_coord_offset+DIM*3+YY] -= ty;
930 f[j_coord_offset+DIM*3+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 /**************************
977 * CALCULATE INTERACTIONS *
978 **************************/
980 /* REACTION-FIELD ELECTROSTATICS */
981 felec = qq23*(rinv23*rinvsq23-krf2);
985 /* Calculate temporary vectorial force */
990 /* Update vectorial force */
994 f[j_coord_offset+DIM*3+XX] -= tx;
995 f[j_coord_offset+DIM*3+YY] -= ty;
996 f[j_coord_offset+DIM*3+ZZ] -= tz;
998 /**************************
999 * CALCULATE INTERACTIONS *
1000 **************************/
1002 /* REACTION-FIELD ELECTROSTATICS */
1003 felec = qq31*(rinv31*rinvsq31-krf2);
1007 /* Calculate temporary vectorial force */
1012 /* Update vectorial force */
1016 f[j_coord_offset+DIM*1+XX] -= tx;
1017 f[j_coord_offset+DIM*1+YY] -= ty;
1018 f[j_coord_offset+DIM*1+ZZ] -= tz;
1020 /**************************
1021 * CALCULATE INTERACTIONS *
1022 **************************/
1024 /* REACTION-FIELD ELECTROSTATICS */
1025 felec = qq32*(rinv32*rinvsq32-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
1047 felec = qq33*(rinv33*rinvsq33-krf2);
1051 /* Calculate temporary vectorial force */
1056 /* Update vectorial force */
1060 f[j_coord_offset+DIM*3+XX] -= tx;
1061 f[j_coord_offset+DIM*3+YY] -= ty;
1062 f[j_coord_offset+DIM*3+ZZ] -= tz;
1064 /* Inner loop uses 292 flops */
1066 /* End of innermost loop */
1069 f[i_coord_offset+DIM*0+XX] += fix0;
1070 f[i_coord_offset+DIM*0+YY] += fiy0;
1071 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1075 f[i_coord_offset+DIM*1+XX] += fix1;
1076 f[i_coord_offset+DIM*1+YY] += fiy1;
1077 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1081 f[i_coord_offset+DIM*2+XX] += fix2;
1082 f[i_coord_offset+DIM*2+YY] += fiy2;
1083 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1087 f[i_coord_offset+DIM*3+XX] += fix3;
1088 f[i_coord_offset+DIM*3+YY] += fiy3;
1089 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1093 fshift[i_shift_offset+XX] += tx;
1094 fshift[i_shift_offset+YY] += ty;
1095 fshift[i_shift_offset+ZZ] += tz;
1097 /* Increment number of inner iterations */
1098 inneriter += j_index_end - j_index_start;
1100 /* Outer loop uses 39 flops */
1103 /* Increment number of outer iterations */
1106 /* Update outer/inner flops */
1108 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*292);