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