2 * This file is part of the GROMACS molecular simulation package.
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.
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 sparc64_hpc_ace_double kernel generator.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
47 #include "kernelutil_sparc64_hpc_ace_double.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW4W4_VF_sparc64_hpc_ace_double
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: LennardJones
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwLJ_GeomW4W4_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)
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.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
74 int j_coord_offsetA,j_coord_offsetB;
75 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real *shiftvec,*fshift,*x,*f;
78 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
80 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
82 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
87 int vdwjidx0A,vdwjidx0B;
88 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 int vdwjidx1A,vdwjidx1B;
90 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
91 int vdwjidx2A,vdwjidx2B;
92 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
93 int vdwjidx3A,vdwjidx3B;
94 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
95 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
97 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
98 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
99 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
100 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
101 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
102 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
103 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
104 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
105 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
108 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
111 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
112 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
114 _fjsp_v2r8 dummy_mask,cutoff_mask;
115 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
116 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
117 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
124 jindex = nlist->jindex;
126 shiftidx = nlist->shift;
128 shiftvec = fr->shift_vec[0];
129 fshift = fr->fshift[0];
130 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
131 charge = mdatoms->chargeA;
132 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
133 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
134 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
135 nvdwtype = fr->ntype;
137 vdwtype = mdatoms->typeA;
139 /* Setup water-specific parameters */
140 inr = nlist->iinr[0];
141 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
142 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
143 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
144 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
146 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
147 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
148 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
149 vdwjidx0A = 2*vdwtype[inr+0];
150 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
151 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
152 qq11 = _fjsp_mul_v2r8(iq1,jq1);
153 qq12 = _fjsp_mul_v2r8(iq1,jq2);
154 qq13 = _fjsp_mul_v2r8(iq1,jq3);
155 qq21 = _fjsp_mul_v2r8(iq2,jq1);
156 qq22 = _fjsp_mul_v2r8(iq2,jq2);
157 qq23 = _fjsp_mul_v2r8(iq2,jq3);
158 qq31 = _fjsp_mul_v2r8(iq3,jq1);
159 qq32 = _fjsp_mul_v2r8(iq3,jq2);
160 qq33 = _fjsp_mul_v2r8(iq3,jq3);
162 /* Avoid stupid compiler warnings */
170 /* Start outer loop over neighborlists */
171 for(iidx=0; iidx<nri; iidx++)
173 /* Load shift vector for this list */
174 i_shift_offset = DIM*shiftidx[iidx];
176 /* Load limits for loop over neighbors */
177 j_index_start = jindex[iidx];
178 j_index_end = jindex[iidx+1];
180 /* Get outer coordinate index */
182 i_coord_offset = DIM*inr;
184 /* Load i particle coords and add shift vector */
185 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
186 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
188 fix0 = _fjsp_setzero_v2r8();
189 fiy0 = _fjsp_setzero_v2r8();
190 fiz0 = _fjsp_setzero_v2r8();
191 fix1 = _fjsp_setzero_v2r8();
192 fiy1 = _fjsp_setzero_v2r8();
193 fiz1 = _fjsp_setzero_v2r8();
194 fix2 = _fjsp_setzero_v2r8();
195 fiy2 = _fjsp_setzero_v2r8();
196 fiz2 = _fjsp_setzero_v2r8();
197 fix3 = _fjsp_setzero_v2r8();
198 fiy3 = _fjsp_setzero_v2r8();
199 fiz3 = _fjsp_setzero_v2r8();
201 /* Reset potential sums */
202 velecsum = _fjsp_setzero_v2r8();
203 vvdwsum = _fjsp_setzero_v2r8();
205 /* Start inner kernel loop */
206 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
209 /* Get j neighbor index, and coordinate index */
212 j_coord_offsetA = DIM*jnrA;
213 j_coord_offsetB = DIM*jnrB;
215 /* load j atom coordinates */
216 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
217 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
218 &jy2,&jz2,&jx3,&jy3,&jz3);
220 /* Calculate displacement vector */
221 dx00 = _fjsp_sub_v2r8(ix0,jx0);
222 dy00 = _fjsp_sub_v2r8(iy0,jy0);
223 dz00 = _fjsp_sub_v2r8(iz0,jz0);
224 dx11 = _fjsp_sub_v2r8(ix1,jx1);
225 dy11 = _fjsp_sub_v2r8(iy1,jy1);
226 dz11 = _fjsp_sub_v2r8(iz1,jz1);
227 dx12 = _fjsp_sub_v2r8(ix1,jx2);
228 dy12 = _fjsp_sub_v2r8(iy1,jy2);
229 dz12 = _fjsp_sub_v2r8(iz1,jz2);
230 dx13 = _fjsp_sub_v2r8(ix1,jx3);
231 dy13 = _fjsp_sub_v2r8(iy1,jy3);
232 dz13 = _fjsp_sub_v2r8(iz1,jz3);
233 dx21 = _fjsp_sub_v2r8(ix2,jx1);
234 dy21 = _fjsp_sub_v2r8(iy2,jy1);
235 dz21 = _fjsp_sub_v2r8(iz2,jz1);
236 dx22 = _fjsp_sub_v2r8(ix2,jx2);
237 dy22 = _fjsp_sub_v2r8(iy2,jy2);
238 dz22 = _fjsp_sub_v2r8(iz2,jz2);
239 dx23 = _fjsp_sub_v2r8(ix2,jx3);
240 dy23 = _fjsp_sub_v2r8(iy2,jy3);
241 dz23 = _fjsp_sub_v2r8(iz2,jz3);
242 dx31 = _fjsp_sub_v2r8(ix3,jx1);
243 dy31 = _fjsp_sub_v2r8(iy3,jy1);
244 dz31 = _fjsp_sub_v2r8(iz3,jz1);
245 dx32 = _fjsp_sub_v2r8(ix3,jx2);
246 dy32 = _fjsp_sub_v2r8(iy3,jy2);
247 dz32 = _fjsp_sub_v2r8(iz3,jz2);
248 dx33 = _fjsp_sub_v2r8(ix3,jx3);
249 dy33 = _fjsp_sub_v2r8(iy3,jy3);
250 dz33 = _fjsp_sub_v2r8(iz3,jz3);
252 /* Calculate squared distance and things based on it */
253 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
254 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
255 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
256 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
257 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
258 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
259 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
260 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
261 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
262 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
264 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
265 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
266 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
267 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
268 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
269 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
270 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
271 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
272 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
274 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
275 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
276 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
277 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
278 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
279 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
280 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
281 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
282 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
283 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
285 fjx0 = _fjsp_setzero_v2r8();
286 fjy0 = _fjsp_setzero_v2r8();
287 fjz0 = _fjsp_setzero_v2r8();
288 fjx1 = _fjsp_setzero_v2r8();
289 fjy1 = _fjsp_setzero_v2r8();
290 fjz1 = _fjsp_setzero_v2r8();
291 fjx2 = _fjsp_setzero_v2r8();
292 fjy2 = _fjsp_setzero_v2r8();
293 fjz2 = _fjsp_setzero_v2r8();
294 fjx3 = _fjsp_setzero_v2r8();
295 fjy3 = _fjsp_setzero_v2r8();
296 fjz3 = _fjsp_setzero_v2r8();
298 /**************************
299 * CALCULATE INTERACTIONS *
300 **************************/
302 /* LENNARD-JONES DISPERSION/REPULSION */
304 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
305 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
306 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
307 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
308 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
310 /* Update potential sum for this i atom from the interaction with this j atom. */
311 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
315 /* Update vectorial force */
316 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
317 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
318 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
320 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
321 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
322 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
324 /**************************
325 * CALCULATE INTERACTIONS *
326 **************************/
328 /* REACTION-FIELD ELECTROSTATICS */
329 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq11,rinv11),crf));
330 felec = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
332 /* Update potential sum for this i atom from the interaction with this j atom. */
333 velecsum = _fjsp_add_v2r8(velecsum,velec);
337 /* Update vectorial force */
338 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
339 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
340 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
342 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
343 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
344 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
346 /**************************
347 * CALCULATE INTERACTIONS *
348 **************************/
350 /* REACTION-FIELD ELECTROSTATICS */
351 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq12,rinv12),crf));
352 felec = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
354 /* Update potential sum for this i atom from the interaction with this j atom. */
355 velecsum = _fjsp_add_v2r8(velecsum,velec);
359 /* Update vectorial force */
360 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
361 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
362 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
364 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
365 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
366 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
372 /* REACTION-FIELD ELECTROSTATICS */
373 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq13,rinv13),crf));
374 felec = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
376 /* Update potential sum for this i atom from the interaction with this j atom. */
377 velecsum = _fjsp_add_v2r8(velecsum,velec);
381 /* Update vectorial force */
382 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
383 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
384 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
386 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
387 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
388 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
390 /**************************
391 * CALCULATE INTERACTIONS *
392 **************************/
394 /* REACTION-FIELD ELECTROSTATICS */
395 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq21,rinv21),crf));
396 felec = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
398 /* Update potential sum for this i atom from the interaction with this j atom. */
399 velecsum = _fjsp_add_v2r8(velecsum,velec);
403 /* Update vectorial force */
404 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
405 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
406 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
408 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
409 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
410 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
412 /**************************
413 * CALCULATE INTERACTIONS *
414 **************************/
416 /* REACTION-FIELD ELECTROSTATICS */
417 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq22,rinv22),crf));
418 felec = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
420 /* Update potential sum for this i atom from the interaction with this j atom. */
421 velecsum = _fjsp_add_v2r8(velecsum,velec);
425 /* Update vectorial force */
426 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
427 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
428 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
430 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
431 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
432 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
438 /* REACTION-FIELD ELECTROSTATICS */
439 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq23,rinv23),crf));
440 felec = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
442 /* Update potential sum for this i atom from the interaction with this j atom. */
443 velecsum = _fjsp_add_v2r8(velecsum,velec);
447 /* Update vectorial force */
448 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
449 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
450 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
452 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
453 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
454 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
456 /**************************
457 * CALCULATE INTERACTIONS *
458 **************************/
460 /* REACTION-FIELD ELECTROSTATICS */
461 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq31,rinv31),crf));
462 felec = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
464 /* Update potential sum for this i atom from the interaction with this j atom. */
465 velecsum = _fjsp_add_v2r8(velecsum,velec);
469 /* Update vectorial force */
470 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
471 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
472 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
474 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
475 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
476 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
478 /**************************
479 * CALCULATE INTERACTIONS *
480 **************************/
482 /* REACTION-FIELD ELECTROSTATICS */
483 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq32,rinv32),crf));
484 felec = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
486 /* Update potential sum for this i atom from the interaction with this j atom. */
487 velecsum = _fjsp_add_v2r8(velecsum,velec);
491 /* Update vectorial force */
492 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
493 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
494 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
496 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
497 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
498 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
500 /**************************
501 * CALCULATE INTERACTIONS *
502 **************************/
504 /* REACTION-FIELD ELECTROSTATICS */
505 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq33,rinv33),crf));
506 felec = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
508 /* Update potential sum for this i atom from the interaction with this j atom. */
509 velecsum = _fjsp_add_v2r8(velecsum,velec);
513 /* Update vectorial force */
514 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
515 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
516 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
518 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
519 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
520 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
522 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
524 /* Inner loop uses 353 flops */
531 j_coord_offsetA = DIM*jnrA;
533 /* load j atom coordinates */
534 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
535 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
536 &jy2,&jz2,&jx3,&jy3,&jz3);
538 /* Calculate displacement vector */
539 dx00 = _fjsp_sub_v2r8(ix0,jx0);
540 dy00 = _fjsp_sub_v2r8(iy0,jy0);
541 dz00 = _fjsp_sub_v2r8(iz0,jz0);
542 dx11 = _fjsp_sub_v2r8(ix1,jx1);
543 dy11 = _fjsp_sub_v2r8(iy1,jy1);
544 dz11 = _fjsp_sub_v2r8(iz1,jz1);
545 dx12 = _fjsp_sub_v2r8(ix1,jx2);
546 dy12 = _fjsp_sub_v2r8(iy1,jy2);
547 dz12 = _fjsp_sub_v2r8(iz1,jz2);
548 dx13 = _fjsp_sub_v2r8(ix1,jx3);
549 dy13 = _fjsp_sub_v2r8(iy1,jy3);
550 dz13 = _fjsp_sub_v2r8(iz1,jz3);
551 dx21 = _fjsp_sub_v2r8(ix2,jx1);
552 dy21 = _fjsp_sub_v2r8(iy2,jy1);
553 dz21 = _fjsp_sub_v2r8(iz2,jz1);
554 dx22 = _fjsp_sub_v2r8(ix2,jx2);
555 dy22 = _fjsp_sub_v2r8(iy2,jy2);
556 dz22 = _fjsp_sub_v2r8(iz2,jz2);
557 dx23 = _fjsp_sub_v2r8(ix2,jx3);
558 dy23 = _fjsp_sub_v2r8(iy2,jy3);
559 dz23 = _fjsp_sub_v2r8(iz2,jz3);
560 dx31 = _fjsp_sub_v2r8(ix3,jx1);
561 dy31 = _fjsp_sub_v2r8(iy3,jy1);
562 dz31 = _fjsp_sub_v2r8(iz3,jz1);
563 dx32 = _fjsp_sub_v2r8(ix3,jx2);
564 dy32 = _fjsp_sub_v2r8(iy3,jy2);
565 dz32 = _fjsp_sub_v2r8(iz3,jz2);
566 dx33 = _fjsp_sub_v2r8(ix3,jx3);
567 dy33 = _fjsp_sub_v2r8(iy3,jy3);
568 dz33 = _fjsp_sub_v2r8(iz3,jz3);
570 /* Calculate squared distance and things based on it */
571 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
572 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
573 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
574 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
575 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
576 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
577 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
578 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
579 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
580 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
582 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
583 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
584 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
585 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
586 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
587 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
588 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
589 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
590 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
592 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
593 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
594 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
595 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
596 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
597 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
598 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
599 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
600 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
601 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
603 fjx0 = _fjsp_setzero_v2r8();
604 fjy0 = _fjsp_setzero_v2r8();
605 fjz0 = _fjsp_setzero_v2r8();
606 fjx1 = _fjsp_setzero_v2r8();
607 fjy1 = _fjsp_setzero_v2r8();
608 fjz1 = _fjsp_setzero_v2r8();
609 fjx2 = _fjsp_setzero_v2r8();
610 fjy2 = _fjsp_setzero_v2r8();
611 fjz2 = _fjsp_setzero_v2r8();
612 fjx3 = _fjsp_setzero_v2r8();
613 fjy3 = _fjsp_setzero_v2r8();
614 fjz3 = _fjsp_setzero_v2r8();
616 /**************************
617 * CALCULATE INTERACTIONS *
618 **************************/
620 /* LENNARD-JONES DISPERSION/REPULSION */
622 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
623 vvdw6 = _fjsp_mul_v2r8(c6_00,rinvsix);
624 vvdw12 = _fjsp_mul_v2r8(c12_00,_fjsp_mul_v2r8(rinvsix,rinvsix));
625 vvdw = _fjsp_msub_v2r8( vvdw12,one_twelfth, _fjsp_mul_v2r8(vvdw6,one_sixth) );
626 fvdw = _fjsp_mul_v2r8(_fjsp_sub_v2r8(vvdw12,vvdw6),rinvsq00);
628 /* Update potential sum for this i atom from the interaction with this j atom. */
629 vvdw = _fjsp_unpacklo_v2r8(vvdw,_fjsp_setzero_v2r8());
630 vvdwsum = _fjsp_add_v2r8(vvdwsum,vvdw);
634 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
636 /* Update vectorial force */
637 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
638 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
639 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
641 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
642 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
643 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
645 /**************************
646 * CALCULATE INTERACTIONS *
647 **************************/
649 /* REACTION-FIELD ELECTROSTATICS */
650 velec = _fjsp_mul_v2r8(qq11,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq11,rinv11),crf));
651 felec = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
653 /* Update potential sum for this i atom from the interaction with this j atom. */
654 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
655 velecsum = _fjsp_add_v2r8(velecsum,velec);
659 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
661 /* Update vectorial force */
662 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
663 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
664 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
666 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
667 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
668 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
670 /**************************
671 * CALCULATE INTERACTIONS *
672 **************************/
674 /* REACTION-FIELD ELECTROSTATICS */
675 velec = _fjsp_mul_v2r8(qq12,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq12,rinv12),crf));
676 felec = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
678 /* Update potential sum for this i atom from the interaction with this j atom. */
679 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
680 velecsum = _fjsp_add_v2r8(velecsum,velec);
684 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
686 /* Update vectorial force */
687 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
688 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
689 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
691 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
692 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
693 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
695 /**************************
696 * CALCULATE INTERACTIONS *
697 **************************/
699 /* REACTION-FIELD ELECTROSTATICS */
700 velec = _fjsp_mul_v2r8(qq13,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq13,rinv13),crf));
701 felec = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
703 /* Update potential sum for this i atom from the interaction with this j atom. */
704 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
705 velecsum = _fjsp_add_v2r8(velecsum,velec);
709 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
711 /* Update vectorial force */
712 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
713 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
714 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
716 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
717 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
718 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
720 /**************************
721 * CALCULATE INTERACTIONS *
722 **************************/
724 /* REACTION-FIELD ELECTROSTATICS */
725 velec = _fjsp_mul_v2r8(qq21,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq21,rinv21),crf));
726 felec = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
728 /* Update potential sum for this i atom from the interaction with this j atom. */
729 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
730 velecsum = _fjsp_add_v2r8(velecsum,velec);
734 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
736 /* Update vectorial force */
737 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
738 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
739 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
741 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
742 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
743 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
745 /**************************
746 * CALCULATE INTERACTIONS *
747 **************************/
749 /* REACTION-FIELD ELECTROSTATICS */
750 velec = _fjsp_mul_v2r8(qq22,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq22,rinv22),crf));
751 felec = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
753 /* Update potential sum for this i atom from the interaction with this j atom. */
754 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
755 velecsum = _fjsp_add_v2r8(velecsum,velec);
759 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
761 /* Update vectorial force */
762 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
763 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
764 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
766 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
767 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
768 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
770 /**************************
771 * CALCULATE INTERACTIONS *
772 **************************/
774 /* REACTION-FIELD ELECTROSTATICS */
775 velec = _fjsp_mul_v2r8(qq23,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq23,rinv23),crf));
776 felec = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
778 /* Update potential sum for this i atom from the interaction with this j atom. */
779 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
780 velecsum = _fjsp_add_v2r8(velecsum,velec);
784 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
786 /* Update vectorial force */
787 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
788 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
789 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
791 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
792 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
793 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
795 /**************************
796 * CALCULATE INTERACTIONS *
797 **************************/
799 /* REACTION-FIELD ELECTROSTATICS */
800 velec = _fjsp_mul_v2r8(qq31,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq31,rinv31),crf));
801 felec = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
803 /* Update potential sum for this i atom from the interaction with this j atom. */
804 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
805 velecsum = _fjsp_add_v2r8(velecsum,velec);
809 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
811 /* Update vectorial force */
812 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
813 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
814 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
816 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
817 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
818 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
820 /**************************
821 * CALCULATE INTERACTIONS *
822 **************************/
824 /* REACTION-FIELD ELECTROSTATICS */
825 velec = _fjsp_mul_v2r8(qq32,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq32,rinv32),crf));
826 felec = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
828 /* Update potential sum for this i atom from the interaction with this j atom. */
829 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
830 velecsum = _fjsp_add_v2r8(velecsum,velec);
834 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
836 /* Update vectorial force */
837 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
838 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
839 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
841 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
842 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
843 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
845 /**************************
846 * CALCULATE INTERACTIONS *
847 **************************/
849 /* REACTION-FIELD ELECTROSTATICS */
850 velec = _fjsp_mul_v2r8(qq33,_fjsp_sub_v2r8(_fjsp_madd_v2r8(krf,rsq33,rinv33),crf));
851 felec = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
853 /* Update potential sum for this i atom from the interaction with this j atom. */
854 velec = _fjsp_unpacklo_v2r8(velec,_fjsp_setzero_v2r8());
855 velecsum = _fjsp_add_v2r8(velecsum,velec);
859 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
861 /* Update vectorial force */
862 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
863 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
864 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
866 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
867 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
868 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
870 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
872 /* Inner loop uses 353 flops */
875 /* End of innermost loop */
877 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
878 f+i_coord_offset,fshift+i_shift_offset);
881 /* Update potential energies */
882 gmx_fjsp_update_1pot_v2r8(velecsum,kernel_data->energygrp_elec+ggid);
883 gmx_fjsp_update_1pot_v2r8(vvdwsum,kernel_data->energygrp_vdw+ggid);
885 /* Increment number of inner iterations */
886 inneriter += j_index_end - j_index_start;
888 /* Outer loop uses 26 flops */
891 /* Increment number of outer iterations */
894 /* Update outer/inner flops */
896 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*353);
899 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW4W4_F_sparc64_hpc_ace_double
900 * Electrostatics interaction: ReactionField
901 * VdW interaction: LennardJones
902 * Geometry: Water4-Water4
903 * Calculate force/pot: Force
906 nb_kernel_ElecRF_VdwLJ_GeomW4W4_F_sparc64_hpc_ace_double
907 (t_nblist * gmx_restrict nlist,
908 rvec * gmx_restrict xx,
909 rvec * gmx_restrict ff,
910 t_forcerec * gmx_restrict fr,
911 t_mdatoms * gmx_restrict mdatoms,
912 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
913 t_nrnb * gmx_restrict nrnb)
915 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
916 * just 0 for non-waters.
917 * Suffixes A,B refer to j loop unrolling done with double precision SIMD, e.g. for the two different
918 * jnr indices corresponding to data put in the four positions in the SIMD register.
920 int i_shift_offset,i_coord_offset,outeriter,inneriter;
921 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
923 int j_coord_offsetA,j_coord_offsetB;
924 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
926 real *shiftvec,*fshift,*x,*f;
927 _fjsp_v2r8 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
929 _fjsp_v2r8 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
931 _fjsp_v2r8 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
933 _fjsp_v2r8 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
935 _fjsp_v2r8 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
936 int vdwjidx0A,vdwjidx0B;
937 _fjsp_v2r8 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
938 int vdwjidx1A,vdwjidx1B;
939 _fjsp_v2r8 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
940 int vdwjidx2A,vdwjidx2B;
941 _fjsp_v2r8 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
942 int vdwjidx3A,vdwjidx3B;
943 _fjsp_v2r8 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
944 _fjsp_v2r8 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
945 _fjsp_v2r8 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11;
946 _fjsp_v2r8 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12;
947 _fjsp_v2r8 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13;
948 _fjsp_v2r8 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21;
949 _fjsp_v2r8 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22;
950 _fjsp_v2r8 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23;
951 _fjsp_v2r8 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31;
952 _fjsp_v2r8 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32;
953 _fjsp_v2r8 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33;
954 _fjsp_v2r8 velec,felec,velecsum,facel,crf,krf,krf2;
957 _fjsp_v2r8 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
960 _fjsp_v2r8 one_sixth = gmx_fjsp_set1_v2r8(1.0/6.0);
961 _fjsp_v2r8 one_twelfth = gmx_fjsp_set1_v2r8(1.0/12.0);
963 _fjsp_v2r8 dummy_mask,cutoff_mask;
964 _fjsp_v2r8 one = gmx_fjsp_set1_v2r8(1.0);
965 _fjsp_v2r8 two = gmx_fjsp_set1_v2r8(2.0);
966 union { _fjsp_v2r8 simd; long long int i[2]; } vfconv,gbconv,ewconv;
973 jindex = nlist->jindex;
975 shiftidx = nlist->shift;
977 shiftvec = fr->shift_vec[0];
978 fshift = fr->fshift[0];
979 facel = gmx_fjsp_set1_v2r8(fr->epsfac);
980 charge = mdatoms->chargeA;
981 krf = gmx_fjsp_set1_v2r8(fr->ic->k_rf);
982 krf2 = gmx_fjsp_set1_v2r8(fr->ic->k_rf*2.0);
983 crf = gmx_fjsp_set1_v2r8(fr->ic->c_rf);
984 nvdwtype = fr->ntype;
986 vdwtype = mdatoms->typeA;
988 /* Setup water-specific parameters */
989 inr = nlist->iinr[0];
990 iq1 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+1]));
991 iq2 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+2]));
992 iq3 = _fjsp_mul_v2r8(facel,gmx_fjsp_set1_v2r8(charge[inr+3]));
993 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
995 jq1 = gmx_fjsp_set1_v2r8(charge[inr+1]);
996 jq2 = gmx_fjsp_set1_v2r8(charge[inr+2]);
997 jq3 = gmx_fjsp_set1_v2r8(charge[inr+3]);
998 vdwjidx0A = 2*vdwtype[inr+0];
999 c6_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A]);
1000 c12_00 = gmx_fjsp_set1_v2r8(vdwparam[vdwioffset0+vdwjidx0A+1]);
1001 qq11 = _fjsp_mul_v2r8(iq1,jq1);
1002 qq12 = _fjsp_mul_v2r8(iq1,jq2);
1003 qq13 = _fjsp_mul_v2r8(iq1,jq3);
1004 qq21 = _fjsp_mul_v2r8(iq2,jq1);
1005 qq22 = _fjsp_mul_v2r8(iq2,jq2);
1006 qq23 = _fjsp_mul_v2r8(iq2,jq3);
1007 qq31 = _fjsp_mul_v2r8(iq3,jq1);
1008 qq32 = _fjsp_mul_v2r8(iq3,jq2);
1009 qq33 = _fjsp_mul_v2r8(iq3,jq3);
1011 /* Avoid stupid compiler warnings */
1013 j_coord_offsetA = 0;
1014 j_coord_offsetB = 0;
1019 /* Start outer loop over neighborlists */
1020 for(iidx=0; iidx<nri; iidx++)
1022 /* Load shift vector for this list */
1023 i_shift_offset = DIM*shiftidx[iidx];
1025 /* Load limits for loop over neighbors */
1026 j_index_start = jindex[iidx];
1027 j_index_end = jindex[iidx+1];
1029 /* Get outer coordinate index */
1031 i_coord_offset = DIM*inr;
1033 /* Load i particle coords and add shift vector */
1034 gmx_fjsp_load_shift_and_4rvec_broadcast_v2r8(shiftvec+i_shift_offset,x+i_coord_offset,
1035 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
1037 fix0 = _fjsp_setzero_v2r8();
1038 fiy0 = _fjsp_setzero_v2r8();
1039 fiz0 = _fjsp_setzero_v2r8();
1040 fix1 = _fjsp_setzero_v2r8();
1041 fiy1 = _fjsp_setzero_v2r8();
1042 fiz1 = _fjsp_setzero_v2r8();
1043 fix2 = _fjsp_setzero_v2r8();
1044 fiy2 = _fjsp_setzero_v2r8();
1045 fiz2 = _fjsp_setzero_v2r8();
1046 fix3 = _fjsp_setzero_v2r8();
1047 fiy3 = _fjsp_setzero_v2r8();
1048 fiz3 = _fjsp_setzero_v2r8();
1050 /* Start inner kernel loop */
1051 for(jidx=j_index_start; jidx<j_index_end-1; jidx+=2)
1054 /* Get j neighbor index, and coordinate index */
1056 jnrB = jjnr[jidx+1];
1057 j_coord_offsetA = DIM*jnrA;
1058 j_coord_offsetB = DIM*jnrB;
1060 /* load j atom coordinates */
1061 gmx_fjsp_load_4rvec_2ptr_swizzle_v2r8(x+j_coord_offsetA,x+j_coord_offsetB,
1062 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1063 &jy2,&jz2,&jx3,&jy3,&jz3);
1065 /* Calculate displacement vector */
1066 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1067 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1068 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1069 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1070 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1071 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1072 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1073 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1074 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1075 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1076 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1077 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1078 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1079 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1080 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1081 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1082 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1083 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1084 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1085 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1086 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1087 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1088 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1089 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1090 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1091 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1092 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1093 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1094 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1095 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1097 /* Calculate squared distance and things based on it */
1098 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1099 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1100 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1101 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1102 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1103 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1104 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1105 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1106 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1107 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1109 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1110 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1111 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1112 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1113 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1114 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1115 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1116 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1117 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1119 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1120 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1121 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1122 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1123 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1124 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1125 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1126 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1127 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1128 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1130 fjx0 = _fjsp_setzero_v2r8();
1131 fjy0 = _fjsp_setzero_v2r8();
1132 fjz0 = _fjsp_setzero_v2r8();
1133 fjx1 = _fjsp_setzero_v2r8();
1134 fjy1 = _fjsp_setzero_v2r8();
1135 fjz1 = _fjsp_setzero_v2r8();
1136 fjx2 = _fjsp_setzero_v2r8();
1137 fjy2 = _fjsp_setzero_v2r8();
1138 fjz2 = _fjsp_setzero_v2r8();
1139 fjx3 = _fjsp_setzero_v2r8();
1140 fjy3 = _fjsp_setzero_v2r8();
1141 fjz3 = _fjsp_setzero_v2r8();
1143 /**************************
1144 * CALCULATE INTERACTIONS *
1145 **************************/
1147 /* LENNARD-JONES DISPERSION/REPULSION */
1149 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1150 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1154 /* Update vectorial force */
1155 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1156 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1157 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1159 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1160 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1161 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1163 /**************************
1164 * CALCULATE INTERACTIONS *
1165 **************************/
1167 /* REACTION-FIELD ELECTROSTATICS */
1168 felec = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
1172 /* Update vectorial force */
1173 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1174 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1175 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1177 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1178 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1179 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1181 /**************************
1182 * CALCULATE INTERACTIONS *
1183 **************************/
1185 /* REACTION-FIELD ELECTROSTATICS */
1186 felec = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
1190 /* Update vectorial force */
1191 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1192 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1193 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1195 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1196 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1197 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1199 /**************************
1200 * CALCULATE INTERACTIONS *
1201 **************************/
1203 /* REACTION-FIELD ELECTROSTATICS */
1204 felec = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
1208 /* Update vectorial force */
1209 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1210 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1211 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1213 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1214 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1215 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1217 /**************************
1218 * CALCULATE INTERACTIONS *
1219 **************************/
1221 /* REACTION-FIELD ELECTROSTATICS */
1222 felec = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
1226 /* Update vectorial force */
1227 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1228 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1229 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1231 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1232 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1233 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1235 /**************************
1236 * CALCULATE INTERACTIONS *
1237 **************************/
1239 /* REACTION-FIELD ELECTROSTATICS */
1240 felec = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
1244 /* Update vectorial force */
1245 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1246 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1247 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1249 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1250 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1251 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1253 /**************************
1254 * CALCULATE INTERACTIONS *
1255 **************************/
1257 /* REACTION-FIELD ELECTROSTATICS */
1258 felec = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
1262 /* Update vectorial force */
1263 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1264 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1265 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1267 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1268 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1269 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1271 /**************************
1272 * CALCULATE INTERACTIONS *
1273 **************************/
1275 /* REACTION-FIELD ELECTROSTATICS */
1276 felec = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
1280 /* Update vectorial force */
1281 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1282 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1283 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1285 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1286 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1287 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1289 /**************************
1290 * CALCULATE INTERACTIONS *
1291 **************************/
1293 /* REACTION-FIELD ELECTROSTATICS */
1294 felec = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
1298 /* Update vectorial force */
1299 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1300 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1301 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1303 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1304 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1305 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1307 /**************************
1308 * CALCULATE INTERACTIONS *
1309 **************************/
1311 /* REACTION-FIELD ELECTROSTATICS */
1312 felec = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
1316 /* Update vectorial force */
1317 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1318 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1319 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1321 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1322 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1323 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1325 gmx_fjsp_decrement_4rvec_2ptr_swizzle_v2r8(f+j_coord_offsetA,f+j_coord_offsetB,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1327 /* Inner loop uses 303 flops */
1330 if(jidx<j_index_end)
1334 j_coord_offsetA = DIM*jnrA;
1336 /* load j atom coordinates */
1337 gmx_fjsp_load_4rvec_1ptr_swizzle_v2r8(x+j_coord_offsetA,
1338 &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2,
1339 &jy2,&jz2,&jx3,&jy3,&jz3);
1341 /* Calculate displacement vector */
1342 dx00 = _fjsp_sub_v2r8(ix0,jx0);
1343 dy00 = _fjsp_sub_v2r8(iy0,jy0);
1344 dz00 = _fjsp_sub_v2r8(iz0,jz0);
1345 dx11 = _fjsp_sub_v2r8(ix1,jx1);
1346 dy11 = _fjsp_sub_v2r8(iy1,jy1);
1347 dz11 = _fjsp_sub_v2r8(iz1,jz1);
1348 dx12 = _fjsp_sub_v2r8(ix1,jx2);
1349 dy12 = _fjsp_sub_v2r8(iy1,jy2);
1350 dz12 = _fjsp_sub_v2r8(iz1,jz2);
1351 dx13 = _fjsp_sub_v2r8(ix1,jx3);
1352 dy13 = _fjsp_sub_v2r8(iy1,jy3);
1353 dz13 = _fjsp_sub_v2r8(iz1,jz3);
1354 dx21 = _fjsp_sub_v2r8(ix2,jx1);
1355 dy21 = _fjsp_sub_v2r8(iy2,jy1);
1356 dz21 = _fjsp_sub_v2r8(iz2,jz1);
1357 dx22 = _fjsp_sub_v2r8(ix2,jx2);
1358 dy22 = _fjsp_sub_v2r8(iy2,jy2);
1359 dz22 = _fjsp_sub_v2r8(iz2,jz2);
1360 dx23 = _fjsp_sub_v2r8(ix2,jx3);
1361 dy23 = _fjsp_sub_v2r8(iy2,jy3);
1362 dz23 = _fjsp_sub_v2r8(iz2,jz3);
1363 dx31 = _fjsp_sub_v2r8(ix3,jx1);
1364 dy31 = _fjsp_sub_v2r8(iy3,jy1);
1365 dz31 = _fjsp_sub_v2r8(iz3,jz1);
1366 dx32 = _fjsp_sub_v2r8(ix3,jx2);
1367 dy32 = _fjsp_sub_v2r8(iy3,jy2);
1368 dz32 = _fjsp_sub_v2r8(iz3,jz2);
1369 dx33 = _fjsp_sub_v2r8(ix3,jx3);
1370 dy33 = _fjsp_sub_v2r8(iy3,jy3);
1371 dz33 = _fjsp_sub_v2r8(iz3,jz3);
1373 /* Calculate squared distance and things based on it */
1374 rsq00 = gmx_fjsp_calc_rsq_v2r8(dx00,dy00,dz00);
1375 rsq11 = gmx_fjsp_calc_rsq_v2r8(dx11,dy11,dz11);
1376 rsq12 = gmx_fjsp_calc_rsq_v2r8(dx12,dy12,dz12);
1377 rsq13 = gmx_fjsp_calc_rsq_v2r8(dx13,dy13,dz13);
1378 rsq21 = gmx_fjsp_calc_rsq_v2r8(dx21,dy21,dz21);
1379 rsq22 = gmx_fjsp_calc_rsq_v2r8(dx22,dy22,dz22);
1380 rsq23 = gmx_fjsp_calc_rsq_v2r8(dx23,dy23,dz23);
1381 rsq31 = gmx_fjsp_calc_rsq_v2r8(dx31,dy31,dz31);
1382 rsq32 = gmx_fjsp_calc_rsq_v2r8(dx32,dy32,dz32);
1383 rsq33 = gmx_fjsp_calc_rsq_v2r8(dx33,dy33,dz33);
1385 rinv11 = gmx_fjsp_invsqrt_v2r8(rsq11);
1386 rinv12 = gmx_fjsp_invsqrt_v2r8(rsq12);
1387 rinv13 = gmx_fjsp_invsqrt_v2r8(rsq13);
1388 rinv21 = gmx_fjsp_invsqrt_v2r8(rsq21);
1389 rinv22 = gmx_fjsp_invsqrt_v2r8(rsq22);
1390 rinv23 = gmx_fjsp_invsqrt_v2r8(rsq23);
1391 rinv31 = gmx_fjsp_invsqrt_v2r8(rsq31);
1392 rinv32 = gmx_fjsp_invsqrt_v2r8(rsq32);
1393 rinv33 = gmx_fjsp_invsqrt_v2r8(rsq33);
1395 rinvsq00 = gmx_fjsp_inv_v2r8(rsq00);
1396 rinvsq11 = _fjsp_mul_v2r8(rinv11,rinv11);
1397 rinvsq12 = _fjsp_mul_v2r8(rinv12,rinv12);
1398 rinvsq13 = _fjsp_mul_v2r8(rinv13,rinv13);
1399 rinvsq21 = _fjsp_mul_v2r8(rinv21,rinv21);
1400 rinvsq22 = _fjsp_mul_v2r8(rinv22,rinv22);
1401 rinvsq23 = _fjsp_mul_v2r8(rinv23,rinv23);
1402 rinvsq31 = _fjsp_mul_v2r8(rinv31,rinv31);
1403 rinvsq32 = _fjsp_mul_v2r8(rinv32,rinv32);
1404 rinvsq33 = _fjsp_mul_v2r8(rinv33,rinv33);
1406 fjx0 = _fjsp_setzero_v2r8();
1407 fjy0 = _fjsp_setzero_v2r8();
1408 fjz0 = _fjsp_setzero_v2r8();
1409 fjx1 = _fjsp_setzero_v2r8();
1410 fjy1 = _fjsp_setzero_v2r8();
1411 fjz1 = _fjsp_setzero_v2r8();
1412 fjx2 = _fjsp_setzero_v2r8();
1413 fjy2 = _fjsp_setzero_v2r8();
1414 fjz2 = _fjsp_setzero_v2r8();
1415 fjx3 = _fjsp_setzero_v2r8();
1416 fjy3 = _fjsp_setzero_v2r8();
1417 fjz3 = _fjsp_setzero_v2r8();
1419 /**************************
1420 * CALCULATE INTERACTIONS *
1421 **************************/
1423 /* LENNARD-JONES DISPERSION/REPULSION */
1425 rinvsix = _fjsp_mul_v2r8(_fjsp_mul_v2r8(rinvsq00,rinvsq00),rinvsq00);
1426 fvdw = _fjsp_mul_v2r8(_fjsp_msub_v2r8(c12_00,rinvsix,c6_00),_fjsp_mul_v2r8(rinvsix,rinvsq00));
1430 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1432 /* Update vectorial force */
1433 fix0 = _fjsp_madd_v2r8(dx00,fscal,fix0);
1434 fiy0 = _fjsp_madd_v2r8(dy00,fscal,fiy0);
1435 fiz0 = _fjsp_madd_v2r8(dz00,fscal,fiz0);
1437 fjx0 = _fjsp_madd_v2r8(dx00,fscal,fjx0);
1438 fjy0 = _fjsp_madd_v2r8(dy00,fscal,fjy0);
1439 fjz0 = _fjsp_madd_v2r8(dz00,fscal,fjz0);
1441 /**************************
1442 * CALCULATE INTERACTIONS *
1443 **************************/
1445 /* REACTION-FIELD ELECTROSTATICS */
1446 felec = _fjsp_mul_v2r8(qq11,_fjsp_msub_v2r8(rinv11,rinvsq11,krf2));
1450 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1452 /* Update vectorial force */
1453 fix1 = _fjsp_madd_v2r8(dx11,fscal,fix1);
1454 fiy1 = _fjsp_madd_v2r8(dy11,fscal,fiy1);
1455 fiz1 = _fjsp_madd_v2r8(dz11,fscal,fiz1);
1457 fjx1 = _fjsp_madd_v2r8(dx11,fscal,fjx1);
1458 fjy1 = _fjsp_madd_v2r8(dy11,fscal,fjy1);
1459 fjz1 = _fjsp_madd_v2r8(dz11,fscal,fjz1);
1461 /**************************
1462 * CALCULATE INTERACTIONS *
1463 **************************/
1465 /* REACTION-FIELD ELECTROSTATICS */
1466 felec = _fjsp_mul_v2r8(qq12,_fjsp_msub_v2r8(rinv12,rinvsq12,krf2));
1470 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1472 /* Update vectorial force */
1473 fix1 = _fjsp_madd_v2r8(dx12,fscal,fix1);
1474 fiy1 = _fjsp_madd_v2r8(dy12,fscal,fiy1);
1475 fiz1 = _fjsp_madd_v2r8(dz12,fscal,fiz1);
1477 fjx2 = _fjsp_madd_v2r8(dx12,fscal,fjx2);
1478 fjy2 = _fjsp_madd_v2r8(dy12,fscal,fjy2);
1479 fjz2 = _fjsp_madd_v2r8(dz12,fscal,fjz2);
1481 /**************************
1482 * CALCULATE INTERACTIONS *
1483 **************************/
1485 /* REACTION-FIELD ELECTROSTATICS */
1486 felec = _fjsp_mul_v2r8(qq13,_fjsp_msub_v2r8(rinv13,rinvsq13,krf2));
1490 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1492 /* Update vectorial force */
1493 fix1 = _fjsp_madd_v2r8(dx13,fscal,fix1);
1494 fiy1 = _fjsp_madd_v2r8(dy13,fscal,fiy1);
1495 fiz1 = _fjsp_madd_v2r8(dz13,fscal,fiz1);
1497 fjx3 = _fjsp_madd_v2r8(dx13,fscal,fjx3);
1498 fjy3 = _fjsp_madd_v2r8(dy13,fscal,fjy3);
1499 fjz3 = _fjsp_madd_v2r8(dz13,fscal,fjz3);
1501 /**************************
1502 * CALCULATE INTERACTIONS *
1503 **************************/
1505 /* REACTION-FIELD ELECTROSTATICS */
1506 felec = _fjsp_mul_v2r8(qq21,_fjsp_msub_v2r8(rinv21,rinvsq21,krf2));
1510 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1512 /* Update vectorial force */
1513 fix2 = _fjsp_madd_v2r8(dx21,fscal,fix2);
1514 fiy2 = _fjsp_madd_v2r8(dy21,fscal,fiy2);
1515 fiz2 = _fjsp_madd_v2r8(dz21,fscal,fiz2);
1517 fjx1 = _fjsp_madd_v2r8(dx21,fscal,fjx1);
1518 fjy1 = _fjsp_madd_v2r8(dy21,fscal,fjy1);
1519 fjz1 = _fjsp_madd_v2r8(dz21,fscal,fjz1);
1521 /**************************
1522 * CALCULATE INTERACTIONS *
1523 **************************/
1525 /* REACTION-FIELD ELECTROSTATICS */
1526 felec = _fjsp_mul_v2r8(qq22,_fjsp_msub_v2r8(rinv22,rinvsq22,krf2));
1530 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1532 /* Update vectorial force */
1533 fix2 = _fjsp_madd_v2r8(dx22,fscal,fix2);
1534 fiy2 = _fjsp_madd_v2r8(dy22,fscal,fiy2);
1535 fiz2 = _fjsp_madd_v2r8(dz22,fscal,fiz2);
1537 fjx2 = _fjsp_madd_v2r8(dx22,fscal,fjx2);
1538 fjy2 = _fjsp_madd_v2r8(dy22,fscal,fjy2);
1539 fjz2 = _fjsp_madd_v2r8(dz22,fscal,fjz2);
1541 /**************************
1542 * CALCULATE INTERACTIONS *
1543 **************************/
1545 /* REACTION-FIELD ELECTROSTATICS */
1546 felec = _fjsp_mul_v2r8(qq23,_fjsp_msub_v2r8(rinv23,rinvsq23,krf2));
1550 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1552 /* Update vectorial force */
1553 fix2 = _fjsp_madd_v2r8(dx23,fscal,fix2);
1554 fiy2 = _fjsp_madd_v2r8(dy23,fscal,fiy2);
1555 fiz2 = _fjsp_madd_v2r8(dz23,fscal,fiz2);
1557 fjx3 = _fjsp_madd_v2r8(dx23,fscal,fjx3);
1558 fjy3 = _fjsp_madd_v2r8(dy23,fscal,fjy3);
1559 fjz3 = _fjsp_madd_v2r8(dz23,fscal,fjz3);
1561 /**************************
1562 * CALCULATE INTERACTIONS *
1563 **************************/
1565 /* REACTION-FIELD ELECTROSTATICS */
1566 felec = _fjsp_mul_v2r8(qq31,_fjsp_msub_v2r8(rinv31,rinvsq31,krf2));
1570 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1572 /* Update vectorial force */
1573 fix3 = _fjsp_madd_v2r8(dx31,fscal,fix3);
1574 fiy3 = _fjsp_madd_v2r8(dy31,fscal,fiy3);
1575 fiz3 = _fjsp_madd_v2r8(dz31,fscal,fiz3);
1577 fjx1 = _fjsp_madd_v2r8(dx31,fscal,fjx1);
1578 fjy1 = _fjsp_madd_v2r8(dy31,fscal,fjy1);
1579 fjz1 = _fjsp_madd_v2r8(dz31,fscal,fjz1);
1581 /**************************
1582 * CALCULATE INTERACTIONS *
1583 **************************/
1585 /* REACTION-FIELD ELECTROSTATICS */
1586 felec = _fjsp_mul_v2r8(qq32,_fjsp_msub_v2r8(rinv32,rinvsq32,krf2));
1590 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1592 /* Update vectorial force */
1593 fix3 = _fjsp_madd_v2r8(dx32,fscal,fix3);
1594 fiy3 = _fjsp_madd_v2r8(dy32,fscal,fiy3);
1595 fiz3 = _fjsp_madd_v2r8(dz32,fscal,fiz3);
1597 fjx2 = _fjsp_madd_v2r8(dx32,fscal,fjx2);
1598 fjy2 = _fjsp_madd_v2r8(dy32,fscal,fjy2);
1599 fjz2 = _fjsp_madd_v2r8(dz32,fscal,fjz2);
1601 /**************************
1602 * CALCULATE INTERACTIONS *
1603 **************************/
1605 /* REACTION-FIELD ELECTROSTATICS */
1606 felec = _fjsp_mul_v2r8(qq33,_fjsp_msub_v2r8(rinv33,rinvsq33,krf2));
1610 fscal = _fjsp_unpacklo_v2r8(fscal,_fjsp_setzero_v2r8());
1612 /* Update vectorial force */
1613 fix3 = _fjsp_madd_v2r8(dx33,fscal,fix3);
1614 fiy3 = _fjsp_madd_v2r8(dy33,fscal,fiy3);
1615 fiz3 = _fjsp_madd_v2r8(dz33,fscal,fiz3);
1617 fjx3 = _fjsp_madd_v2r8(dx33,fscal,fjx3);
1618 fjy3 = _fjsp_madd_v2r8(dy33,fscal,fjy3);
1619 fjz3 = _fjsp_madd_v2r8(dz33,fscal,fjz3);
1621 gmx_fjsp_decrement_4rvec_1ptr_swizzle_v2r8(f+j_coord_offsetA,fjx0,fjy0,fjz0,fjx1,fjy1,fjz1,fjx2,fjy2,fjz2,fjx3,fjy3,fjz3);
1623 /* Inner loop uses 303 flops */
1626 /* End of innermost loop */
1628 gmx_fjsp_update_iforce_4atom_swizzle_v2r8(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1629 f+i_coord_offset,fshift+i_shift_offset);
1631 /* Increment number of inner iterations */
1632 inneriter += j_index_end - j_index_start;
1634 /* Outer loop uses 24 flops */
1637 /* Increment number of outer iterations */
1640 /* Update outer/inner flops */
1642 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*303);