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 "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_VF_c
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: Buckingham
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_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;
118 nvdwtype = fr->ntype;
120 vdwtype = mdatoms->typeA;
122 /* Setup water-specific parameters */
123 inr = nlist->iinr[0];
124 iq1 = facel*charge[inr+1];
125 iq2 = facel*charge[inr+2];
126 iq3 = facel*charge[inr+3];
127 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
132 vdwjidx0 = 3*vdwtype[inr+0];
133 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
134 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
135 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
149 /* Start outer loop over neighborlists */
150 for(iidx=0; iidx<nri; iidx++)
152 /* Load shift vector for this list */
153 i_shift_offset = DIM*shiftidx[iidx];
154 shX = shiftvec[i_shift_offset+XX];
155 shY = shiftvec[i_shift_offset+YY];
156 shZ = shiftvec[i_shift_offset+ZZ];
158 /* Load limits for loop over neighbors */
159 j_index_start = jindex[iidx];
160 j_index_end = jindex[iidx+1];
162 /* Get outer coordinate index */
164 i_coord_offset = DIM*inr;
166 /* Load i particle coords and add shift vector */
167 ix0 = shX + x[i_coord_offset+DIM*0+XX];
168 iy0 = shY + x[i_coord_offset+DIM*0+YY];
169 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
170 ix1 = shX + x[i_coord_offset+DIM*1+XX];
171 iy1 = shY + x[i_coord_offset+DIM*1+YY];
172 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
173 ix2 = shX + x[i_coord_offset+DIM*2+XX];
174 iy2 = shY + x[i_coord_offset+DIM*2+YY];
175 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
176 ix3 = shX + x[i_coord_offset+DIM*3+XX];
177 iy3 = shY + x[i_coord_offset+DIM*3+YY];
178 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
193 /* Reset potential sums */
197 /* Start inner kernel loop */
198 for(jidx=j_index_start; jidx<j_index_end; jidx++)
200 /* Get j neighbor index, and coordinate index */
202 j_coord_offset = DIM*jnr;
204 /* load j atom coordinates */
205 jx0 = x[j_coord_offset+DIM*0+XX];
206 jy0 = x[j_coord_offset+DIM*0+YY];
207 jz0 = x[j_coord_offset+DIM*0+ZZ];
208 jx1 = x[j_coord_offset+DIM*1+XX];
209 jy1 = x[j_coord_offset+DIM*1+YY];
210 jz1 = x[j_coord_offset+DIM*1+ZZ];
211 jx2 = x[j_coord_offset+DIM*2+XX];
212 jy2 = x[j_coord_offset+DIM*2+YY];
213 jz2 = x[j_coord_offset+DIM*2+ZZ];
214 jx3 = x[j_coord_offset+DIM*3+XX];
215 jy3 = x[j_coord_offset+DIM*3+YY];
216 jz3 = x[j_coord_offset+DIM*3+ZZ];
218 /* Calculate displacement vector */
250 /* Calculate squared distance and things based on it */
251 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
252 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
253 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
254 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
255 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
256 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
257 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
258 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
259 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
260 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
262 rinv00 = gmx_invsqrt(rsq00);
263 rinv11 = gmx_invsqrt(rsq11);
264 rinv12 = gmx_invsqrt(rsq12);
265 rinv13 = gmx_invsqrt(rsq13);
266 rinv21 = gmx_invsqrt(rsq21);
267 rinv22 = gmx_invsqrt(rsq22);
268 rinv23 = gmx_invsqrt(rsq23);
269 rinv31 = gmx_invsqrt(rsq31);
270 rinv32 = gmx_invsqrt(rsq32);
271 rinv33 = gmx_invsqrt(rsq33);
273 rinvsq00 = rinv00*rinv00;
274 rinvsq11 = rinv11*rinv11;
275 rinvsq12 = rinv12*rinv12;
276 rinvsq13 = rinv13*rinv13;
277 rinvsq21 = rinv21*rinv21;
278 rinvsq22 = rinv22*rinv22;
279 rinvsq23 = rinv23*rinv23;
280 rinvsq31 = rinv31*rinv31;
281 rinvsq32 = rinv32*rinv32;
282 rinvsq33 = rinv33*rinv33;
284 /**************************
285 * CALCULATE INTERACTIONS *
286 **************************/
290 /* BUCKINGHAM DISPERSION/REPULSION */
291 rinvsix = rinvsq00*rinvsq00*rinvsq00;
292 vvdw6 = c6_00*rinvsix;
294 vvdwexp = cexp1_00*exp(-br);
295 vvdw = vvdwexp - vvdw6*(1.0/6.0);
296 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
298 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*0+XX] -= tx;
313 f[j_coord_offset+DIM*0+YY] -= ty;
314 f[j_coord_offset+DIM*0+ZZ] -= tz;
316 /**************************
317 * CALCULATE INTERACTIONS *
318 **************************/
320 /* COULOMB ELECTROSTATICS */
322 felec = velec*rinvsq11;
324 /* Update potential sums from outer loop */
329 /* Calculate temporary vectorial force */
334 /* Update vectorial force */
338 f[j_coord_offset+DIM*1+XX] -= tx;
339 f[j_coord_offset+DIM*1+YY] -= ty;
340 f[j_coord_offset+DIM*1+ZZ] -= tz;
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
346 /* COULOMB ELECTROSTATICS */
348 felec = velec*rinvsq12;
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*2+XX] -= tx;
365 f[j_coord_offset+DIM*2+YY] -= ty;
366 f[j_coord_offset+DIM*2+ZZ] -= tz;
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
372 /* COULOMB ELECTROSTATICS */
374 felec = velec*rinvsq13;
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f[j_coord_offset+DIM*3+XX] -= tx;
391 f[j_coord_offset+DIM*3+YY] -= ty;
392 f[j_coord_offset+DIM*3+ZZ] -= tz;
394 /**************************
395 * CALCULATE INTERACTIONS *
396 **************************/
398 /* COULOMB ELECTROSTATICS */
400 felec = velec*rinvsq21;
402 /* Update potential sums from outer loop */
407 /* Calculate temporary vectorial force */
412 /* Update vectorial force */
416 f[j_coord_offset+DIM*1+XX] -= tx;
417 f[j_coord_offset+DIM*1+YY] -= ty;
418 f[j_coord_offset+DIM*1+ZZ] -= tz;
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* COULOMB ELECTROSTATICS */
426 felec = velec*rinvsq22;
428 /* Update potential sums from outer loop */
433 /* Calculate temporary vectorial force */
438 /* Update vectorial force */
442 f[j_coord_offset+DIM*2+XX] -= tx;
443 f[j_coord_offset+DIM*2+YY] -= ty;
444 f[j_coord_offset+DIM*2+ZZ] -= tz;
446 /**************************
447 * CALCULATE INTERACTIONS *
448 **************************/
450 /* COULOMB ELECTROSTATICS */
452 felec = velec*rinvsq23;
454 /* Update potential sums from outer loop */
459 /* Calculate temporary vectorial force */
464 /* Update vectorial force */
468 f[j_coord_offset+DIM*3+XX] -= tx;
469 f[j_coord_offset+DIM*3+YY] -= ty;
470 f[j_coord_offset+DIM*3+ZZ] -= tz;
472 /**************************
473 * CALCULATE INTERACTIONS *
474 **************************/
476 /* COULOMB ELECTROSTATICS */
478 felec = velec*rinvsq31;
480 /* Update potential sums from outer loop */
485 /* Calculate temporary vectorial force */
490 /* Update vectorial force */
494 f[j_coord_offset+DIM*1+XX] -= tx;
495 f[j_coord_offset+DIM*1+YY] -= ty;
496 f[j_coord_offset+DIM*1+ZZ] -= tz;
498 /**************************
499 * CALCULATE INTERACTIONS *
500 **************************/
502 /* COULOMB ELECTROSTATICS */
504 felec = velec*rinvsq32;
506 /* Update potential sums from outer loop */
511 /* Calculate temporary vectorial force */
516 /* Update vectorial force */
520 f[j_coord_offset+DIM*2+XX] -= tx;
521 f[j_coord_offset+DIM*2+YY] -= ty;
522 f[j_coord_offset+DIM*2+ZZ] -= tz;
524 /**************************
525 * CALCULATE INTERACTIONS *
526 **************************/
528 /* COULOMB ELECTROSTATICS */
530 felec = velec*rinvsq33;
532 /* Update potential sums from outer loop */
537 /* Calculate temporary vectorial force */
542 /* Update vectorial force */
546 f[j_coord_offset+DIM*3+XX] -= tx;
547 f[j_coord_offset+DIM*3+YY] -= ty;
548 f[j_coord_offset+DIM*3+ZZ] -= tz;
550 /* Inner loop uses 304 flops */
552 /* End of innermost loop */
555 f[i_coord_offset+DIM*0+XX] += fix0;
556 f[i_coord_offset+DIM*0+YY] += fiy0;
557 f[i_coord_offset+DIM*0+ZZ] += fiz0;
561 f[i_coord_offset+DIM*1+XX] += fix1;
562 f[i_coord_offset+DIM*1+YY] += fiy1;
563 f[i_coord_offset+DIM*1+ZZ] += fiz1;
567 f[i_coord_offset+DIM*2+XX] += fix2;
568 f[i_coord_offset+DIM*2+YY] += fiy2;
569 f[i_coord_offset+DIM*2+ZZ] += fiz2;
573 f[i_coord_offset+DIM*3+XX] += fix3;
574 f[i_coord_offset+DIM*3+YY] += fiy3;
575 f[i_coord_offset+DIM*3+ZZ] += fiz3;
579 fshift[i_shift_offset+XX] += tx;
580 fshift[i_shift_offset+YY] += ty;
581 fshift[i_shift_offset+ZZ] += tz;
584 /* Update potential energies */
585 kernel_data->energygrp_elec[ggid] += velecsum;
586 kernel_data->energygrp_vdw[ggid] += vvdwsum;
588 /* Increment number of inner iterations */
589 inneriter += j_index_end - j_index_start;
591 /* Outer loop uses 41 flops */
594 /* Increment number of outer iterations */
597 /* Update outer/inner flops */
599 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*304);
602 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
603 * Electrostatics interaction: Coulomb
604 * VdW interaction: Buckingham
605 * Geometry: Water4-Water4
606 * Calculate force/pot: Force
609 nb_kernel_ElecCoul_VdwBham_GeomW4W4_F_c
610 (t_nblist * gmx_restrict nlist,
611 rvec * gmx_restrict xx,
612 rvec * gmx_restrict ff,
613 t_forcerec * gmx_restrict fr,
614 t_mdatoms * gmx_restrict mdatoms,
615 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
616 t_nrnb * gmx_restrict nrnb)
618 int i_shift_offset,i_coord_offset,j_coord_offset;
619 int j_index_start,j_index_end;
620 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
621 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
622 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
623 real *shiftvec,*fshift,*x,*f;
625 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
627 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
629 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
631 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
633 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
635 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
637 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
639 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
640 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
641 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
642 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
643 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
644 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
645 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
646 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
647 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
648 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
649 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
650 real velec,felec,velecsum,facel,crf,krf,krf2;
653 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
662 jindex = nlist->jindex;
664 shiftidx = nlist->shift;
666 shiftvec = fr->shift_vec[0];
667 fshift = fr->fshift[0];
669 charge = mdatoms->chargeA;
670 nvdwtype = fr->ntype;
672 vdwtype = mdatoms->typeA;
674 /* Setup water-specific parameters */
675 inr = nlist->iinr[0];
676 iq1 = facel*charge[inr+1];
677 iq2 = facel*charge[inr+2];
678 iq3 = facel*charge[inr+3];
679 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
684 vdwjidx0 = 3*vdwtype[inr+0];
685 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
686 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
687 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
701 /* Start outer loop over neighborlists */
702 for(iidx=0; iidx<nri; iidx++)
704 /* Load shift vector for this list */
705 i_shift_offset = DIM*shiftidx[iidx];
706 shX = shiftvec[i_shift_offset+XX];
707 shY = shiftvec[i_shift_offset+YY];
708 shZ = shiftvec[i_shift_offset+ZZ];
710 /* Load limits for loop over neighbors */
711 j_index_start = jindex[iidx];
712 j_index_end = jindex[iidx+1];
714 /* Get outer coordinate index */
716 i_coord_offset = DIM*inr;
718 /* Load i particle coords and add shift vector */
719 ix0 = shX + x[i_coord_offset+DIM*0+XX];
720 iy0 = shY + x[i_coord_offset+DIM*0+YY];
721 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
722 ix1 = shX + x[i_coord_offset+DIM*1+XX];
723 iy1 = shY + x[i_coord_offset+DIM*1+YY];
724 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
725 ix2 = shX + x[i_coord_offset+DIM*2+XX];
726 iy2 = shY + x[i_coord_offset+DIM*2+YY];
727 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
728 ix3 = shX + x[i_coord_offset+DIM*3+XX];
729 iy3 = shY + x[i_coord_offset+DIM*3+YY];
730 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
745 /* Start inner kernel loop */
746 for(jidx=j_index_start; jidx<j_index_end; jidx++)
748 /* Get j neighbor index, and coordinate index */
750 j_coord_offset = DIM*jnr;
752 /* load j atom coordinates */
753 jx0 = x[j_coord_offset+DIM*0+XX];
754 jy0 = x[j_coord_offset+DIM*0+YY];
755 jz0 = x[j_coord_offset+DIM*0+ZZ];
756 jx1 = x[j_coord_offset+DIM*1+XX];
757 jy1 = x[j_coord_offset+DIM*1+YY];
758 jz1 = x[j_coord_offset+DIM*1+ZZ];
759 jx2 = x[j_coord_offset+DIM*2+XX];
760 jy2 = x[j_coord_offset+DIM*2+YY];
761 jz2 = x[j_coord_offset+DIM*2+ZZ];
762 jx3 = x[j_coord_offset+DIM*3+XX];
763 jy3 = x[j_coord_offset+DIM*3+YY];
764 jz3 = x[j_coord_offset+DIM*3+ZZ];
766 /* Calculate displacement vector */
798 /* Calculate squared distance and things based on it */
799 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
800 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
801 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
802 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
803 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
804 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
805 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
806 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
807 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
808 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
810 rinv00 = gmx_invsqrt(rsq00);
811 rinv11 = gmx_invsqrt(rsq11);
812 rinv12 = gmx_invsqrt(rsq12);
813 rinv13 = gmx_invsqrt(rsq13);
814 rinv21 = gmx_invsqrt(rsq21);
815 rinv22 = gmx_invsqrt(rsq22);
816 rinv23 = gmx_invsqrt(rsq23);
817 rinv31 = gmx_invsqrt(rsq31);
818 rinv32 = gmx_invsqrt(rsq32);
819 rinv33 = gmx_invsqrt(rsq33);
821 rinvsq00 = rinv00*rinv00;
822 rinvsq11 = rinv11*rinv11;
823 rinvsq12 = rinv12*rinv12;
824 rinvsq13 = rinv13*rinv13;
825 rinvsq21 = rinv21*rinv21;
826 rinvsq22 = rinv22*rinv22;
827 rinvsq23 = rinv23*rinv23;
828 rinvsq31 = rinv31*rinv31;
829 rinvsq32 = rinv32*rinv32;
830 rinvsq33 = rinv33*rinv33;
832 /**************************
833 * CALCULATE INTERACTIONS *
834 **************************/
838 /* BUCKINGHAM DISPERSION/REPULSION */
839 rinvsix = rinvsq00*rinvsq00*rinvsq00;
840 vvdw6 = c6_00*rinvsix;
842 vvdwexp = cexp1_00*exp(-br);
843 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
847 /* Calculate temporary vectorial force */
852 /* Update vectorial force */
856 f[j_coord_offset+DIM*0+XX] -= tx;
857 f[j_coord_offset+DIM*0+YY] -= ty;
858 f[j_coord_offset+DIM*0+ZZ] -= tz;
860 /**************************
861 * CALCULATE INTERACTIONS *
862 **************************/
864 /* COULOMB ELECTROSTATICS */
866 felec = velec*rinvsq11;
870 /* Calculate temporary vectorial force */
875 /* Update vectorial force */
879 f[j_coord_offset+DIM*1+XX] -= tx;
880 f[j_coord_offset+DIM*1+YY] -= ty;
881 f[j_coord_offset+DIM*1+ZZ] -= tz;
883 /**************************
884 * CALCULATE INTERACTIONS *
885 **************************/
887 /* COULOMB ELECTROSTATICS */
889 felec = velec*rinvsq12;
893 /* Calculate temporary vectorial force */
898 /* Update vectorial force */
902 f[j_coord_offset+DIM*2+XX] -= tx;
903 f[j_coord_offset+DIM*2+YY] -= ty;
904 f[j_coord_offset+DIM*2+ZZ] -= tz;
906 /**************************
907 * CALCULATE INTERACTIONS *
908 **************************/
910 /* COULOMB ELECTROSTATICS */
912 felec = velec*rinvsq13;
916 /* Calculate temporary vectorial force */
921 /* Update vectorial force */
925 f[j_coord_offset+DIM*3+XX] -= tx;
926 f[j_coord_offset+DIM*3+YY] -= ty;
927 f[j_coord_offset+DIM*3+ZZ] -= tz;
929 /**************************
930 * CALCULATE INTERACTIONS *
931 **************************/
933 /* COULOMB ELECTROSTATICS */
935 felec = velec*rinvsq21;
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 /* COULOMB ELECTROSTATICS */
958 felec = velec*rinvsq22;
962 /* Calculate temporary vectorial force */
967 /* Update vectorial force */
971 f[j_coord_offset+DIM*2+XX] -= tx;
972 f[j_coord_offset+DIM*2+YY] -= ty;
973 f[j_coord_offset+DIM*2+ZZ] -= tz;
975 /**************************
976 * CALCULATE INTERACTIONS *
977 **************************/
979 /* COULOMB ELECTROSTATICS */
981 felec = velec*rinvsq23;
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 /* COULOMB ELECTROSTATICS */
1003 velec = qq31*rinv31;
1004 felec = velec*rinvsq31;
1008 /* Calculate temporary vectorial force */
1013 /* Update vectorial force */
1017 f[j_coord_offset+DIM*1+XX] -= tx;
1018 f[j_coord_offset+DIM*1+YY] -= ty;
1019 f[j_coord_offset+DIM*1+ZZ] -= tz;
1021 /**************************
1022 * CALCULATE INTERACTIONS *
1023 **************************/
1025 /* COULOMB ELECTROSTATICS */
1026 velec = qq32*rinv32;
1027 felec = velec*rinvsq32;
1031 /* Calculate temporary vectorial force */
1036 /* Update vectorial force */
1040 f[j_coord_offset+DIM*2+XX] -= tx;
1041 f[j_coord_offset+DIM*2+YY] -= ty;
1042 f[j_coord_offset+DIM*2+ZZ] -= tz;
1044 /**************************
1045 * CALCULATE INTERACTIONS *
1046 **************************/
1048 /* COULOMB ELECTROSTATICS */
1049 velec = qq33*rinv33;
1050 felec = velec*rinvsq33;
1054 /* Calculate temporary vectorial force */
1059 /* Update vectorial force */
1063 f[j_coord_offset+DIM*3+XX] -= tx;
1064 f[j_coord_offset+DIM*3+YY] -= ty;
1065 f[j_coord_offset+DIM*3+ZZ] -= tz;
1067 /* Inner loop uses 292 flops */
1069 /* End of innermost loop */
1072 f[i_coord_offset+DIM*0+XX] += fix0;
1073 f[i_coord_offset+DIM*0+YY] += fiy0;
1074 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1078 f[i_coord_offset+DIM*1+XX] += fix1;
1079 f[i_coord_offset+DIM*1+YY] += fiy1;
1080 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1084 f[i_coord_offset+DIM*2+XX] += fix2;
1085 f[i_coord_offset+DIM*2+YY] += fiy2;
1086 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1090 f[i_coord_offset+DIM*3+XX] += fix3;
1091 f[i_coord_offset+DIM*3+YY] += fiy3;
1092 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1096 fshift[i_shift_offset+XX] += tx;
1097 fshift[i_shift_offset+YY] += ty;
1098 fshift[i_shift_offset+ZZ] += tz;
1100 /* Increment number of inner iterations */
1101 inneriter += j_index_end - j_index_start;
1103 /* Outer loop uses 39 flops */
1106 /* Increment number of outer iterations */
1109 /* Update outer/inner flops */
1111 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*292);