File: | gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecNone_VdwLJ_GeomP1P1_sse4_1_single.c |
Location: | line 392, column 22 |
Description: | Value stored to 'one' during its initialization is never read |
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 sse4_1_single kernel generator. |
37 | */ |
38 | #ifdef HAVE_CONFIG_H1 |
39 | #include <config.h> |
40 | #endif |
41 | |
42 | #include <math.h> |
43 | |
44 | #include "../nb_kernel.h" |
45 | #include "types/simple.h" |
46 | #include "gromacs/math/vec.h" |
47 | #include "nrnb.h" |
48 | |
49 | #include "gromacs/simd/math_x86_sse4_1_single.h" |
50 | #include "kernelutil_x86_sse4_1_single.h" |
51 | |
52 | /* |
53 | * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwLJ_GeomP1P1_VF_sse4_1_single |
54 | * Electrostatics interaction: None |
55 | * VdW interaction: LennardJones |
56 | * Geometry: Particle-Particle |
57 | * Calculate force/pot: PotentialAndForce |
58 | */ |
59 | void |
60 | nb_kernel_ElecNone_VdwLJ_GeomP1P1_VF_sse4_1_single |
61 | (t_nblist * gmx_restrict nlist, |
62 | rvec * gmx_restrict xx, |
63 | rvec * gmx_restrict ff, |
64 | t_forcerec * gmx_restrict fr, |
65 | t_mdatoms * gmx_restrict mdatoms, |
66 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data, |
67 | t_nrnb * gmx_restrict nrnb) |
68 | { |
69 | /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or |
70 | * just 0 for non-waters. |
71 | * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different |
72 | * jnr indices corresponding to data put in the four positions in the SIMD register. |
73 | */ |
74 | int i_shift_offset,i_coord_offset,outeriter,inneriter; |
75 | int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx; |
76 | int jnrA,jnrB,jnrC,jnrD; |
77 | int jnrlistA,jnrlistB,jnrlistC,jnrlistD; |
78 | int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD; |
79 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
80 | real rcutoff_scalar; |
81 | real *shiftvec,*fshift,*x,*f; |
82 | real *fjptrA,*fjptrB,*fjptrC,*fjptrD; |
83 | real scratch[4*DIM3]; |
84 | __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall; |
85 | int vdwioffset0; |
86 | __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
87 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
88 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
89 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
90 | int nvdwtype; |
91 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
92 | int *vdwtype; |
93 | real *vdwparam; |
94 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
95 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
96 | __m128 dummy_mask,cutoff_mask; |
97 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
98 | __m128 one = _mm_set1_ps(1.0); |
99 | __m128 two = _mm_set1_ps(2.0); |
100 | x = xx[0]; |
101 | f = ff[0]; |
102 | |
103 | nri = nlist->nri; |
104 | iinr = nlist->iinr; |
105 | jindex = nlist->jindex; |
106 | jjnr = nlist->jjnr; |
107 | shiftidx = nlist->shift; |
108 | gid = nlist->gid; |
109 | shiftvec = fr->shift_vec[0]; |
110 | fshift = fr->fshift[0]; |
111 | nvdwtype = fr->ntype; |
112 | vdwparam = fr->nbfp; |
113 | vdwtype = mdatoms->typeA; |
114 | |
115 | /* Avoid stupid compiler warnings */ |
116 | jnrA = jnrB = jnrC = jnrD = 0; |
117 | j_coord_offsetA = 0; |
118 | j_coord_offsetB = 0; |
119 | j_coord_offsetC = 0; |
120 | j_coord_offsetD = 0; |
121 | |
122 | outeriter = 0; |
123 | inneriter = 0; |
124 | |
125 | for(iidx=0;iidx<4*DIM3;iidx++) |
126 | { |
127 | scratch[iidx] = 0.0; |
128 | } |
129 | |
130 | /* Start outer loop over neighborlists */ |
131 | for(iidx=0; iidx<nri; iidx++) |
132 | { |
133 | /* Load shift vector for this list */ |
134 | i_shift_offset = DIM3*shiftidx[iidx]; |
135 | |
136 | /* Load limits for loop over neighbors */ |
137 | j_index_start = jindex[iidx]; |
138 | j_index_end = jindex[iidx+1]; |
139 | |
140 | /* Get outer coordinate index */ |
141 | inr = iinr[iidx]; |
142 | i_coord_offset = DIM3*inr; |
143 | |
144 | /* Load i particle coords and add shift vector */ |
145 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
146 | |
147 | fix0 = _mm_setzero_ps(); |
148 | fiy0 = _mm_setzero_ps(); |
149 | fiz0 = _mm_setzero_ps(); |
150 | |
151 | /* Load parameters for i particles */ |
152 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
153 | |
154 | /* Reset potential sums */ |
155 | vvdwsum = _mm_setzero_ps(); |
156 | |
157 | /* Start inner kernel loop */ |
158 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
159 | { |
160 | |
161 | /* Get j neighbor index, and coordinate index */ |
162 | jnrA = jjnr[jidx]; |
163 | jnrB = jjnr[jidx+1]; |
164 | jnrC = jjnr[jidx+2]; |
165 | jnrD = jjnr[jidx+3]; |
166 | j_coord_offsetA = DIM3*jnrA; |
167 | j_coord_offsetB = DIM3*jnrB; |
168 | j_coord_offsetC = DIM3*jnrC; |
169 | j_coord_offsetD = DIM3*jnrD; |
170 | |
171 | /* load j atom coordinates */ |
172 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
173 | x+j_coord_offsetC,x+j_coord_offsetD, |
174 | &jx0,&jy0,&jz0); |
175 | |
176 | /* Calculate displacement vector */ |
177 | dx00 = _mm_sub_ps(ix0,jx0); |
178 | dy00 = _mm_sub_ps(iy0,jy0); |
179 | dz00 = _mm_sub_ps(iz0,jz0); |
180 | |
181 | /* Calculate squared distance and things based on it */ |
182 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
183 | |
184 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
185 | |
186 | /* Load parameters for j particles */ |
187 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
188 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
189 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
190 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
191 | |
192 | /************************** |
193 | * CALCULATE INTERACTIONS * |
194 | **************************/ |
195 | |
196 | /* Compute parameters for interactions between i and j atoms */ |
197 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
198 | vdwparam+vdwioffset0+vdwjidx0B, |
199 | vdwparam+vdwioffset0+vdwjidx0C, |
200 | vdwparam+vdwioffset0+vdwjidx0D, |
201 | &c6_00,&c12_00); |
202 | |
203 | /* LENNARD-JONES DISPERSION/REPULSION */ |
204 | |
205 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
206 | vvdw6 = _mm_mul_ps(c6_00,rinvsix); |
207 | vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix)); |
208 | vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) ); |
209 | fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00); |
210 | |
211 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
212 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
213 | |
214 | fscal = fvdw; |
215 | |
216 | /* Calculate temporary vectorial force */ |
217 | tx = _mm_mul_ps(fscal,dx00); |
218 | ty = _mm_mul_ps(fscal,dy00); |
219 | tz = _mm_mul_ps(fscal,dz00); |
220 | |
221 | /* Update vectorial force */ |
222 | fix0 = _mm_add_ps(fix0,tx); |
223 | fiy0 = _mm_add_ps(fiy0,ty); |
224 | fiz0 = _mm_add_ps(fiz0,tz); |
225 | |
226 | fjptrA = f+j_coord_offsetA; |
227 | fjptrB = f+j_coord_offsetB; |
228 | fjptrC = f+j_coord_offsetC; |
229 | fjptrD = f+j_coord_offsetD; |
230 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
231 | |
232 | /* Inner loop uses 32 flops */ |
233 | } |
234 | |
235 | if(jidx<j_index_end) |
236 | { |
237 | |
238 | /* Get j neighbor index, and coordinate index */ |
239 | jnrlistA = jjnr[jidx]; |
240 | jnrlistB = jjnr[jidx+1]; |
241 | jnrlistC = jjnr[jidx+2]; |
242 | jnrlistD = jjnr[jidx+3]; |
243 | /* Sign of each element will be negative for non-real atoms. |
244 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
245 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
246 | */ |
247 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
248 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
249 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
250 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
251 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
252 | j_coord_offsetA = DIM3*jnrA; |
253 | j_coord_offsetB = DIM3*jnrB; |
254 | j_coord_offsetC = DIM3*jnrC; |
255 | j_coord_offsetD = DIM3*jnrD; |
256 | |
257 | /* load j atom coordinates */ |
258 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
259 | x+j_coord_offsetC,x+j_coord_offsetD, |
260 | &jx0,&jy0,&jz0); |
261 | |
262 | /* Calculate displacement vector */ |
263 | dx00 = _mm_sub_ps(ix0,jx0); |
264 | dy00 = _mm_sub_ps(iy0,jy0); |
265 | dz00 = _mm_sub_ps(iz0,jz0); |
266 | |
267 | /* Calculate squared distance and things based on it */ |
268 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
269 | |
270 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
271 | |
272 | /* Load parameters for j particles */ |
273 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
274 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
275 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
276 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
277 | |
278 | /************************** |
279 | * CALCULATE INTERACTIONS * |
280 | **************************/ |
281 | |
282 | /* Compute parameters for interactions between i and j atoms */ |
283 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
284 | vdwparam+vdwioffset0+vdwjidx0B, |
285 | vdwparam+vdwioffset0+vdwjidx0C, |
286 | vdwparam+vdwioffset0+vdwjidx0D, |
287 | &c6_00,&c12_00); |
288 | |
289 | /* LENNARD-JONES DISPERSION/REPULSION */ |
290 | |
291 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
292 | vvdw6 = _mm_mul_ps(c6_00,rinvsix); |
293 | vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix)); |
294 | vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) ); |
295 | fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00); |
296 | |
297 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
298 | vvdw = _mm_andnot_ps(dummy_mask,vvdw); |
299 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
300 | |
301 | fscal = fvdw; |
302 | |
303 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
304 | |
305 | /* Calculate temporary vectorial force */ |
306 | tx = _mm_mul_ps(fscal,dx00); |
307 | ty = _mm_mul_ps(fscal,dy00); |
308 | tz = _mm_mul_ps(fscal,dz00); |
309 | |
310 | /* Update vectorial force */ |
311 | fix0 = _mm_add_ps(fix0,tx); |
312 | fiy0 = _mm_add_ps(fiy0,ty); |
313 | fiz0 = _mm_add_ps(fiz0,tz); |
314 | |
315 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
316 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
317 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
318 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
319 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
320 | |
321 | /* Inner loop uses 32 flops */ |
322 | } |
323 | |
324 | /* End of innermost loop */ |
325 | |
326 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
327 | f+i_coord_offset,fshift+i_shift_offset); |
328 | |
329 | ggid = gid[iidx]; |
330 | /* Update potential energies */ |
331 | gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid); |
332 | |
333 | /* Increment number of inner iterations */ |
334 | inneriter += j_index_end - j_index_start; |
335 | |
336 | /* Outer loop uses 7 flops */ |
337 | } |
338 | |
339 | /* Increment number of outer iterations */ |
340 | outeriter += nri; |
341 | |
342 | /* Update outer/inner flops */ |
343 | |
344 | inc_nrnb(nrnb,eNR_NBKERNEL_VDW_VF,outeriter*7 + inneriter*32)(nrnb)->n[eNR_NBKERNEL_VDW_VF] += outeriter*7 + inneriter* 32; |
345 | } |
346 | /* |
347 | * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwLJ_GeomP1P1_F_sse4_1_single |
348 | * Electrostatics interaction: None |
349 | * VdW interaction: LennardJones |
350 | * Geometry: Particle-Particle |
351 | * Calculate force/pot: Force |
352 | */ |
353 | void |
354 | nb_kernel_ElecNone_VdwLJ_GeomP1P1_F_sse4_1_single |
355 | (t_nblist * gmx_restrict nlist, |
356 | rvec * gmx_restrict xx, |
357 | rvec * gmx_restrict ff, |
358 | t_forcerec * gmx_restrict fr, |
359 | t_mdatoms * gmx_restrict mdatoms, |
360 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data, |
361 | t_nrnb * gmx_restrict nrnb) |
362 | { |
363 | /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or |
364 | * just 0 for non-waters. |
365 | * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different |
366 | * jnr indices corresponding to data put in the four positions in the SIMD register. |
367 | */ |
368 | int i_shift_offset,i_coord_offset,outeriter,inneriter; |
369 | int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx; |
370 | int jnrA,jnrB,jnrC,jnrD; |
371 | int jnrlistA,jnrlistB,jnrlistC,jnrlistD; |
372 | int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD; |
373 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
374 | real rcutoff_scalar; |
375 | real *shiftvec,*fshift,*x,*f; |
376 | real *fjptrA,*fjptrB,*fjptrC,*fjptrD; |
377 | real scratch[4*DIM3]; |
378 | __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall; |
379 | int vdwioffset0; |
380 | __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
381 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
382 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
383 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
384 | int nvdwtype; |
385 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
386 | int *vdwtype; |
387 | real *vdwparam; |
388 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
389 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
390 | __m128 dummy_mask,cutoff_mask; |
391 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
392 | __m128 one = _mm_set1_ps(1.0); |
Value stored to 'one' during its initialization is never read | |
393 | __m128 two = _mm_set1_ps(2.0); |
394 | x = xx[0]; |
395 | f = ff[0]; |
396 | |
397 | nri = nlist->nri; |
398 | iinr = nlist->iinr; |
399 | jindex = nlist->jindex; |
400 | jjnr = nlist->jjnr; |
401 | shiftidx = nlist->shift; |
402 | gid = nlist->gid; |
403 | shiftvec = fr->shift_vec[0]; |
404 | fshift = fr->fshift[0]; |
405 | nvdwtype = fr->ntype; |
406 | vdwparam = fr->nbfp; |
407 | vdwtype = mdatoms->typeA; |
408 | |
409 | /* Avoid stupid compiler warnings */ |
410 | jnrA = jnrB = jnrC = jnrD = 0; |
411 | j_coord_offsetA = 0; |
412 | j_coord_offsetB = 0; |
413 | j_coord_offsetC = 0; |
414 | j_coord_offsetD = 0; |
415 | |
416 | outeriter = 0; |
417 | inneriter = 0; |
418 | |
419 | for(iidx=0;iidx<4*DIM3;iidx++) |
420 | { |
421 | scratch[iidx] = 0.0; |
422 | } |
423 | |
424 | /* Start outer loop over neighborlists */ |
425 | for(iidx=0; iidx<nri; iidx++) |
426 | { |
427 | /* Load shift vector for this list */ |
428 | i_shift_offset = DIM3*shiftidx[iidx]; |
429 | |
430 | /* Load limits for loop over neighbors */ |
431 | j_index_start = jindex[iidx]; |
432 | j_index_end = jindex[iidx+1]; |
433 | |
434 | /* Get outer coordinate index */ |
435 | inr = iinr[iidx]; |
436 | i_coord_offset = DIM3*inr; |
437 | |
438 | /* Load i particle coords and add shift vector */ |
439 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
440 | |
441 | fix0 = _mm_setzero_ps(); |
442 | fiy0 = _mm_setzero_ps(); |
443 | fiz0 = _mm_setzero_ps(); |
444 | |
445 | /* Load parameters for i particles */ |
446 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
447 | |
448 | /* Start inner kernel loop */ |
449 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
450 | { |
451 | |
452 | /* Get j neighbor index, and coordinate index */ |
453 | jnrA = jjnr[jidx]; |
454 | jnrB = jjnr[jidx+1]; |
455 | jnrC = jjnr[jidx+2]; |
456 | jnrD = jjnr[jidx+3]; |
457 | j_coord_offsetA = DIM3*jnrA; |
458 | j_coord_offsetB = DIM3*jnrB; |
459 | j_coord_offsetC = DIM3*jnrC; |
460 | j_coord_offsetD = DIM3*jnrD; |
461 | |
462 | /* load j atom coordinates */ |
463 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
464 | x+j_coord_offsetC,x+j_coord_offsetD, |
465 | &jx0,&jy0,&jz0); |
466 | |
467 | /* Calculate displacement vector */ |
468 | dx00 = _mm_sub_ps(ix0,jx0); |
469 | dy00 = _mm_sub_ps(iy0,jy0); |
470 | dz00 = _mm_sub_ps(iz0,jz0); |
471 | |
472 | /* Calculate squared distance and things based on it */ |
473 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
474 | |
475 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
476 | |
477 | /* Load parameters for j particles */ |
478 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
479 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
480 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
481 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
482 | |
483 | /************************** |
484 | * CALCULATE INTERACTIONS * |
485 | **************************/ |
486 | |
487 | /* Compute parameters for interactions between i and j atoms */ |
488 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
489 | vdwparam+vdwioffset0+vdwjidx0B, |
490 | vdwparam+vdwioffset0+vdwjidx0C, |
491 | vdwparam+vdwioffset0+vdwjidx0D, |
492 | &c6_00,&c12_00); |
493 | |
494 | /* LENNARD-JONES DISPERSION/REPULSION */ |
495 | |
496 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
497 | fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00)); |
498 | |
499 | fscal = fvdw; |
500 | |
501 | /* Calculate temporary vectorial force */ |
502 | tx = _mm_mul_ps(fscal,dx00); |
503 | ty = _mm_mul_ps(fscal,dy00); |
504 | tz = _mm_mul_ps(fscal,dz00); |
505 | |
506 | /* Update vectorial force */ |
507 | fix0 = _mm_add_ps(fix0,tx); |
508 | fiy0 = _mm_add_ps(fiy0,ty); |
509 | fiz0 = _mm_add_ps(fiz0,tz); |
510 | |
511 | fjptrA = f+j_coord_offsetA; |
512 | fjptrB = f+j_coord_offsetB; |
513 | fjptrC = f+j_coord_offsetC; |
514 | fjptrD = f+j_coord_offsetD; |
515 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
516 | |
517 | /* Inner loop uses 27 flops */ |
518 | } |
519 | |
520 | if(jidx<j_index_end) |
521 | { |
522 | |
523 | /* Get j neighbor index, and coordinate index */ |
524 | jnrlistA = jjnr[jidx]; |
525 | jnrlistB = jjnr[jidx+1]; |
526 | jnrlistC = jjnr[jidx+2]; |
527 | jnrlistD = jjnr[jidx+3]; |
528 | /* Sign of each element will be negative for non-real atoms. |
529 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
530 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
531 | */ |
532 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
533 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
534 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
535 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
536 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
537 | j_coord_offsetA = DIM3*jnrA; |
538 | j_coord_offsetB = DIM3*jnrB; |
539 | j_coord_offsetC = DIM3*jnrC; |
540 | j_coord_offsetD = DIM3*jnrD; |
541 | |
542 | /* load j atom coordinates */ |
543 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
544 | x+j_coord_offsetC,x+j_coord_offsetD, |
545 | &jx0,&jy0,&jz0); |
546 | |
547 | /* Calculate displacement vector */ |
548 | dx00 = _mm_sub_ps(ix0,jx0); |
549 | dy00 = _mm_sub_ps(iy0,jy0); |
550 | dz00 = _mm_sub_ps(iz0,jz0); |
551 | |
552 | /* Calculate squared distance and things based on it */ |
553 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
554 | |
555 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
556 | |
557 | /* Load parameters for j particles */ |
558 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
559 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
560 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
561 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
562 | |
563 | /************************** |
564 | * CALCULATE INTERACTIONS * |
565 | **************************/ |
566 | |
567 | /* Compute parameters for interactions between i and j atoms */ |
568 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
569 | vdwparam+vdwioffset0+vdwjidx0B, |
570 | vdwparam+vdwioffset0+vdwjidx0C, |
571 | vdwparam+vdwioffset0+vdwjidx0D, |
572 | &c6_00,&c12_00); |
573 | |
574 | /* LENNARD-JONES DISPERSION/REPULSION */ |
575 | |
576 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
577 | fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00)); |
578 | |
579 | fscal = fvdw; |
580 | |
581 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
582 | |
583 | /* Calculate temporary vectorial force */ |
584 | tx = _mm_mul_ps(fscal,dx00); |
585 | ty = _mm_mul_ps(fscal,dy00); |
586 | tz = _mm_mul_ps(fscal,dz00); |
587 | |
588 | /* Update vectorial force */ |
589 | fix0 = _mm_add_ps(fix0,tx); |
590 | fiy0 = _mm_add_ps(fiy0,ty); |
591 | fiz0 = _mm_add_ps(fiz0,tz); |
592 | |
593 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
594 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
595 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
596 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
597 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
598 | |
599 | /* Inner loop uses 27 flops */ |
600 | } |
601 | |
602 | /* End of innermost loop */ |
603 | |
604 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
605 | f+i_coord_offset,fshift+i_shift_offset); |
606 | |
607 | /* Increment number of inner iterations */ |
608 | inneriter += j_index_end - j_index_start; |
609 | |
610 | /* Outer loop uses 6 flops */ |
611 | } |
612 | |
613 | /* Increment number of outer iterations */ |
614 | outeriter += nri; |
615 | |
616 | /* Update outer/inner flops */ |
617 | |
618 | inc_nrnb(nrnb,eNR_NBKERNEL_VDW_F,outeriter*6 + inneriter*27)(nrnb)->n[eNR_NBKERNEL_VDW_F] += outeriter*6 + inneriter*27; |
619 | } |