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