Introduce gmxpre.h for truly global definitions
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sse4_1_double / nb_kernel_ElecCoul_VdwLJ_GeomP1P1_sse4_1_double.c
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
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.
8  *
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.
13  *
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.
18  *
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.
23  *
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.
31  *
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.
34  */
35 /*
36  * Note: this file was generated by the GROMACS sse4_1_double kernel generator.
37  */
38 #include "gmxpre.h"
39
40 #include "config.h"
41
42 #include <math.h>
43
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
48
49 #include "gromacs/simd/math_x86_sse4_1_double.h"
50 #include "kernelutil_x86_sse4_1_double.h"
51
52 /*
53  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwLJ_GeomP1P1_VF_sse4_1_double
54  * Electrostatics interaction: Coulomb
55  * VdW interaction:            LennardJones
56  * Geometry:                   Particle-Particle
57  * Calculate force/pot:        PotentialAndForce
58  */
59 void
60 nb_kernel_ElecCoul_VdwLJ_GeomP1P1_VF_sse4_1_double
61                     (t_nblist                    * gmx_restrict       nlist,
62                      rvec                        * gmx_restrict          xx,
63                      rvec                        * gmx_restrict          ff,
64                      t_forcerec                  * gmx_restrict          fr,
65                      t_mdatoms                   * gmx_restrict     mdatoms,
66                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
67                      t_nrnb                      * gmx_restrict        nrnb)
68 {
69     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
70      * just 0 for non-waters.
71      * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
72      * jnr indices corresponding to data put in the four positions in the SIMD register.
73      */
74     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
75     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76     int              jnrA,jnrB;
77     int              j_coord_offsetA,j_coord_offsetB;
78     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
79     real             rcutoff_scalar;
80     real             *shiftvec,*fshift,*x,*f;
81     __m128d          tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
82     int              vdwioffset0;
83     __m128d          ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
84     int              vdwjidx0A,vdwjidx0B;
85     __m128d          jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
86     __m128d          dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
87     __m128d          velec,felec,velecsum,facel,crf,krf,krf2;
88     real             *charge;
89     int              nvdwtype;
90     __m128d          rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
91     int              *vdwtype;
92     real             *vdwparam;
93     __m128d          one_sixth   = _mm_set1_pd(1.0/6.0);
94     __m128d          one_twelfth = _mm_set1_pd(1.0/12.0);
95     __m128d          dummy_mask,cutoff_mask;
96     __m128d          signbit   = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
97     __m128d          one     = _mm_set1_pd(1.0);
98     __m128d          two     = _mm_set1_pd(2.0);
99     x                = xx[0];
100     f                = ff[0];
101
102     nri              = nlist->nri;
103     iinr             = nlist->iinr;
104     jindex           = nlist->jindex;
105     jjnr             = nlist->jjnr;
106     shiftidx         = nlist->shift;
107     gid              = nlist->gid;
108     shiftvec         = fr->shift_vec[0];
109     fshift           = fr->fshift[0];
110     facel            = _mm_set1_pd(fr->epsfac);
111     charge           = mdatoms->chargeA;
112     nvdwtype         = fr->ntype;
113     vdwparam         = fr->nbfp;
114     vdwtype          = mdatoms->typeA;
115
116     /* Avoid stupid compiler warnings */
117     jnrA = jnrB = 0;
118     j_coord_offsetA = 0;
119     j_coord_offsetB = 0;
120
121     outeriter        = 0;
122     inneriter        = 0;
123
124     /* Start outer loop over neighborlists */
125     for(iidx=0; iidx<nri; iidx++)
126     {
127         /* Load shift vector for this list */
128         i_shift_offset   = DIM*shiftidx[iidx];
129
130         /* Load limits for loop over neighbors */
131         j_index_start    = jindex[iidx];
132         j_index_end      = jindex[iidx+1];
133
134         /* Get outer coordinate index */
135         inr              = iinr[iidx];
136         i_coord_offset   = DIM*inr;
137
138         /* Load i particle coords and add shift vector */
139         gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
140
141         fix0             = _mm_setzero_pd();
142         fiy0             = _mm_setzero_pd();
143         fiz0             = _mm_setzero_pd();
144
145         /* Load parameters for i particles */
146         iq0              = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
147         vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
148
149         /* Reset potential sums */
150         velecsum         = _mm_setzero_pd();
151         vvdwsum          = _mm_setzero_pd();
152
153         /* Start inner kernel loop */
154         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
155         {
156
157             /* Get j neighbor index, and coordinate index */
158             jnrA             = jjnr[jidx];
159             jnrB             = jjnr[jidx+1];
160             j_coord_offsetA  = DIM*jnrA;
161             j_coord_offsetB  = DIM*jnrB;
162
163             /* load j atom coordinates */
164             gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
165                                               &jx0,&jy0,&jz0);
166
167             /* Calculate displacement vector */
168             dx00             = _mm_sub_pd(ix0,jx0);
169             dy00             = _mm_sub_pd(iy0,jy0);
170             dz00             = _mm_sub_pd(iz0,jz0);
171
172             /* Calculate squared distance and things based on it */
173             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
174
175             rinv00           = gmx_mm_invsqrt_pd(rsq00);
176
177             rinvsq00         = _mm_mul_pd(rinv00,rinv00);
178
179             /* Load parameters for j particles */
180             jq0              = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
181             vdwjidx0A        = 2*vdwtype[jnrA+0];
182             vdwjidx0B        = 2*vdwtype[jnrB+0];
183
184             /**************************
185              * CALCULATE INTERACTIONS *
186              **************************/
187
188             /* Compute parameters for interactions between i and j atoms */
189             qq00             = _mm_mul_pd(iq0,jq0);
190             gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
191                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
192
193             /* COULOMB ELECTROSTATICS */
194             velec            = _mm_mul_pd(qq00,rinv00);
195             felec            = _mm_mul_pd(velec,rinvsq00);
196
197             /* LENNARD-JONES DISPERSION/REPULSION */
198
199             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
200             vvdw6            = _mm_mul_pd(c6_00,rinvsix);
201             vvdw12           = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
202             vvdw             = _mm_sub_pd( _mm_mul_pd(vvdw12,one_twelfth) , _mm_mul_pd(vvdw6,one_sixth) );
203             fvdw             = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
204
205             /* Update potential sum for this i atom from the interaction with this j atom. */
206             velecsum         = _mm_add_pd(velecsum,velec);
207             vvdwsum          = _mm_add_pd(vvdwsum,vvdw);
208
209             fscal            = _mm_add_pd(felec,fvdw);
210
211             /* Calculate temporary vectorial force */
212             tx               = _mm_mul_pd(fscal,dx00);
213             ty               = _mm_mul_pd(fscal,dy00);
214             tz               = _mm_mul_pd(fscal,dz00);
215
216             /* Update vectorial force */
217             fix0             = _mm_add_pd(fix0,tx);
218             fiy0             = _mm_add_pd(fiy0,ty);
219             fiz0             = _mm_add_pd(fiz0,tz);
220
221             gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
222
223             /* Inner loop uses 40 flops */
224         }
225
226         if(jidx<j_index_end)
227         {
228
229             jnrA             = jjnr[jidx];
230             j_coord_offsetA  = DIM*jnrA;
231
232             /* load j atom coordinates */
233             gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
234                                               &jx0,&jy0,&jz0);
235
236             /* Calculate displacement vector */
237             dx00             = _mm_sub_pd(ix0,jx0);
238             dy00             = _mm_sub_pd(iy0,jy0);
239             dz00             = _mm_sub_pd(iz0,jz0);
240
241             /* Calculate squared distance and things based on it */
242             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
243
244             rinv00           = gmx_mm_invsqrt_pd(rsq00);
245
246             rinvsq00         = _mm_mul_pd(rinv00,rinv00);
247
248             /* Load parameters for j particles */
249             jq0              = _mm_load_sd(charge+jnrA+0);
250             vdwjidx0A        = 2*vdwtype[jnrA+0];
251
252             /**************************
253              * CALCULATE INTERACTIONS *
254              **************************/
255
256             /* Compute parameters for interactions between i and j atoms */
257             qq00             = _mm_mul_pd(iq0,jq0);
258             gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
259
260             /* COULOMB ELECTROSTATICS */
261             velec            = _mm_mul_pd(qq00,rinv00);
262             felec            = _mm_mul_pd(velec,rinvsq00);
263
264             /* LENNARD-JONES DISPERSION/REPULSION */
265
266             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
267             vvdw6            = _mm_mul_pd(c6_00,rinvsix);
268             vvdw12           = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
269             vvdw             = _mm_sub_pd( _mm_mul_pd(vvdw12,one_twelfth) , _mm_mul_pd(vvdw6,one_sixth) );
270             fvdw             = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
271
272             /* Update potential sum for this i atom from the interaction with this j atom. */
273             velec            = _mm_unpacklo_pd(velec,_mm_setzero_pd());
274             velecsum         = _mm_add_pd(velecsum,velec);
275             vvdw             = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
276             vvdwsum          = _mm_add_pd(vvdwsum,vvdw);
277
278             fscal            = _mm_add_pd(felec,fvdw);
279
280             fscal            = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
281
282             /* Calculate temporary vectorial force */
283             tx               = _mm_mul_pd(fscal,dx00);
284             ty               = _mm_mul_pd(fscal,dy00);
285             tz               = _mm_mul_pd(fscal,dz00);
286
287             /* Update vectorial force */
288             fix0             = _mm_add_pd(fix0,tx);
289             fiy0             = _mm_add_pd(fiy0,ty);
290             fiz0             = _mm_add_pd(fiz0,tz);
291
292             gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
293
294             /* Inner loop uses 40 flops */
295         }
296
297         /* End of innermost loop */
298
299         gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
300                                               f+i_coord_offset,fshift+i_shift_offset);
301
302         ggid                        = gid[iidx];
303         /* Update potential energies */
304         gmx_mm_update_1pot_pd(velecsum,kernel_data->energygrp_elec+ggid);
305         gmx_mm_update_1pot_pd(vvdwsum,kernel_data->energygrp_vdw+ggid);
306
307         /* Increment number of inner iterations */
308         inneriter                  += j_index_end - j_index_start;
309
310         /* Outer loop uses 9 flops */
311     }
312
313     /* Increment number of outer iterations */
314     outeriter        += nri;
315
316     /* Update outer/inner flops */
317
318     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*40);
319 }
320 /*
321  * Gromacs nonbonded kernel:   nb_kernel_ElecCoul_VdwLJ_GeomP1P1_F_sse4_1_double
322  * Electrostatics interaction: Coulomb
323  * VdW interaction:            LennardJones
324  * Geometry:                   Particle-Particle
325  * Calculate force/pot:        Force
326  */
327 void
328 nb_kernel_ElecCoul_VdwLJ_GeomP1P1_F_sse4_1_double
329                     (t_nblist                    * gmx_restrict       nlist,
330                      rvec                        * gmx_restrict          xx,
331                      rvec                        * gmx_restrict          ff,
332                      t_forcerec                  * gmx_restrict          fr,
333                      t_mdatoms                   * gmx_restrict     mdatoms,
334                      nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
335                      t_nrnb                      * gmx_restrict        nrnb)
336 {
337     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
338      * just 0 for non-waters.
339      * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
340      * jnr indices corresponding to data put in the four positions in the SIMD register.
341      */
342     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
343     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
344     int              jnrA,jnrB;
345     int              j_coord_offsetA,j_coord_offsetB;
346     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
347     real             rcutoff_scalar;
348     real             *shiftvec,*fshift,*x,*f;
349     __m128d          tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
350     int              vdwioffset0;
351     __m128d          ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
352     int              vdwjidx0A,vdwjidx0B;
353     __m128d          jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
354     __m128d          dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
355     __m128d          velec,felec,velecsum,facel,crf,krf,krf2;
356     real             *charge;
357     int              nvdwtype;
358     __m128d          rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
359     int              *vdwtype;
360     real             *vdwparam;
361     __m128d          one_sixth   = _mm_set1_pd(1.0/6.0);
362     __m128d          one_twelfth = _mm_set1_pd(1.0/12.0);
363     __m128d          dummy_mask,cutoff_mask;
364     __m128d          signbit   = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
365     __m128d          one     = _mm_set1_pd(1.0);
366     __m128d          two     = _mm_set1_pd(2.0);
367     x                = xx[0];
368     f                = ff[0];
369
370     nri              = nlist->nri;
371     iinr             = nlist->iinr;
372     jindex           = nlist->jindex;
373     jjnr             = nlist->jjnr;
374     shiftidx         = nlist->shift;
375     gid              = nlist->gid;
376     shiftvec         = fr->shift_vec[0];
377     fshift           = fr->fshift[0];
378     facel            = _mm_set1_pd(fr->epsfac);
379     charge           = mdatoms->chargeA;
380     nvdwtype         = fr->ntype;
381     vdwparam         = fr->nbfp;
382     vdwtype          = mdatoms->typeA;
383
384     /* Avoid stupid compiler warnings */
385     jnrA = jnrB = 0;
386     j_coord_offsetA = 0;
387     j_coord_offsetB = 0;
388
389     outeriter        = 0;
390     inneriter        = 0;
391
392     /* Start outer loop over neighborlists */
393     for(iidx=0; iidx<nri; iidx++)
394     {
395         /* Load shift vector for this list */
396         i_shift_offset   = DIM*shiftidx[iidx];
397
398         /* Load limits for loop over neighbors */
399         j_index_start    = jindex[iidx];
400         j_index_end      = jindex[iidx+1];
401
402         /* Get outer coordinate index */
403         inr              = iinr[iidx];
404         i_coord_offset   = DIM*inr;
405
406         /* Load i particle coords and add shift vector */
407         gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
408
409         fix0             = _mm_setzero_pd();
410         fiy0             = _mm_setzero_pd();
411         fiz0             = _mm_setzero_pd();
412
413         /* Load parameters for i particles */
414         iq0              = _mm_mul_pd(facel,_mm_load1_pd(charge+inr+0));
415         vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
416
417         /* Start inner kernel loop */
418         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
419         {
420
421             /* Get j neighbor index, and coordinate index */
422             jnrA             = jjnr[jidx];
423             jnrB             = jjnr[jidx+1];
424             j_coord_offsetA  = DIM*jnrA;
425             j_coord_offsetB  = DIM*jnrB;
426
427             /* load j atom coordinates */
428             gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
429                                               &jx0,&jy0,&jz0);
430
431             /* Calculate displacement vector */
432             dx00             = _mm_sub_pd(ix0,jx0);
433             dy00             = _mm_sub_pd(iy0,jy0);
434             dz00             = _mm_sub_pd(iz0,jz0);
435
436             /* Calculate squared distance and things based on it */
437             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
438
439             rinv00           = gmx_mm_invsqrt_pd(rsq00);
440
441             rinvsq00         = _mm_mul_pd(rinv00,rinv00);
442
443             /* Load parameters for j particles */
444             jq0              = gmx_mm_load_2real_swizzle_pd(charge+jnrA+0,charge+jnrB+0);
445             vdwjidx0A        = 2*vdwtype[jnrA+0];
446             vdwjidx0B        = 2*vdwtype[jnrB+0];
447
448             /**************************
449              * CALCULATE INTERACTIONS *
450              **************************/
451
452             /* Compute parameters for interactions between i and j atoms */
453             qq00             = _mm_mul_pd(iq0,jq0);
454             gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
455                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
456
457             /* COULOMB ELECTROSTATICS */
458             velec            = _mm_mul_pd(qq00,rinv00);
459             felec            = _mm_mul_pd(velec,rinvsq00);
460
461             /* LENNARD-JONES DISPERSION/REPULSION */
462
463             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
464             fvdw             = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
465
466             fscal            = _mm_add_pd(felec,fvdw);
467
468             /* Calculate temporary vectorial force */
469             tx               = _mm_mul_pd(fscal,dx00);
470             ty               = _mm_mul_pd(fscal,dy00);
471             tz               = _mm_mul_pd(fscal,dz00);
472
473             /* Update vectorial force */
474             fix0             = _mm_add_pd(fix0,tx);
475             fiy0             = _mm_add_pd(fiy0,ty);
476             fiz0             = _mm_add_pd(fiz0,tz);
477
478             gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
479
480             /* Inner loop uses 34 flops */
481         }
482
483         if(jidx<j_index_end)
484         {
485
486             jnrA             = jjnr[jidx];
487             j_coord_offsetA  = DIM*jnrA;
488
489             /* load j atom coordinates */
490             gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
491                                               &jx0,&jy0,&jz0);
492
493             /* Calculate displacement vector */
494             dx00             = _mm_sub_pd(ix0,jx0);
495             dy00             = _mm_sub_pd(iy0,jy0);
496             dz00             = _mm_sub_pd(iz0,jz0);
497
498             /* Calculate squared distance and things based on it */
499             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
500
501             rinv00           = gmx_mm_invsqrt_pd(rsq00);
502
503             rinvsq00         = _mm_mul_pd(rinv00,rinv00);
504
505             /* Load parameters for j particles */
506             jq0              = _mm_load_sd(charge+jnrA+0);
507             vdwjidx0A        = 2*vdwtype[jnrA+0];
508
509             /**************************
510              * CALCULATE INTERACTIONS *
511              **************************/
512
513             /* Compute parameters for interactions between i and j atoms */
514             qq00             = _mm_mul_pd(iq0,jq0);
515             gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
516
517             /* COULOMB ELECTROSTATICS */
518             velec            = _mm_mul_pd(qq00,rinv00);
519             felec            = _mm_mul_pd(velec,rinvsq00);
520
521             /* LENNARD-JONES DISPERSION/REPULSION */
522
523             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
524             fvdw             = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
525
526             fscal            = _mm_add_pd(felec,fvdw);
527
528             fscal            = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
529
530             /* Calculate temporary vectorial force */
531             tx               = _mm_mul_pd(fscal,dx00);
532             ty               = _mm_mul_pd(fscal,dy00);
533             tz               = _mm_mul_pd(fscal,dz00);
534
535             /* Update vectorial force */
536             fix0             = _mm_add_pd(fix0,tx);
537             fiy0             = _mm_add_pd(fiy0,ty);
538             fiz0             = _mm_add_pd(fiz0,tz);
539
540             gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
541
542             /* Inner loop uses 34 flops */
543         }
544
545         /* End of innermost loop */
546
547         gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
548                                               f+i_coord_offset,fshift+i_shift_offset);
549
550         /* Increment number of inner iterations */
551         inneriter                  += j_index_end - j_index_start;
552
553         /* Outer loop uses 7 flops */
554     }
555
556     /* Increment number of outer iterations */
557     outeriter        += nri;
558
559     /* Update outer/inner flops */
560
561     inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*34);
562 }