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