Removed simple.h from nb_kernel_sse2_XX
[gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_sse2_single / nb_kernel_ElecRF_VdwNone_GeomP1P1_sse2_single.c
blobe048e7fcba040a183c9ef006b4fecca06f432eb0
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015, 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.
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.
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.
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.
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.
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.
36 * Note: this file was generated by the GROMACS sse2_single kernel generator.
38 #include "gmxpre.h"
40 #include "config.h"
42 #include <math.h>
44 #include "../nb_kernel.h"
45 #include "gromacs/math/vec.h"
46 #include "gromacs/legacyheaders/nrnb.h"
48 #include "gromacs/simd/math_x86_sse2_single.h"
49 #include "kernelutil_x86_sse2_single.h"
52 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomP1P1_VF_sse2_single
53 * Electrostatics interaction: ReactionField
54 * VdW interaction: None
55 * Geometry: Particle-Particle
56 * Calculate force/pot: PotentialAndForce
58 void
59 nb_kernel_ElecRF_VdwNone_GeomP1P1_VF_sse2_single
60 (t_nblist * gmx_restrict nlist,
61 rvec * gmx_restrict xx,
62 rvec * gmx_restrict ff,
63 t_forcerec * gmx_restrict fr,
64 t_mdatoms * gmx_restrict mdatoms,
65 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
66 t_nrnb * gmx_restrict nrnb)
68 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
69 * just 0 for non-waters.
70 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
71 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 int i_shift_offset,i_coord_offset,outeriter,inneriter;
74 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
75 int jnrA,jnrB,jnrC,jnrD;
76 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
77 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
78 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
79 real rcutoff_scalar;
80 real *shiftvec,*fshift,*x,*f;
81 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
82 real scratch[4*DIM];
83 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
84 int vdwioffset0;
85 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
86 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
87 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
88 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
89 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
90 real *charge;
91 __m128 dummy_mask,cutoff_mask;
92 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
93 __m128 one = _mm_set1_ps(1.0);
94 __m128 two = _mm_set1_ps(2.0);
95 x = xx[0];
96 f = ff[0];
98 nri = nlist->nri;
99 iinr = nlist->iinr;
100 jindex = nlist->jindex;
101 jjnr = nlist->jjnr;
102 shiftidx = nlist->shift;
103 gid = nlist->gid;
104 shiftvec = fr->shift_vec[0];
105 fshift = fr->fshift[0];
106 facel = _mm_set1_ps(fr->epsfac);
107 charge = mdatoms->chargeA;
108 krf = _mm_set1_ps(fr->ic->k_rf);
109 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
110 crf = _mm_set1_ps(fr->ic->c_rf);
112 /* Avoid stupid compiler warnings */
113 jnrA = jnrB = jnrC = jnrD = 0;
114 j_coord_offsetA = 0;
115 j_coord_offsetB = 0;
116 j_coord_offsetC = 0;
117 j_coord_offsetD = 0;
119 outeriter = 0;
120 inneriter = 0;
122 for(iidx=0;iidx<4*DIM;iidx++)
124 scratch[iidx] = 0.0;
127 /* Start outer loop over neighborlists */
128 for(iidx=0; iidx<nri; iidx++)
130 /* Load shift vector for this list */
131 i_shift_offset = DIM*shiftidx[iidx];
133 /* Load limits for loop over neighbors */
134 j_index_start = jindex[iidx];
135 j_index_end = jindex[iidx+1];
137 /* Get outer coordinate index */
138 inr = iinr[iidx];
139 i_coord_offset = DIM*inr;
141 /* Load i particle coords and add shift vector */
142 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
144 fix0 = _mm_setzero_ps();
145 fiy0 = _mm_setzero_ps();
146 fiz0 = _mm_setzero_ps();
148 /* Load parameters for i particles */
149 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
151 /* Reset potential sums */
152 velecsum = _mm_setzero_ps();
154 /* Start inner kernel loop */
155 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
158 /* Get j neighbor index, and coordinate index */
159 jnrA = jjnr[jidx];
160 jnrB = jjnr[jidx+1];
161 jnrC = jjnr[jidx+2];
162 jnrD = jjnr[jidx+3];
163 j_coord_offsetA = DIM*jnrA;
164 j_coord_offsetB = DIM*jnrB;
165 j_coord_offsetC = DIM*jnrC;
166 j_coord_offsetD = DIM*jnrD;
168 /* load j atom coordinates */
169 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
170 x+j_coord_offsetC,x+j_coord_offsetD,
171 &jx0,&jy0,&jz0);
173 /* Calculate displacement vector */
174 dx00 = _mm_sub_ps(ix0,jx0);
175 dy00 = _mm_sub_ps(iy0,jy0);
176 dz00 = _mm_sub_ps(iz0,jz0);
178 /* Calculate squared distance and things based on it */
179 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
181 rinv00 = gmx_mm_invsqrt_ps(rsq00);
183 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
185 /* Load parameters for j particles */
186 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
187 charge+jnrC+0,charge+jnrD+0);
189 /**************************
190 * CALCULATE INTERACTIONS *
191 **************************/
193 /* Compute parameters for interactions between i and j atoms */
194 qq00 = _mm_mul_ps(iq0,jq0);
196 /* REACTION-FIELD ELECTROSTATICS */
197 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf));
198 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
200 /* Update potential sum for this i atom from the interaction with this j atom. */
201 velecsum = _mm_add_ps(velecsum,velec);
203 fscal = felec;
205 /* Calculate temporary vectorial force */
206 tx = _mm_mul_ps(fscal,dx00);
207 ty = _mm_mul_ps(fscal,dy00);
208 tz = _mm_mul_ps(fscal,dz00);
210 /* Update vectorial force */
211 fix0 = _mm_add_ps(fix0,tx);
212 fiy0 = _mm_add_ps(fiy0,ty);
213 fiz0 = _mm_add_ps(fiz0,tz);
215 fjptrA = f+j_coord_offsetA;
216 fjptrB = f+j_coord_offsetB;
217 fjptrC = f+j_coord_offsetC;
218 fjptrD = f+j_coord_offsetD;
219 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
221 /* Inner loop uses 32 flops */
224 if(jidx<j_index_end)
227 /* Get j neighbor index, and coordinate index */
228 jnrlistA = jjnr[jidx];
229 jnrlistB = jjnr[jidx+1];
230 jnrlistC = jjnr[jidx+2];
231 jnrlistD = jjnr[jidx+3];
232 /* Sign of each element will be negative for non-real atoms.
233 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
234 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
236 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
237 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
238 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
239 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
240 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
241 j_coord_offsetA = DIM*jnrA;
242 j_coord_offsetB = DIM*jnrB;
243 j_coord_offsetC = DIM*jnrC;
244 j_coord_offsetD = DIM*jnrD;
246 /* load j atom coordinates */
247 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
248 x+j_coord_offsetC,x+j_coord_offsetD,
249 &jx0,&jy0,&jz0);
251 /* Calculate displacement vector */
252 dx00 = _mm_sub_ps(ix0,jx0);
253 dy00 = _mm_sub_ps(iy0,jy0);
254 dz00 = _mm_sub_ps(iz0,jz0);
256 /* Calculate squared distance and things based on it */
257 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
259 rinv00 = gmx_mm_invsqrt_ps(rsq00);
261 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
263 /* Load parameters for j particles */
264 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
265 charge+jnrC+0,charge+jnrD+0);
267 /**************************
268 * CALCULATE INTERACTIONS *
269 **************************/
271 /* Compute parameters for interactions between i and j atoms */
272 qq00 = _mm_mul_ps(iq0,jq0);
274 /* REACTION-FIELD ELECTROSTATICS */
275 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf));
276 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
278 /* Update potential sum for this i atom from the interaction with this j atom. */
279 velec = _mm_andnot_ps(dummy_mask,velec);
280 velecsum = _mm_add_ps(velecsum,velec);
282 fscal = felec;
284 fscal = _mm_andnot_ps(dummy_mask,fscal);
286 /* Calculate temporary vectorial force */
287 tx = _mm_mul_ps(fscal,dx00);
288 ty = _mm_mul_ps(fscal,dy00);
289 tz = _mm_mul_ps(fscal,dz00);
291 /* Update vectorial force */
292 fix0 = _mm_add_ps(fix0,tx);
293 fiy0 = _mm_add_ps(fiy0,ty);
294 fiz0 = _mm_add_ps(fiz0,tz);
296 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
297 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
298 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
299 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
300 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
302 /* Inner loop uses 32 flops */
305 /* End of innermost loop */
307 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
308 f+i_coord_offset,fshift+i_shift_offset);
310 ggid = gid[iidx];
311 /* Update potential energies */
312 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
314 /* Increment number of inner iterations */
315 inneriter += j_index_end - j_index_start;
317 /* Outer loop uses 8 flops */
320 /* Increment number of outer iterations */
321 outeriter += nri;
323 /* Update outer/inner flops */
325 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*32);
328 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomP1P1_F_sse2_single
329 * Electrostatics interaction: ReactionField
330 * VdW interaction: None
331 * Geometry: Particle-Particle
332 * Calculate force/pot: Force
334 void
335 nb_kernel_ElecRF_VdwNone_GeomP1P1_F_sse2_single
336 (t_nblist * gmx_restrict nlist,
337 rvec * gmx_restrict xx,
338 rvec * gmx_restrict ff,
339 t_forcerec * gmx_restrict fr,
340 t_mdatoms * gmx_restrict mdatoms,
341 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
342 t_nrnb * gmx_restrict nrnb)
344 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
345 * just 0 for non-waters.
346 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
347 * jnr indices corresponding to data put in the four positions in the SIMD register.
349 int i_shift_offset,i_coord_offset,outeriter,inneriter;
350 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
351 int jnrA,jnrB,jnrC,jnrD;
352 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
353 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
354 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
355 real rcutoff_scalar;
356 real *shiftvec,*fshift,*x,*f;
357 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
358 real scratch[4*DIM];
359 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
360 int vdwioffset0;
361 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
362 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
363 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
364 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
365 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
366 real *charge;
367 __m128 dummy_mask,cutoff_mask;
368 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
369 __m128 one = _mm_set1_ps(1.0);
370 __m128 two = _mm_set1_ps(2.0);
371 x = xx[0];
372 f = ff[0];
374 nri = nlist->nri;
375 iinr = nlist->iinr;
376 jindex = nlist->jindex;
377 jjnr = nlist->jjnr;
378 shiftidx = nlist->shift;
379 gid = nlist->gid;
380 shiftvec = fr->shift_vec[0];
381 fshift = fr->fshift[0];
382 facel = _mm_set1_ps(fr->epsfac);
383 charge = mdatoms->chargeA;
384 krf = _mm_set1_ps(fr->ic->k_rf);
385 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
386 crf = _mm_set1_ps(fr->ic->c_rf);
388 /* Avoid stupid compiler warnings */
389 jnrA = jnrB = jnrC = jnrD = 0;
390 j_coord_offsetA = 0;
391 j_coord_offsetB = 0;
392 j_coord_offsetC = 0;
393 j_coord_offsetD = 0;
395 outeriter = 0;
396 inneriter = 0;
398 for(iidx=0;iidx<4*DIM;iidx++)
400 scratch[iidx] = 0.0;
403 /* Start outer loop over neighborlists */
404 for(iidx=0; iidx<nri; iidx++)
406 /* Load shift vector for this list */
407 i_shift_offset = DIM*shiftidx[iidx];
409 /* Load limits for loop over neighbors */
410 j_index_start = jindex[iidx];
411 j_index_end = jindex[iidx+1];
413 /* Get outer coordinate index */
414 inr = iinr[iidx];
415 i_coord_offset = DIM*inr;
417 /* Load i particle coords and add shift vector */
418 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
420 fix0 = _mm_setzero_ps();
421 fiy0 = _mm_setzero_ps();
422 fiz0 = _mm_setzero_ps();
424 /* Load parameters for i particles */
425 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
427 /* Start inner kernel loop */
428 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
431 /* Get j neighbor index, and coordinate index */
432 jnrA = jjnr[jidx];
433 jnrB = jjnr[jidx+1];
434 jnrC = jjnr[jidx+2];
435 jnrD = jjnr[jidx+3];
436 j_coord_offsetA = DIM*jnrA;
437 j_coord_offsetB = DIM*jnrB;
438 j_coord_offsetC = DIM*jnrC;
439 j_coord_offsetD = DIM*jnrD;
441 /* load j atom coordinates */
442 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
443 x+j_coord_offsetC,x+j_coord_offsetD,
444 &jx0,&jy0,&jz0);
446 /* Calculate displacement vector */
447 dx00 = _mm_sub_ps(ix0,jx0);
448 dy00 = _mm_sub_ps(iy0,jy0);
449 dz00 = _mm_sub_ps(iz0,jz0);
451 /* Calculate squared distance and things based on it */
452 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
454 rinv00 = gmx_mm_invsqrt_ps(rsq00);
456 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
458 /* Load parameters for j particles */
459 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
460 charge+jnrC+0,charge+jnrD+0);
462 /**************************
463 * CALCULATE INTERACTIONS *
464 **************************/
466 /* Compute parameters for interactions between i and j atoms */
467 qq00 = _mm_mul_ps(iq0,jq0);
469 /* REACTION-FIELD ELECTROSTATICS */
470 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
472 fscal = felec;
474 /* Calculate temporary vectorial force */
475 tx = _mm_mul_ps(fscal,dx00);
476 ty = _mm_mul_ps(fscal,dy00);
477 tz = _mm_mul_ps(fscal,dz00);
479 /* Update vectorial force */
480 fix0 = _mm_add_ps(fix0,tx);
481 fiy0 = _mm_add_ps(fiy0,ty);
482 fiz0 = _mm_add_ps(fiz0,tz);
484 fjptrA = f+j_coord_offsetA;
485 fjptrB = f+j_coord_offsetB;
486 fjptrC = f+j_coord_offsetC;
487 fjptrD = f+j_coord_offsetD;
488 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
490 /* Inner loop uses 27 flops */
493 if(jidx<j_index_end)
496 /* Get j neighbor index, and coordinate index */
497 jnrlistA = jjnr[jidx];
498 jnrlistB = jjnr[jidx+1];
499 jnrlistC = jjnr[jidx+2];
500 jnrlistD = jjnr[jidx+3];
501 /* Sign of each element will be negative for non-real atoms.
502 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
503 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
505 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
506 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
507 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
508 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
509 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
510 j_coord_offsetA = DIM*jnrA;
511 j_coord_offsetB = DIM*jnrB;
512 j_coord_offsetC = DIM*jnrC;
513 j_coord_offsetD = DIM*jnrD;
515 /* load j atom coordinates */
516 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
517 x+j_coord_offsetC,x+j_coord_offsetD,
518 &jx0,&jy0,&jz0);
520 /* Calculate displacement vector */
521 dx00 = _mm_sub_ps(ix0,jx0);
522 dy00 = _mm_sub_ps(iy0,jy0);
523 dz00 = _mm_sub_ps(iz0,jz0);
525 /* Calculate squared distance and things based on it */
526 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
528 rinv00 = gmx_mm_invsqrt_ps(rsq00);
530 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
532 /* Load parameters for j particles */
533 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
534 charge+jnrC+0,charge+jnrD+0);
536 /**************************
537 * CALCULATE INTERACTIONS *
538 **************************/
540 /* Compute parameters for interactions between i and j atoms */
541 qq00 = _mm_mul_ps(iq0,jq0);
543 /* REACTION-FIELD ELECTROSTATICS */
544 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
546 fscal = felec;
548 fscal = _mm_andnot_ps(dummy_mask,fscal);
550 /* Calculate temporary vectorial force */
551 tx = _mm_mul_ps(fscal,dx00);
552 ty = _mm_mul_ps(fscal,dy00);
553 tz = _mm_mul_ps(fscal,dz00);
555 /* Update vectorial force */
556 fix0 = _mm_add_ps(fix0,tx);
557 fiy0 = _mm_add_ps(fiy0,ty);
558 fiz0 = _mm_add_ps(fiz0,tz);
560 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
561 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
562 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
563 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
564 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
566 /* Inner loop uses 27 flops */
569 /* End of innermost loop */
571 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
572 f+i_coord_offset,fshift+i_shift_offset);
574 /* Increment number of inner iterations */
575 inneriter += j_index_end - j_index_start;
577 /* Outer loop uses 7 flops */
580 /* Increment number of outer iterations */
581 outeriter += nri;
583 /* Update outer/inner flops */
585 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*27);