Compile nonbonded kernels as C++
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sse4_1_double / nb_kernel_ElecNone_VdwLJSh_GeomP1P1_sse4_1_double.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2012,2013,2014,2015,2017,2018, 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/gmxlib/nrnb.h"
46
47 #include "kernelutil_x86_sse4_1_double.h"
48
49 /*
50  * Gromacs nonbonded kernel:   nb_kernel_ElecNone_VdwLJSh_GeomP1P1_VF_sse4_1_double
51  * Electrostatics interaction: None
52  * VdW interaction:            LennardJones
53  * Geometry:                   Particle-Particle
54  * Calculate force/pot:        PotentialAndForce
55  */
56 void
57 nb_kernel_ElecNone_VdwLJSh_GeomP1P1_VF_sse4_1_double
58                     (t_nblist                    * gmx_restrict       nlist,
59                      rvec                        * gmx_restrict          xx,
60                      rvec                        * gmx_restrict          ff,
61                      struct 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)
65 {
66     /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67      * just 0 for non-waters.
68      * Suffixes A,B refer to j loop unrolling done with SSE double precision, e.g. for the two different
69      * jnr indices corresponding to data put in the four positions in the SIMD register.
70      */
71     int              i_shift_offset,i_coord_offset,outeriter,inneriter;
72     int              j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
73     int              jnrA,jnrB;
74     int              j_coord_offsetA,j_coord_offsetB;
75     int              *iinr,*jindex,*jjnr,*shiftidx,*gid;
76     real             rcutoff_scalar;
77     real             *shiftvec,*fshift,*x,*f;
78     __m128d          tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
79     int              vdwioffset0;
80     __m128d          ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
81     int              vdwjidx0A,vdwjidx0B;
82     __m128d          jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83     __m128d          dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
84     int              nvdwtype;
85     __m128d          rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
86     int              *vdwtype;
87     real             *vdwparam;
88     __m128d          one_sixth   = _mm_set1_pd(1.0/6.0);
89     __m128d          one_twelfth = _mm_set1_pd(1.0/12.0);
90     __m128d          dummy_mask,cutoff_mask;
91     __m128d          signbit   = gmx_mm_castsi128_pd( _mm_set_epi32(0x80000000,0x00000000,0x80000000,0x00000000) );
92     __m128d          one     = _mm_set1_pd(1.0);
93     __m128d          two     = _mm_set1_pd(2.0);
94     x                = xx[0];
95     f                = ff[0];
96
97     nri              = nlist->nri;
98     iinr             = nlist->iinr;
99     jindex           = nlist->jindex;
100     jjnr             = nlist->jjnr;
101     shiftidx         = nlist->shift;
102     gid              = nlist->gid;
103     shiftvec         = fr->shift_vec[0];
104     fshift           = fr->fshift[0];
105     nvdwtype         = fr->ntype;
106     vdwparam         = fr->nbfp;
107     vdwtype          = mdatoms->typeA;
108
109     rcutoff_scalar   = fr->ic->rvdw;
110     rcutoff          = _mm_set1_pd(rcutoff_scalar);
111     rcutoff2         = _mm_mul_pd(rcutoff,rcutoff);
112
113     sh_vdw_invrcut6  = _mm_set1_pd(fr->ic->sh_invrc6);
114     rvdw             = _mm_set1_pd(fr->ic->rvdw);
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         vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
147
148         /* Reset potential sums */
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             rinvsq00         = sse41_inv_d(rsq00);
174
175             /* Load parameters for j particles */
176             vdwjidx0A        = 2*vdwtype[jnrA+0];
177             vdwjidx0B        = 2*vdwtype[jnrB+0];
178
179             /**************************
180              * CALCULATE INTERACTIONS *
181              **************************/
182
183             if (gmx_mm_any_lt(rsq00,rcutoff2))
184             {
185
186             /* Compute parameters for interactions between i and j atoms */
187             gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
188                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
189
190             /* LENNARD-JONES DISPERSION/REPULSION */
191
192             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
193             vvdw6            = _mm_mul_pd(c6_00,rinvsix);
194             vvdw12           = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
195             vvdw             = _mm_sub_pd(_mm_mul_pd( _mm_sub_pd(vvdw12 , _mm_mul_pd(c12_00,_mm_mul_pd(sh_vdw_invrcut6,sh_vdw_invrcut6))), one_twelfth) ,
196                                           _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
197             fvdw             = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
198
199             cutoff_mask      = _mm_cmplt_pd(rsq00,rcutoff2);
200
201             /* Update potential sum for this i atom from the interaction with this j atom. */
202             vvdw             = _mm_and_pd(vvdw,cutoff_mask);
203             vvdwsum          = _mm_add_pd(vvdwsum,vvdw);
204
205             fscal            = fvdw;
206
207             fscal            = _mm_and_pd(fscal,cutoff_mask);
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             }
222
223             /* Inner loop uses 41 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             rinvsq00         = sse41_inv_d(rsq00);
245
246             /* Load parameters for j particles */
247             vdwjidx0A        = 2*vdwtype[jnrA+0];
248
249             /**************************
250              * CALCULATE INTERACTIONS *
251              **************************/
252
253             if (gmx_mm_any_lt(rsq00,rcutoff2))
254             {
255
256             /* Compute parameters for interactions between i and j atoms */
257             gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
258
259             /* LENNARD-JONES DISPERSION/REPULSION */
260
261             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
262             vvdw6            = _mm_mul_pd(c6_00,rinvsix);
263             vvdw12           = _mm_mul_pd(c12_00,_mm_mul_pd(rinvsix,rinvsix));
264             vvdw             = _mm_sub_pd(_mm_mul_pd( _mm_sub_pd(vvdw12 , _mm_mul_pd(c12_00,_mm_mul_pd(sh_vdw_invrcut6,sh_vdw_invrcut6))), one_twelfth) ,
265                                           _mm_mul_pd( _mm_sub_pd(vvdw6,_mm_mul_pd(c6_00,sh_vdw_invrcut6)),one_sixth));
266             fvdw             = _mm_mul_pd(_mm_sub_pd(vvdw12,vvdw6),rinvsq00);
267
268             cutoff_mask      = _mm_cmplt_pd(rsq00,rcutoff2);
269
270             /* Update potential sum for this i atom from the interaction with this j atom. */
271             vvdw             = _mm_and_pd(vvdw,cutoff_mask);
272             vvdw             = _mm_unpacklo_pd(vvdw,_mm_setzero_pd());
273             vvdwsum          = _mm_add_pd(vvdwsum,vvdw);
274
275             fscal            = fvdw;
276
277             fscal            = _mm_and_pd(fscal,cutoff_mask);
278
279             fscal            = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
280
281             /* Calculate temporary vectorial force */
282             tx               = _mm_mul_pd(fscal,dx00);
283             ty               = _mm_mul_pd(fscal,dy00);
284             tz               = _mm_mul_pd(fscal,dz00);
285
286             /* Update vectorial force */
287             fix0             = _mm_add_pd(fix0,tx);
288             fiy0             = _mm_add_pd(fiy0,ty);
289             fiz0             = _mm_add_pd(fiz0,tz);
290
291             gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
292
293             }
294
295             /* Inner loop uses 41 flops */
296         }
297
298         /* End of innermost loop */
299
300         gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
301                                               f+i_coord_offset,fshift+i_shift_offset);
302
303         ggid                        = gid[iidx];
304         /* Update potential energies */
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 7 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_VDW_VF,outeriter*7 + inneriter*41);
319 }
320 /*
321  * Gromacs nonbonded kernel:   nb_kernel_ElecNone_VdwLJSh_GeomP1P1_F_sse4_1_double
322  * Electrostatics interaction: None
323  * VdW interaction:            LennardJones
324  * Geometry:                   Particle-Particle
325  * Calculate force/pot:        Force
326  */
327 void
328 nb_kernel_ElecNone_VdwLJSh_GeomP1P1_F_sse4_1_double
329                     (t_nblist                    * gmx_restrict       nlist,
330                      rvec                        * gmx_restrict          xx,
331                      rvec                        * gmx_restrict          ff,
332                      struct 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     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     nvdwtype         = fr->ntype;
377     vdwparam         = fr->nbfp;
378     vdwtype          = mdatoms->typeA;
379
380     rcutoff_scalar   = fr->ic->rvdw;
381     rcutoff          = _mm_set1_pd(rcutoff_scalar);
382     rcutoff2         = _mm_mul_pd(rcutoff,rcutoff);
383
384     sh_vdw_invrcut6  = _mm_set1_pd(fr->ic->sh_invrc6);
385     rvdw             = _mm_set1_pd(fr->ic->rvdw);
386
387     /* Avoid stupid compiler warnings */
388     jnrA = jnrB = 0;
389     j_coord_offsetA = 0;
390     j_coord_offsetB = 0;
391
392     outeriter        = 0;
393     inneriter        = 0;
394
395     /* Start outer loop over neighborlists */
396     for(iidx=0; iidx<nri; iidx++)
397     {
398         /* Load shift vector for this list */
399         i_shift_offset   = DIM*shiftidx[iidx];
400
401         /* Load limits for loop over neighbors */
402         j_index_start    = jindex[iidx];
403         j_index_end      = jindex[iidx+1];
404
405         /* Get outer coordinate index */
406         inr              = iinr[iidx];
407         i_coord_offset   = DIM*inr;
408
409         /* Load i particle coords and add shift vector */
410         gmx_mm_load_shift_and_1rvec_broadcast_pd(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
411
412         fix0             = _mm_setzero_pd();
413         fiy0             = _mm_setzero_pd();
414         fiz0             = _mm_setzero_pd();
415
416         /* Load parameters for i particles */
417         vdwioffset0      = 2*nvdwtype*vdwtype[inr+0];
418
419         /* Start inner kernel loop */
420         for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
421         {
422
423             /* Get j neighbor index, and coordinate index */
424             jnrA             = jjnr[jidx];
425             jnrB             = jjnr[jidx+1];
426             j_coord_offsetA  = DIM*jnrA;
427             j_coord_offsetB  = DIM*jnrB;
428
429             /* load j atom coordinates */
430             gmx_mm_load_1rvec_2ptr_swizzle_pd(x+j_coord_offsetA,x+j_coord_offsetB,
431                                               &jx0,&jy0,&jz0);
432
433             /* Calculate displacement vector */
434             dx00             = _mm_sub_pd(ix0,jx0);
435             dy00             = _mm_sub_pd(iy0,jy0);
436             dz00             = _mm_sub_pd(iz0,jz0);
437
438             /* Calculate squared distance and things based on it */
439             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
440
441             rinvsq00         = sse41_inv_d(rsq00);
442
443             /* Load parameters for j particles */
444             vdwjidx0A        = 2*vdwtype[jnrA+0];
445             vdwjidx0B        = 2*vdwtype[jnrB+0];
446
447             /**************************
448              * CALCULATE INTERACTIONS *
449              **************************/
450
451             if (gmx_mm_any_lt(rsq00,rcutoff2))
452             {
453
454             /* Compute parameters for interactions between i and j atoms */
455             gmx_mm_load_2pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,
456                                          vdwparam+vdwioffset0+vdwjidx0B,&c6_00,&c12_00);
457
458             /* LENNARD-JONES DISPERSION/REPULSION */
459
460             rinvsix          = _mm_mul_pd(_mm_mul_pd(rinvsq00,rinvsq00),rinvsq00);
461             fvdw             = _mm_mul_pd(_mm_sub_pd(_mm_mul_pd(c12_00,rinvsix),c6_00),_mm_mul_pd(rinvsix,rinvsq00));
462
463             cutoff_mask      = _mm_cmplt_pd(rsq00,rcutoff2);
464
465             fscal            = fvdw;
466
467             fscal            = _mm_and_pd(fscal,cutoff_mask);
468
469             /* Calculate temporary vectorial force */
470             tx               = _mm_mul_pd(fscal,dx00);
471             ty               = _mm_mul_pd(fscal,dy00);
472             tz               = _mm_mul_pd(fscal,dz00);
473
474             /* Update vectorial force */
475             fix0             = _mm_add_pd(fix0,tx);
476             fiy0             = _mm_add_pd(fiy0,ty);
477             fiz0             = _mm_add_pd(fiz0,tz);
478
479             gmx_mm_decrement_1rvec_2ptr_swizzle_pd(f+j_coord_offsetA,f+j_coord_offsetB,tx,ty,tz);
480
481             }
482
483             /* Inner loop uses 30 flops */
484         }
485
486         if(jidx<j_index_end)
487         {
488
489             jnrA             = jjnr[jidx];
490             j_coord_offsetA  = DIM*jnrA;
491
492             /* load j atom coordinates */
493             gmx_mm_load_1rvec_1ptr_swizzle_pd(x+j_coord_offsetA,
494                                               &jx0,&jy0,&jz0);
495
496             /* Calculate displacement vector */
497             dx00             = _mm_sub_pd(ix0,jx0);
498             dy00             = _mm_sub_pd(iy0,jy0);
499             dz00             = _mm_sub_pd(iz0,jz0);
500
501             /* Calculate squared distance and things based on it */
502             rsq00            = gmx_mm_calc_rsq_pd(dx00,dy00,dz00);
503
504             rinvsq00         = sse41_inv_d(rsq00);
505
506             /* Load parameters for j particles */
507             vdwjidx0A        = 2*vdwtype[jnrA+0];
508
509             /**************************
510              * CALCULATE INTERACTIONS *
511              **************************/
512
513             if (gmx_mm_any_lt(rsq00,rcutoff2))
514             {
515
516             /* Compute parameters for interactions between i and j atoms */
517             gmx_mm_load_1pair_swizzle_pd(vdwparam+vdwioffset0+vdwjidx0A,&c6_00,&c12_00);
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             cutoff_mask      = _mm_cmplt_pd(rsq00,rcutoff2);
525
526             fscal            = fvdw;
527
528             fscal            = _mm_and_pd(fscal,cutoff_mask);
529
530             fscal            = _mm_unpacklo_pd(fscal,_mm_setzero_pd());
531
532             /* Calculate temporary vectorial force */
533             tx               = _mm_mul_pd(fscal,dx00);
534             ty               = _mm_mul_pd(fscal,dy00);
535             tz               = _mm_mul_pd(fscal,dz00);
536
537             /* Update vectorial force */
538             fix0             = _mm_add_pd(fix0,tx);
539             fiy0             = _mm_add_pd(fiy0,ty);
540             fiz0             = _mm_add_pd(fiz0,tz);
541
542             gmx_mm_decrement_1rvec_1ptr_swizzle_pd(f+j_coord_offsetA,tx,ty,tz);
543
544             }
545
546             /* Inner loop uses 30 flops */
547         }
548
549         /* End of innermost loop */
550
551         gmx_mm_update_iforce_1atom_swizzle_pd(fix0,fiy0,fiz0,
552                                               f+i_coord_offset,fshift+i_shift_offset);
553
554         /* Increment number of inner iterations */
555         inneriter                  += j_index_end - j_index_start;
556
557         /* Outer loop uses 6 flops */
558     }
559
560     /* Increment number of outer iterations */
561     outeriter        += nri;
562
563     /* Update outer/inner flops */
564
565     inc_nrnb(nrnb,eNR_NBKERNEL_VDW_F,outeriter*6 + inneriter*30);
566 }