File: | gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCoul_VdwLJ_GeomW4W4_sse4_1_single.c |
Location: | line 120, column 22 |
Description: | Value stored to 'signbit' 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_ElecCoul_VdwLJ_GeomW4W4_VF_sse4_1_single |
54 | * Electrostatics interaction: Coulomb |
55 | * VdW interaction: LennardJones |
56 | * Geometry: Water4-Water4 |
57 | * Calculate force/pot: PotentialAndForce |
58 | */ |
59 | void |
60 | nb_kernel_ElecCoul_VdwLJ_GeomW4W4_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 vdwioffset1; |
88 | __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
89 | int vdwioffset2; |
90 | __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
91 | int vdwioffset3; |
92 | __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
93 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
94 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
95 | int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D; |
96 | __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
97 | int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D; |
98 | __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
99 | int vdwjidx3A,vdwjidx3B,vdwjidx3C,vdwjidx3D; |
100 | __m128 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
101 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
102 | __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11; |
103 | __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12; |
104 | __m128 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13; |
105 | __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21; |
106 | __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22; |
107 | __m128 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23; |
108 | __m128 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31; |
109 | __m128 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32; |
110 | __m128 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33; |
111 | __m128 velec,felec,velecsum,facel,crf,krf,krf2; |
112 | real *charge; |
113 | int nvdwtype; |
114 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
115 | int *vdwtype; |
116 | real *vdwparam; |
117 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
118 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
119 | __m128 dummy_mask,cutoff_mask; |
120 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
Value stored to 'signbit' during its initialization is never read | |
121 | __m128 one = _mm_set1_ps(1.0); |
122 | __m128 two = _mm_set1_ps(2.0); |
123 | x = xx[0]; |
124 | f = ff[0]; |
125 | |
126 | nri = nlist->nri; |
127 | iinr = nlist->iinr; |
128 | jindex = nlist->jindex; |
129 | jjnr = nlist->jjnr; |
130 | shiftidx = nlist->shift; |
131 | gid = nlist->gid; |
132 | shiftvec = fr->shift_vec[0]; |
133 | fshift = fr->fshift[0]; |
134 | facel = _mm_set1_ps(fr->epsfac); |
135 | charge = mdatoms->chargeA; |
136 | nvdwtype = fr->ntype; |
137 | vdwparam = fr->nbfp; |
138 | vdwtype = mdatoms->typeA; |
139 | |
140 | /* Setup water-specific parameters */ |
141 | inr = nlist->iinr[0]; |
142 | iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1])); |
143 | iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2])); |
144 | iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3])); |
145 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
146 | |
147 | jq1 = _mm_set1_ps(charge[inr+1]); |
148 | jq2 = _mm_set1_ps(charge[inr+2]); |
149 | jq3 = _mm_set1_ps(charge[inr+3]); |
150 | vdwjidx0A = 2*vdwtype[inr+0]; |
151 | c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]); |
152 | c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]); |
153 | qq11 = _mm_mul_ps(iq1,jq1); |
154 | qq12 = _mm_mul_ps(iq1,jq2); |
155 | qq13 = _mm_mul_ps(iq1,jq3); |
156 | qq21 = _mm_mul_ps(iq2,jq1); |
157 | qq22 = _mm_mul_ps(iq2,jq2); |
158 | qq23 = _mm_mul_ps(iq2,jq3); |
159 | qq31 = _mm_mul_ps(iq3,jq1); |
160 | qq32 = _mm_mul_ps(iq3,jq2); |
161 | qq33 = _mm_mul_ps(iq3,jq3); |
162 | |
163 | /* Avoid stupid compiler warnings */ |
164 | jnrA = jnrB = jnrC = jnrD = 0; |
165 | j_coord_offsetA = 0; |
166 | j_coord_offsetB = 0; |
167 | j_coord_offsetC = 0; |
168 | j_coord_offsetD = 0; |
169 | |
170 | outeriter = 0; |
171 | inneriter = 0; |
172 | |
173 | for(iidx=0;iidx<4*DIM3;iidx++) |
174 | { |
175 | scratch[iidx] = 0.0; |
176 | } |
177 | |
178 | /* Start outer loop over neighborlists */ |
179 | for(iidx=0; iidx<nri; iidx++) |
180 | { |
181 | /* Load shift vector for this list */ |
182 | i_shift_offset = DIM3*shiftidx[iidx]; |
183 | |
184 | /* Load limits for loop over neighbors */ |
185 | j_index_start = jindex[iidx]; |
186 | j_index_end = jindex[iidx+1]; |
187 | |
188 | /* Get outer coordinate index */ |
189 | inr = iinr[iidx]; |
190 | i_coord_offset = DIM3*inr; |
191 | |
192 | /* Load i particle coords and add shift vector */ |
193 | gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset, |
194 | &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3); |
195 | |
196 | fix0 = _mm_setzero_ps(); |
197 | fiy0 = _mm_setzero_ps(); |
198 | fiz0 = _mm_setzero_ps(); |
199 | fix1 = _mm_setzero_ps(); |
200 | fiy1 = _mm_setzero_ps(); |
201 | fiz1 = _mm_setzero_ps(); |
202 | fix2 = _mm_setzero_ps(); |
203 | fiy2 = _mm_setzero_ps(); |
204 | fiz2 = _mm_setzero_ps(); |
205 | fix3 = _mm_setzero_ps(); |
206 | fiy3 = _mm_setzero_ps(); |
207 | fiz3 = _mm_setzero_ps(); |
208 | |
209 | /* Reset potential sums */ |
210 | velecsum = _mm_setzero_ps(); |
211 | vvdwsum = _mm_setzero_ps(); |
212 | |
213 | /* Start inner kernel loop */ |
214 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
215 | { |
216 | |
217 | /* Get j neighbor index, and coordinate index */ |
218 | jnrA = jjnr[jidx]; |
219 | jnrB = jjnr[jidx+1]; |
220 | jnrC = jjnr[jidx+2]; |
221 | jnrD = jjnr[jidx+3]; |
222 | j_coord_offsetA = DIM3*jnrA; |
223 | j_coord_offsetB = DIM3*jnrB; |
224 | j_coord_offsetC = DIM3*jnrC; |
225 | j_coord_offsetD = DIM3*jnrD; |
226 | |
227 | /* load j atom coordinates */ |
228 | gmx_mm_load_4rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
229 | x+j_coord_offsetC,x+j_coord_offsetD, |
230 | &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2, |
231 | &jy2,&jz2,&jx3,&jy3,&jz3); |
232 | |
233 | /* Calculate displacement vector */ |
234 | dx00 = _mm_sub_ps(ix0,jx0); |
235 | dy00 = _mm_sub_ps(iy0,jy0); |
236 | dz00 = _mm_sub_ps(iz0,jz0); |
237 | dx11 = _mm_sub_ps(ix1,jx1); |
238 | dy11 = _mm_sub_ps(iy1,jy1); |
239 | dz11 = _mm_sub_ps(iz1,jz1); |
240 | dx12 = _mm_sub_ps(ix1,jx2); |
241 | dy12 = _mm_sub_ps(iy1,jy2); |
242 | dz12 = _mm_sub_ps(iz1,jz2); |
243 | dx13 = _mm_sub_ps(ix1,jx3); |
244 | dy13 = _mm_sub_ps(iy1,jy3); |
245 | dz13 = _mm_sub_ps(iz1,jz3); |
246 | dx21 = _mm_sub_ps(ix2,jx1); |
247 | dy21 = _mm_sub_ps(iy2,jy1); |
248 | dz21 = _mm_sub_ps(iz2,jz1); |
249 | dx22 = _mm_sub_ps(ix2,jx2); |
250 | dy22 = _mm_sub_ps(iy2,jy2); |
251 | dz22 = _mm_sub_ps(iz2,jz2); |
252 | dx23 = _mm_sub_ps(ix2,jx3); |
253 | dy23 = _mm_sub_ps(iy2,jy3); |
254 | dz23 = _mm_sub_ps(iz2,jz3); |
255 | dx31 = _mm_sub_ps(ix3,jx1); |
256 | dy31 = _mm_sub_ps(iy3,jy1); |
257 | dz31 = _mm_sub_ps(iz3,jz1); |
258 | dx32 = _mm_sub_ps(ix3,jx2); |
259 | dy32 = _mm_sub_ps(iy3,jy2); |
260 | dz32 = _mm_sub_ps(iz3,jz2); |
261 | dx33 = _mm_sub_ps(ix3,jx3); |
262 | dy33 = _mm_sub_ps(iy3,jy3); |
263 | dz33 = _mm_sub_ps(iz3,jz3); |
264 | |
265 | /* Calculate squared distance and things based on it */ |
266 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
267 | rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11); |
268 | rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12); |
269 | rsq13 = gmx_mm_calc_rsq_ps(dx13,dy13,dz13); |
270 | rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21); |
271 | rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22); |
272 | rsq23 = gmx_mm_calc_rsq_ps(dx23,dy23,dz23); |
273 | rsq31 = gmx_mm_calc_rsq_ps(dx31,dy31,dz31); |
274 | rsq32 = gmx_mm_calc_rsq_ps(dx32,dy32,dz32); |
275 | rsq33 = gmx_mm_calc_rsq_ps(dx33,dy33,dz33); |
276 | |
277 | rinv11 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq11); |
278 | rinv12 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq12); |
279 | rinv13 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq13); |
280 | rinv21 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq21); |
281 | rinv22 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq22); |
282 | rinv23 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq23); |
283 | rinv31 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq31); |
284 | rinv32 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq32); |
285 | rinv33 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq33); |
286 | |
287 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
288 | rinvsq11 = _mm_mul_ps(rinv11,rinv11); |
289 | rinvsq12 = _mm_mul_ps(rinv12,rinv12); |
290 | rinvsq13 = _mm_mul_ps(rinv13,rinv13); |
291 | rinvsq21 = _mm_mul_ps(rinv21,rinv21); |
292 | rinvsq22 = _mm_mul_ps(rinv22,rinv22); |
293 | rinvsq23 = _mm_mul_ps(rinv23,rinv23); |
294 | rinvsq31 = _mm_mul_ps(rinv31,rinv31); |
295 | rinvsq32 = _mm_mul_ps(rinv32,rinv32); |
296 | rinvsq33 = _mm_mul_ps(rinv33,rinv33); |
297 | |
298 | fjx0 = _mm_setzero_ps(); |
299 | fjy0 = _mm_setzero_ps(); |
300 | fjz0 = _mm_setzero_ps(); |
301 | fjx1 = _mm_setzero_ps(); |
302 | fjy1 = _mm_setzero_ps(); |
303 | fjz1 = _mm_setzero_ps(); |
304 | fjx2 = _mm_setzero_ps(); |
305 | fjy2 = _mm_setzero_ps(); |
306 | fjz2 = _mm_setzero_ps(); |
307 | fjx3 = _mm_setzero_ps(); |
308 | fjy3 = _mm_setzero_ps(); |
309 | fjz3 = _mm_setzero_ps(); |
310 | |
311 | /************************** |
312 | * CALCULATE INTERACTIONS * |
313 | **************************/ |
314 | |
315 | /* LENNARD-JONES DISPERSION/REPULSION */ |
316 | |
317 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
318 | vvdw6 = _mm_mul_ps(c6_00,rinvsix); |
319 | vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix)); |
320 | vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) ); |
321 | fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00); |
322 | |
323 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
324 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
325 | |
326 | fscal = fvdw; |
327 | |
328 | /* Calculate temporary vectorial force */ |
329 | tx = _mm_mul_ps(fscal,dx00); |
330 | ty = _mm_mul_ps(fscal,dy00); |
331 | tz = _mm_mul_ps(fscal,dz00); |
332 | |
333 | /* Update vectorial force */ |
334 | fix0 = _mm_add_ps(fix0,tx); |
335 | fiy0 = _mm_add_ps(fiy0,ty); |
336 | fiz0 = _mm_add_ps(fiz0,tz); |
337 | |
338 | fjx0 = _mm_add_ps(fjx0,tx); |
339 | fjy0 = _mm_add_ps(fjy0,ty); |
340 | fjz0 = _mm_add_ps(fjz0,tz); |
341 | |
342 | /************************** |
343 | * CALCULATE INTERACTIONS * |
344 | **************************/ |
345 | |
346 | /* COULOMB ELECTROSTATICS */ |
347 | velec = _mm_mul_ps(qq11,rinv11); |
348 | felec = _mm_mul_ps(velec,rinvsq11); |
349 | |
350 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
351 | velecsum = _mm_add_ps(velecsum,velec); |
352 | |
353 | fscal = felec; |
354 | |
355 | /* Calculate temporary vectorial force */ |
356 | tx = _mm_mul_ps(fscal,dx11); |
357 | ty = _mm_mul_ps(fscal,dy11); |
358 | tz = _mm_mul_ps(fscal,dz11); |
359 | |
360 | /* Update vectorial force */ |
361 | fix1 = _mm_add_ps(fix1,tx); |
362 | fiy1 = _mm_add_ps(fiy1,ty); |
363 | fiz1 = _mm_add_ps(fiz1,tz); |
364 | |
365 | fjx1 = _mm_add_ps(fjx1,tx); |
366 | fjy1 = _mm_add_ps(fjy1,ty); |
367 | fjz1 = _mm_add_ps(fjz1,tz); |
368 | |
369 | /************************** |
370 | * CALCULATE INTERACTIONS * |
371 | **************************/ |
372 | |
373 | /* COULOMB ELECTROSTATICS */ |
374 | velec = _mm_mul_ps(qq12,rinv12); |
375 | felec = _mm_mul_ps(velec,rinvsq12); |
376 | |
377 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
378 | velecsum = _mm_add_ps(velecsum,velec); |
379 | |
380 | fscal = felec; |
381 | |
382 | /* Calculate temporary vectorial force */ |
383 | tx = _mm_mul_ps(fscal,dx12); |
384 | ty = _mm_mul_ps(fscal,dy12); |
385 | tz = _mm_mul_ps(fscal,dz12); |
386 | |
387 | /* Update vectorial force */ |
388 | fix1 = _mm_add_ps(fix1,tx); |
389 | fiy1 = _mm_add_ps(fiy1,ty); |
390 | fiz1 = _mm_add_ps(fiz1,tz); |
391 | |
392 | fjx2 = _mm_add_ps(fjx2,tx); |
393 | fjy2 = _mm_add_ps(fjy2,ty); |
394 | fjz2 = _mm_add_ps(fjz2,tz); |
395 | |
396 | /************************** |
397 | * CALCULATE INTERACTIONS * |
398 | **************************/ |
399 | |
400 | /* COULOMB ELECTROSTATICS */ |
401 | velec = _mm_mul_ps(qq13,rinv13); |
402 | felec = _mm_mul_ps(velec,rinvsq13); |
403 | |
404 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
405 | velecsum = _mm_add_ps(velecsum,velec); |
406 | |
407 | fscal = felec; |
408 | |
409 | /* Calculate temporary vectorial force */ |
410 | tx = _mm_mul_ps(fscal,dx13); |
411 | ty = _mm_mul_ps(fscal,dy13); |
412 | tz = _mm_mul_ps(fscal,dz13); |
413 | |
414 | /* Update vectorial force */ |
415 | fix1 = _mm_add_ps(fix1,tx); |
416 | fiy1 = _mm_add_ps(fiy1,ty); |
417 | fiz1 = _mm_add_ps(fiz1,tz); |
418 | |
419 | fjx3 = _mm_add_ps(fjx3,tx); |
420 | fjy3 = _mm_add_ps(fjy3,ty); |
421 | fjz3 = _mm_add_ps(fjz3,tz); |
422 | |
423 | /************************** |
424 | * CALCULATE INTERACTIONS * |
425 | **************************/ |
426 | |
427 | /* COULOMB ELECTROSTATICS */ |
428 | velec = _mm_mul_ps(qq21,rinv21); |
429 | felec = _mm_mul_ps(velec,rinvsq21); |
430 | |
431 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
432 | velecsum = _mm_add_ps(velecsum,velec); |
433 | |
434 | fscal = felec; |
435 | |
436 | /* Calculate temporary vectorial force */ |
437 | tx = _mm_mul_ps(fscal,dx21); |
438 | ty = _mm_mul_ps(fscal,dy21); |
439 | tz = _mm_mul_ps(fscal,dz21); |
440 | |
441 | /* Update vectorial force */ |
442 | fix2 = _mm_add_ps(fix2,tx); |
443 | fiy2 = _mm_add_ps(fiy2,ty); |
444 | fiz2 = _mm_add_ps(fiz2,tz); |
445 | |
446 | fjx1 = _mm_add_ps(fjx1,tx); |
447 | fjy1 = _mm_add_ps(fjy1,ty); |
448 | fjz1 = _mm_add_ps(fjz1,tz); |
449 | |
450 | /************************** |
451 | * CALCULATE INTERACTIONS * |
452 | **************************/ |
453 | |
454 | /* COULOMB ELECTROSTATICS */ |
455 | velec = _mm_mul_ps(qq22,rinv22); |
456 | felec = _mm_mul_ps(velec,rinvsq22); |
457 | |
458 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
459 | velecsum = _mm_add_ps(velecsum,velec); |
460 | |
461 | fscal = felec; |
462 | |
463 | /* Calculate temporary vectorial force */ |
464 | tx = _mm_mul_ps(fscal,dx22); |
465 | ty = _mm_mul_ps(fscal,dy22); |
466 | tz = _mm_mul_ps(fscal,dz22); |
467 | |
468 | /* Update vectorial force */ |
469 | fix2 = _mm_add_ps(fix2,tx); |
470 | fiy2 = _mm_add_ps(fiy2,ty); |
471 | fiz2 = _mm_add_ps(fiz2,tz); |
472 | |
473 | fjx2 = _mm_add_ps(fjx2,tx); |
474 | fjy2 = _mm_add_ps(fjy2,ty); |
475 | fjz2 = _mm_add_ps(fjz2,tz); |
476 | |
477 | /************************** |
478 | * CALCULATE INTERACTIONS * |
479 | **************************/ |
480 | |
481 | /* COULOMB ELECTROSTATICS */ |
482 | velec = _mm_mul_ps(qq23,rinv23); |
483 | felec = _mm_mul_ps(velec,rinvsq23); |
484 | |
485 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
486 | velecsum = _mm_add_ps(velecsum,velec); |
487 | |
488 | fscal = felec; |
489 | |
490 | /* Calculate temporary vectorial force */ |
491 | tx = _mm_mul_ps(fscal,dx23); |
492 | ty = _mm_mul_ps(fscal,dy23); |
493 | tz = _mm_mul_ps(fscal,dz23); |
494 | |
495 | /* Update vectorial force */ |
496 | fix2 = _mm_add_ps(fix2,tx); |
497 | fiy2 = _mm_add_ps(fiy2,ty); |
498 | fiz2 = _mm_add_ps(fiz2,tz); |
499 | |
500 | fjx3 = _mm_add_ps(fjx3,tx); |
501 | fjy3 = _mm_add_ps(fjy3,ty); |
502 | fjz3 = _mm_add_ps(fjz3,tz); |
503 | |
504 | /************************** |
505 | * CALCULATE INTERACTIONS * |
506 | **************************/ |
507 | |
508 | /* COULOMB ELECTROSTATICS */ |
509 | velec = _mm_mul_ps(qq31,rinv31); |
510 | felec = _mm_mul_ps(velec,rinvsq31); |
511 | |
512 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
513 | velecsum = _mm_add_ps(velecsum,velec); |
514 | |
515 | fscal = felec; |
516 | |
517 | /* Calculate temporary vectorial force */ |
518 | tx = _mm_mul_ps(fscal,dx31); |
519 | ty = _mm_mul_ps(fscal,dy31); |
520 | tz = _mm_mul_ps(fscal,dz31); |
521 | |
522 | /* Update vectorial force */ |
523 | fix3 = _mm_add_ps(fix3,tx); |
524 | fiy3 = _mm_add_ps(fiy3,ty); |
525 | fiz3 = _mm_add_ps(fiz3,tz); |
526 | |
527 | fjx1 = _mm_add_ps(fjx1,tx); |
528 | fjy1 = _mm_add_ps(fjy1,ty); |
529 | fjz1 = _mm_add_ps(fjz1,tz); |
530 | |
531 | /************************** |
532 | * CALCULATE INTERACTIONS * |
533 | **************************/ |
534 | |
535 | /* COULOMB ELECTROSTATICS */ |
536 | velec = _mm_mul_ps(qq32,rinv32); |
537 | felec = _mm_mul_ps(velec,rinvsq32); |
538 | |
539 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
540 | velecsum = _mm_add_ps(velecsum,velec); |
541 | |
542 | fscal = felec; |
543 | |
544 | /* Calculate temporary vectorial force */ |
545 | tx = _mm_mul_ps(fscal,dx32); |
546 | ty = _mm_mul_ps(fscal,dy32); |
547 | tz = _mm_mul_ps(fscal,dz32); |
548 | |
549 | /* Update vectorial force */ |
550 | fix3 = _mm_add_ps(fix3,tx); |
551 | fiy3 = _mm_add_ps(fiy3,ty); |
552 | fiz3 = _mm_add_ps(fiz3,tz); |
553 | |
554 | fjx2 = _mm_add_ps(fjx2,tx); |
555 | fjy2 = _mm_add_ps(fjy2,ty); |
556 | fjz2 = _mm_add_ps(fjz2,tz); |
557 | |
558 | /************************** |
559 | * CALCULATE INTERACTIONS * |
560 | **************************/ |
561 | |
562 | /* COULOMB ELECTROSTATICS */ |
563 | velec = _mm_mul_ps(qq33,rinv33); |
564 | felec = _mm_mul_ps(velec,rinvsq33); |
565 | |
566 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
567 | velecsum = _mm_add_ps(velecsum,velec); |
568 | |
569 | fscal = felec; |
570 | |
571 | /* Calculate temporary vectorial force */ |
572 | tx = _mm_mul_ps(fscal,dx33); |
573 | ty = _mm_mul_ps(fscal,dy33); |
574 | tz = _mm_mul_ps(fscal,dz33); |
575 | |
576 | /* Update vectorial force */ |
577 | fix3 = _mm_add_ps(fix3,tx); |
578 | fiy3 = _mm_add_ps(fiy3,ty); |
579 | fiz3 = _mm_add_ps(fiz3,tz); |
580 | |
581 | fjx3 = _mm_add_ps(fjx3,tx); |
582 | fjy3 = _mm_add_ps(fjy3,ty); |
583 | fjz3 = _mm_add_ps(fjz3,tz); |
584 | |
585 | fjptrA = f+j_coord_offsetA; |
586 | fjptrB = f+j_coord_offsetB; |
587 | fjptrC = f+j_coord_offsetC; |
588 | fjptrD = f+j_coord_offsetD; |
589 | |
590 | gmx_mm_decrement_4rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD, |
591 | fjx0,fjy0,fjz0,fjx1,fjy1,fjz1, |
592 | fjx2,fjy2,fjz2,fjx3,fjy3,fjz3); |
593 | |
594 | /* Inner loop uses 287 flops */ |
595 | } |
596 | |
597 | if(jidx<j_index_end) |
598 | { |
599 | |
600 | /* Get j neighbor index, and coordinate index */ |
601 | jnrlistA = jjnr[jidx]; |
602 | jnrlistB = jjnr[jidx+1]; |
603 | jnrlistC = jjnr[jidx+2]; |
604 | jnrlistD = jjnr[jidx+3]; |
605 | /* Sign of each element will be negative for non-real atoms. |
606 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
607 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
608 | */ |
609 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
610 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
611 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
612 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
613 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
614 | j_coord_offsetA = DIM3*jnrA; |
615 | j_coord_offsetB = DIM3*jnrB; |
616 | j_coord_offsetC = DIM3*jnrC; |
617 | j_coord_offsetD = DIM3*jnrD; |
618 | |
619 | /* load j atom coordinates */ |
620 | gmx_mm_load_4rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
621 | x+j_coord_offsetC,x+j_coord_offsetD, |
622 | &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2, |
623 | &jy2,&jz2,&jx3,&jy3,&jz3); |
624 | |
625 | /* Calculate displacement vector */ |
626 | dx00 = _mm_sub_ps(ix0,jx0); |
627 | dy00 = _mm_sub_ps(iy0,jy0); |
628 | dz00 = _mm_sub_ps(iz0,jz0); |
629 | dx11 = _mm_sub_ps(ix1,jx1); |
630 | dy11 = _mm_sub_ps(iy1,jy1); |
631 | dz11 = _mm_sub_ps(iz1,jz1); |
632 | dx12 = _mm_sub_ps(ix1,jx2); |
633 | dy12 = _mm_sub_ps(iy1,jy2); |
634 | dz12 = _mm_sub_ps(iz1,jz2); |
635 | dx13 = _mm_sub_ps(ix1,jx3); |
636 | dy13 = _mm_sub_ps(iy1,jy3); |
637 | dz13 = _mm_sub_ps(iz1,jz3); |
638 | dx21 = _mm_sub_ps(ix2,jx1); |
639 | dy21 = _mm_sub_ps(iy2,jy1); |
640 | dz21 = _mm_sub_ps(iz2,jz1); |
641 | dx22 = _mm_sub_ps(ix2,jx2); |
642 | dy22 = _mm_sub_ps(iy2,jy2); |
643 | dz22 = _mm_sub_ps(iz2,jz2); |
644 | dx23 = _mm_sub_ps(ix2,jx3); |
645 | dy23 = _mm_sub_ps(iy2,jy3); |
646 | dz23 = _mm_sub_ps(iz2,jz3); |
647 | dx31 = _mm_sub_ps(ix3,jx1); |
648 | dy31 = _mm_sub_ps(iy3,jy1); |
649 | dz31 = _mm_sub_ps(iz3,jz1); |
650 | dx32 = _mm_sub_ps(ix3,jx2); |
651 | dy32 = _mm_sub_ps(iy3,jy2); |
652 | dz32 = _mm_sub_ps(iz3,jz2); |
653 | dx33 = _mm_sub_ps(ix3,jx3); |
654 | dy33 = _mm_sub_ps(iy3,jy3); |
655 | dz33 = _mm_sub_ps(iz3,jz3); |
656 | |
657 | /* Calculate squared distance and things based on it */ |
658 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
659 | rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11); |
660 | rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12); |
661 | rsq13 = gmx_mm_calc_rsq_ps(dx13,dy13,dz13); |
662 | rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21); |
663 | rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22); |
664 | rsq23 = gmx_mm_calc_rsq_ps(dx23,dy23,dz23); |
665 | rsq31 = gmx_mm_calc_rsq_ps(dx31,dy31,dz31); |
666 | rsq32 = gmx_mm_calc_rsq_ps(dx32,dy32,dz32); |
667 | rsq33 = gmx_mm_calc_rsq_ps(dx33,dy33,dz33); |
668 | |
669 | rinv11 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq11); |
670 | rinv12 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq12); |
671 | rinv13 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq13); |
672 | rinv21 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq21); |
673 | rinv22 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq22); |
674 | rinv23 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq23); |
675 | rinv31 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq31); |
676 | rinv32 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq32); |
677 | rinv33 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq33); |
678 | |
679 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
680 | rinvsq11 = _mm_mul_ps(rinv11,rinv11); |
681 | rinvsq12 = _mm_mul_ps(rinv12,rinv12); |
682 | rinvsq13 = _mm_mul_ps(rinv13,rinv13); |
683 | rinvsq21 = _mm_mul_ps(rinv21,rinv21); |
684 | rinvsq22 = _mm_mul_ps(rinv22,rinv22); |
685 | rinvsq23 = _mm_mul_ps(rinv23,rinv23); |
686 | rinvsq31 = _mm_mul_ps(rinv31,rinv31); |
687 | rinvsq32 = _mm_mul_ps(rinv32,rinv32); |
688 | rinvsq33 = _mm_mul_ps(rinv33,rinv33); |
689 | |
690 | fjx0 = _mm_setzero_ps(); |
691 | fjy0 = _mm_setzero_ps(); |
692 | fjz0 = _mm_setzero_ps(); |
693 | fjx1 = _mm_setzero_ps(); |
694 | fjy1 = _mm_setzero_ps(); |
695 | fjz1 = _mm_setzero_ps(); |
696 | fjx2 = _mm_setzero_ps(); |
697 | fjy2 = _mm_setzero_ps(); |
698 | fjz2 = _mm_setzero_ps(); |
699 | fjx3 = _mm_setzero_ps(); |
700 | fjy3 = _mm_setzero_ps(); |
701 | fjz3 = _mm_setzero_ps(); |
702 | |
703 | /************************** |
704 | * CALCULATE INTERACTIONS * |
705 | **************************/ |
706 | |
707 | /* LENNARD-JONES DISPERSION/REPULSION */ |
708 | |
709 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
710 | vvdw6 = _mm_mul_ps(c6_00,rinvsix); |
711 | vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix)); |
712 | vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) ); |
713 | fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00); |
714 | |
715 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
716 | vvdw = _mm_andnot_ps(dummy_mask,vvdw); |
717 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
718 | |
719 | fscal = fvdw; |
720 | |
721 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
722 | |
723 | /* Calculate temporary vectorial force */ |
724 | tx = _mm_mul_ps(fscal,dx00); |
725 | ty = _mm_mul_ps(fscal,dy00); |
726 | tz = _mm_mul_ps(fscal,dz00); |
727 | |
728 | /* Update vectorial force */ |
729 | fix0 = _mm_add_ps(fix0,tx); |
730 | fiy0 = _mm_add_ps(fiy0,ty); |
731 | fiz0 = _mm_add_ps(fiz0,tz); |
732 | |
733 | fjx0 = _mm_add_ps(fjx0,tx); |
734 | fjy0 = _mm_add_ps(fjy0,ty); |
735 | fjz0 = _mm_add_ps(fjz0,tz); |
736 | |
737 | /************************** |
738 | * CALCULATE INTERACTIONS * |
739 | **************************/ |
740 | |
741 | /* COULOMB ELECTROSTATICS */ |
742 | velec = _mm_mul_ps(qq11,rinv11); |
743 | felec = _mm_mul_ps(velec,rinvsq11); |
744 | |
745 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
746 | velec = _mm_andnot_ps(dummy_mask,velec); |
747 | velecsum = _mm_add_ps(velecsum,velec); |
748 | |
749 | fscal = felec; |
750 | |
751 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
752 | |
753 | /* Calculate temporary vectorial force */ |
754 | tx = _mm_mul_ps(fscal,dx11); |
755 | ty = _mm_mul_ps(fscal,dy11); |
756 | tz = _mm_mul_ps(fscal,dz11); |
757 | |
758 | /* Update vectorial force */ |
759 | fix1 = _mm_add_ps(fix1,tx); |
760 | fiy1 = _mm_add_ps(fiy1,ty); |
761 | fiz1 = _mm_add_ps(fiz1,tz); |
762 | |
763 | fjx1 = _mm_add_ps(fjx1,tx); |
764 | fjy1 = _mm_add_ps(fjy1,ty); |
765 | fjz1 = _mm_add_ps(fjz1,tz); |
766 | |
767 | /************************** |
768 | * CALCULATE INTERACTIONS * |
769 | **************************/ |
770 | |
771 | /* COULOMB ELECTROSTATICS */ |
772 | velec = _mm_mul_ps(qq12,rinv12); |
773 | felec = _mm_mul_ps(velec,rinvsq12); |
774 | |
775 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
776 | velec = _mm_andnot_ps(dummy_mask,velec); |
777 | velecsum = _mm_add_ps(velecsum,velec); |
778 | |
779 | fscal = felec; |
780 | |
781 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
782 | |
783 | /* Calculate temporary vectorial force */ |
784 | tx = _mm_mul_ps(fscal,dx12); |
785 | ty = _mm_mul_ps(fscal,dy12); |
786 | tz = _mm_mul_ps(fscal,dz12); |
787 | |
788 | /* Update vectorial force */ |
789 | fix1 = _mm_add_ps(fix1,tx); |
790 | fiy1 = _mm_add_ps(fiy1,ty); |
791 | fiz1 = _mm_add_ps(fiz1,tz); |
792 | |
793 | fjx2 = _mm_add_ps(fjx2,tx); |
794 | fjy2 = _mm_add_ps(fjy2,ty); |
795 | fjz2 = _mm_add_ps(fjz2,tz); |
796 | |
797 | /************************** |
798 | * CALCULATE INTERACTIONS * |
799 | **************************/ |
800 | |
801 | /* COULOMB ELECTROSTATICS */ |
802 | velec = _mm_mul_ps(qq13,rinv13); |
803 | felec = _mm_mul_ps(velec,rinvsq13); |
804 | |
805 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
806 | velec = _mm_andnot_ps(dummy_mask,velec); |
807 | velecsum = _mm_add_ps(velecsum,velec); |
808 | |
809 | fscal = felec; |
810 | |
811 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
812 | |
813 | /* Calculate temporary vectorial force */ |
814 | tx = _mm_mul_ps(fscal,dx13); |
815 | ty = _mm_mul_ps(fscal,dy13); |
816 | tz = _mm_mul_ps(fscal,dz13); |
817 | |
818 | /* Update vectorial force */ |
819 | fix1 = _mm_add_ps(fix1,tx); |
820 | fiy1 = _mm_add_ps(fiy1,ty); |
821 | fiz1 = _mm_add_ps(fiz1,tz); |
822 | |
823 | fjx3 = _mm_add_ps(fjx3,tx); |
824 | fjy3 = _mm_add_ps(fjy3,ty); |
825 | fjz3 = _mm_add_ps(fjz3,tz); |
826 | |
827 | /************************** |
828 | * CALCULATE INTERACTIONS * |
829 | **************************/ |
830 | |
831 | /* COULOMB ELECTROSTATICS */ |
832 | velec = _mm_mul_ps(qq21,rinv21); |
833 | felec = _mm_mul_ps(velec,rinvsq21); |
834 | |
835 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
836 | velec = _mm_andnot_ps(dummy_mask,velec); |
837 | velecsum = _mm_add_ps(velecsum,velec); |
838 | |
839 | fscal = felec; |
840 | |
841 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
842 | |
843 | /* Calculate temporary vectorial force */ |
844 | tx = _mm_mul_ps(fscal,dx21); |
845 | ty = _mm_mul_ps(fscal,dy21); |
846 | tz = _mm_mul_ps(fscal,dz21); |
847 | |
848 | /* Update vectorial force */ |
849 | fix2 = _mm_add_ps(fix2,tx); |
850 | fiy2 = _mm_add_ps(fiy2,ty); |
851 | fiz2 = _mm_add_ps(fiz2,tz); |
852 | |
853 | fjx1 = _mm_add_ps(fjx1,tx); |
854 | fjy1 = _mm_add_ps(fjy1,ty); |
855 | fjz1 = _mm_add_ps(fjz1,tz); |
856 | |
857 | /************************** |
858 | * CALCULATE INTERACTIONS * |
859 | **************************/ |
860 | |
861 | /* COULOMB ELECTROSTATICS */ |
862 | velec = _mm_mul_ps(qq22,rinv22); |
863 | felec = _mm_mul_ps(velec,rinvsq22); |
864 | |
865 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
866 | velec = _mm_andnot_ps(dummy_mask,velec); |
867 | velecsum = _mm_add_ps(velecsum,velec); |
868 | |
869 | fscal = felec; |
870 | |
871 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
872 | |
873 | /* Calculate temporary vectorial force */ |
874 | tx = _mm_mul_ps(fscal,dx22); |
875 | ty = _mm_mul_ps(fscal,dy22); |
876 | tz = _mm_mul_ps(fscal,dz22); |
877 | |
878 | /* Update vectorial force */ |
879 | fix2 = _mm_add_ps(fix2,tx); |
880 | fiy2 = _mm_add_ps(fiy2,ty); |
881 | fiz2 = _mm_add_ps(fiz2,tz); |
882 | |
883 | fjx2 = _mm_add_ps(fjx2,tx); |
884 | fjy2 = _mm_add_ps(fjy2,ty); |
885 | fjz2 = _mm_add_ps(fjz2,tz); |
886 | |
887 | /************************** |
888 | * CALCULATE INTERACTIONS * |
889 | **************************/ |
890 | |
891 | /* COULOMB ELECTROSTATICS */ |
892 | velec = _mm_mul_ps(qq23,rinv23); |
893 | felec = _mm_mul_ps(velec,rinvsq23); |
894 | |
895 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
896 | velec = _mm_andnot_ps(dummy_mask,velec); |
897 | velecsum = _mm_add_ps(velecsum,velec); |
898 | |
899 | fscal = felec; |
900 | |
901 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
902 | |
903 | /* Calculate temporary vectorial force */ |
904 | tx = _mm_mul_ps(fscal,dx23); |
905 | ty = _mm_mul_ps(fscal,dy23); |
906 | tz = _mm_mul_ps(fscal,dz23); |
907 | |
908 | /* Update vectorial force */ |
909 | fix2 = _mm_add_ps(fix2,tx); |
910 | fiy2 = _mm_add_ps(fiy2,ty); |
911 | fiz2 = _mm_add_ps(fiz2,tz); |
912 | |
913 | fjx3 = _mm_add_ps(fjx3,tx); |
914 | fjy3 = _mm_add_ps(fjy3,ty); |
915 | fjz3 = _mm_add_ps(fjz3,tz); |
916 | |
917 | /************************** |
918 | * CALCULATE INTERACTIONS * |
919 | **************************/ |
920 | |
921 | /* COULOMB ELECTROSTATICS */ |
922 | velec = _mm_mul_ps(qq31,rinv31); |
923 | felec = _mm_mul_ps(velec,rinvsq31); |
924 | |
925 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
926 | velec = _mm_andnot_ps(dummy_mask,velec); |
927 | velecsum = _mm_add_ps(velecsum,velec); |
928 | |
929 | fscal = felec; |
930 | |
931 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
932 | |
933 | /* Calculate temporary vectorial force */ |
934 | tx = _mm_mul_ps(fscal,dx31); |
935 | ty = _mm_mul_ps(fscal,dy31); |
936 | tz = _mm_mul_ps(fscal,dz31); |
937 | |
938 | /* Update vectorial force */ |
939 | fix3 = _mm_add_ps(fix3,tx); |
940 | fiy3 = _mm_add_ps(fiy3,ty); |
941 | fiz3 = _mm_add_ps(fiz3,tz); |
942 | |
943 | fjx1 = _mm_add_ps(fjx1,tx); |
944 | fjy1 = _mm_add_ps(fjy1,ty); |
945 | fjz1 = _mm_add_ps(fjz1,tz); |
946 | |
947 | /************************** |
948 | * CALCULATE INTERACTIONS * |
949 | **************************/ |
950 | |
951 | /* COULOMB ELECTROSTATICS */ |
952 | velec = _mm_mul_ps(qq32,rinv32); |
953 | felec = _mm_mul_ps(velec,rinvsq32); |
954 | |
955 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
956 | velec = _mm_andnot_ps(dummy_mask,velec); |
957 | velecsum = _mm_add_ps(velecsum,velec); |
958 | |
959 | fscal = felec; |
960 | |
961 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
962 | |
963 | /* Calculate temporary vectorial force */ |
964 | tx = _mm_mul_ps(fscal,dx32); |
965 | ty = _mm_mul_ps(fscal,dy32); |
966 | tz = _mm_mul_ps(fscal,dz32); |
967 | |
968 | /* Update vectorial force */ |
969 | fix3 = _mm_add_ps(fix3,tx); |
970 | fiy3 = _mm_add_ps(fiy3,ty); |
971 | fiz3 = _mm_add_ps(fiz3,tz); |
972 | |
973 | fjx2 = _mm_add_ps(fjx2,tx); |
974 | fjy2 = _mm_add_ps(fjy2,ty); |
975 | fjz2 = _mm_add_ps(fjz2,tz); |
976 | |
977 | /************************** |
978 | * CALCULATE INTERACTIONS * |
979 | **************************/ |
980 | |
981 | /* COULOMB ELECTROSTATICS */ |
982 | velec = _mm_mul_ps(qq33,rinv33); |
983 | felec = _mm_mul_ps(velec,rinvsq33); |
984 | |
985 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
986 | velec = _mm_andnot_ps(dummy_mask,velec); |
987 | velecsum = _mm_add_ps(velecsum,velec); |
988 | |
989 | fscal = felec; |
990 | |
991 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
992 | |
993 | /* Calculate temporary vectorial force */ |
994 | tx = _mm_mul_ps(fscal,dx33); |
995 | ty = _mm_mul_ps(fscal,dy33); |
996 | tz = _mm_mul_ps(fscal,dz33); |
997 | |
998 | /* Update vectorial force */ |
999 | fix3 = _mm_add_ps(fix3,tx); |
1000 | fiy3 = _mm_add_ps(fiy3,ty); |
1001 | fiz3 = _mm_add_ps(fiz3,tz); |
1002 | |
1003 | fjx3 = _mm_add_ps(fjx3,tx); |
1004 | fjy3 = _mm_add_ps(fjy3,ty); |
1005 | fjz3 = _mm_add_ps(fjz3,tz); |
1006 | |
1007 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
1008 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
1009 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
1010 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
1011 | |
1012 | gmx_mm_decrement_4rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD, |
1013 | fjx0,fjy0,fjz0,fjx1,fjy1,fjz1, |
1014 | fjx2,fjy2,fjz2,fjx3,fjy3,fjz3); |
1015 | |
1016 | /* Inner loop uses 287 flops */ |
1017 | } |
1018 | |
1019 | /* End of innermost loop */ |
1020 | |
1021 | gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3, |
1022 | f+i_coord_offset,fshift+i_shift_offset); |
1023 | |
1024 | ggid = gid[iidx]; |
1025 | /* Update potential energies */ |
1026 | gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid); |
1027 | gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid); |
1028 | |
1029 | /* Increment number of inner iterations */ |
1030 | inneriter += j_index_end - j_index_start; |
1031 | |
1032 | /* Outer loop uses 26 flops */ |
1033 | } |
1034 | |
1035 | /* Increment number of outer iterations */ |
1036 | outeriter += nri; |
1037 | |
1038 | /* Update outer/inner flops */ |
1039 | |
1040 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*26 + inneriter*287)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_VF] += outeriter*26 + inneriter*287; |
1041 | } |
1042 | /* |
1043 | * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwLJ_GeomW4W4_F_sse4_1_single |
1044 | * Electrostatics interaction: Coulomb |
1045 | * VdW interaction: LennardJones |
1046 | * Geometry: Water4-Water4 |
1047 | * Calculate force/pot: Force |
1048 | */ |
1049 | void |
1050 | nb_kernel_ElecCoul_VdwLJ_GeomW4W4_F_sse4_1_single |
1051 | (t_nblist * gmx_restrict nlist, |
1052 | rvec * gmx_restrict xx, |
1053 | rvec * gmx_restrict ff, |
1054 | t_forcerec * gmx_restrict fr, |
1055 | t_mdatoms * gmx_restrict mdatoms, |
1056 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data, |
1057 | t_nrnb * gmx_restrict nrnb) |
1058 | { |
1059 | /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or |
1060 | * just 0 for non-waters. |
1061 | * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different |
1062 | * jnr indices corresponding to data put in the four positions in the SIMD register. |
1063 | */ |
1064 | int i_shift_offset,i_coord_offset,outeriter,inneriter; |
1065 | int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx; |
1066 | int jnrA,jnrB,jnrC,jnrD; |
1067 | int jnrlistA,jnrlistB,jnrlistC,jnrlistD; |
1068 | int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD; |
1069 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
1070 | real rcutoff_scalar; |
1071 | real *shiftvec,*fshift,*x,*f; |
1072 | real *fjptrA,*fjptrB,*fjptrC,*fjptrD; |
1073 | real scratch[4*DIM3]; |
1074 | __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall; |
1075 | int vdwioffset0; |
1076 | __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
1077 | int vdwioffset1; |
1078 | __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1; |
1079 | int vdwioffset2; |
1080 | __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2; |
1081 | int vdwioffset3; |
1082 | __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3; |
1083 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
1084 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
1085 | int vdwjidx1A,vdwjidx1B,vdwjidx1C,vdwjidx1D; |
1086 | __m128 jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1; |
1087 | int vdwjidx2A,vdwjidx2B,vdwjidx2C,vdwjidx2D; |
1088 | __m128 jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2; |
1089 | int vdwjidx3A,vdwjidx3B,vdwjidx3C,vdwjidx3D; |
1090 | __m128 jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3; |
1091 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
1092 | __m128 dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11; |
1093 | __m128 dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12; |
1094 | __m128 dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13; |
1095 | __m128 dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21; |
1096 | __m128 dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22; |
1097 | __m128 dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23; |
1098 | __m128 dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31; |
1099 | __m128 dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32; |
1100 | __m128 dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33; |
1101 | __m128 velec,felec,velecsum,facel,crf,krf,krf2; |
1102 | real *charge; |
1103 | int nvdwtype; |
1104 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
1105 | int *vdwtype; |
1106 | real *vdwparam; |
1107 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
1108 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
1109 | __m128 dummy_mask,cutoff_mask; |
1110 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
1111 | __m128 one = _mm_set1_ps(1.0); |
1112 | __m128 two = _mm_set1_ps(2.0); |
1113 | x = xx[0]; |
1114 | f = ff[0]; |
1115 | |
1116 | nri = nlist->nri; |
1117 | iinr = nlist->iinr; |
1118 | jindex = nlist->jindex; |
1119 | jjnr = nlist->jjnr; |
1120 | shiftidx = nlist->shift; |
1121 | gid = nlist->gid; |
1122 | shiftvec = fr->shift_vec[0]; |
1123 | fshift = fr->fshift[0]; |
1124 | facel = _mm_set1_ps(fr->epsfac); |
1125 | charge = mdatoms->chargeA; |
1126 | nvdwtype = fr->ntype; |
1127 | vdwparam = fr->nbfp; |
1128 | vdwtype = mdatoms->typeA; |
1129 | |
1130 | /* Setup water-specific parameters */ |
1131 | inr = nlist->iinr[0]; |
1132 | iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1])); |
1133 | iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2])); |
1134 | iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3])); |
1135 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
1136 | |
1137 | jq1 = _mm_set1_ps(charge[inr+1]); |
1138 | jq2 = _mm_set1_ps(charge[inr+2]); |
1139 | jq3 = _mm_set1_ps(charge[inr+3]); |
1140 | vdwjidx0A = 2*vdwtype[inr+0]; |
1141 | c6_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A]); |
1142 | c12_00 = _mm_set1_ps(vdwparam[vdwioffset0+vdwjidx0A+1]); |
1143 | qq11 = _mm_mul_ps(iq1,jq1); |
1144 | qq12 = _mm_mul_ps(iq1,jq2); |
1145 | qq13 = _mm_mul_ps(iq1,jq3); |
1146 | qq21 = _mm_mul_ps(iq2,jq1); |
1147 | qq22 = _mm_mul_ps(iq2,jq2); |
1148 | qq23 = _mm_mul_ps(iq2,jq3); |
1149 | qq31 = _mm_mul_ps(iq3,jq1); |
1150 | qq32 = _mm_mul_ps(iq3,jq2); |
1151 | qq33 = _mm_mul_ps(iq3,jq3); |
1152 | |
1153 | /* Avoid stupid compiler warnings */ |
1154 | jnrA = jnrB = jnrC = jnrD = 0; |
1155 | j_coord_offsetA = 0; |
1156 | j_coord_offsetB = 0; |
1157 | j_coord_offsetC = 0; |
1158 | j_coord_offsetD = 0; |
1159 | |
1160 | outeriter = 0; |
1161 | inneriter = 0; |
1162 | |
1163 | for(iidx=0;iidx<4*DIM3;iidx++) |
1164 | { |
1165 | scratch[iidx] = 0.0; |
1166 | } |
1167 | |
1168 | /* Start outer loop over neighborlists */ |
1169 | for(iidx=0; iidx<nri; iidx++) |
1170 | { |
1171 | /* Load shift vector for this list */ |
1172 | i_shift_offset = DIM3*shiftidx[iidx]; |
1173 | |
1174 | /* Load limits for loop over neighbors */ |
1175 | j_index_start = jindex[iidx]; |
1176 | j_index_end = jindex[iidx+1]; |
1177 | |
1178 | /* Get outer coordinate index */ |
1179 | inr = iinr[iidx]; |
1180 | i_coord_offset = DIM3*inr; |
1181 | |
1182 | /* Load i particle coords and add shift vector */ |
1183 | gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset, |
1184 | &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3); |
1185 | |
1186 | fix0 = _mm_setzero_ps(); |
1187 | fiy0 = _mm_setzero_ps(); |
1188 | fiz0 = _mm_setzero_ps(); |
1189 | fix1 = _mm_setzero_ps(); |
1190 | fiy1 = _mm_setzero_ps(); |
1191 | fiz1 = _mm_setzero_ps(); |
1192 | fix2 = _mm_setzero_ps(); |
1193 | fiy2 = _mm_setzero_ps(); |
1194 | fiz2 = _mm_setzero_ps(); |
1195 | fix3 = _mm_setzero_ps(); |
1196 | fiy3 = _mm_setzero_ps(); |
1197 | fiz3 = _mm_setzero_ps(); |
1198 | |
1199 | /* Start inner kernel loop */ |
1200 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
1201 | { |
1202 | |
1203 | /* Get j neighbor index, and coordinate index */ |
1204 | jnrA = jjnr[jidx]; |
1205 | jnrB = jjnr[jidx+1]; |
1206 | jnrC = jjnr[jidx+2]; |
1207 | jnrD = jjnr[jidx+3]; |
1208 | j_coord_offsetA = DIM3*jnrA; |
1209 | j_coord_offsetB = DIM3*jnrB; |
1210 | j_coord_offsetC = DIM3*jnrC; |
1211 | j_coord_offsetD = DIM3*jnrD; |
1212 | |
1213 | /* load j atom coordinates */ |
1214 | gmx_mm_load_4rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
1215 | x+j_coord_offsetC,x+j_coord_offsetD, |
1216 | &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2, |
1217 | &jy2,&jz2,&jx3,&jy3,&jz3); |
1218 | |
1219 | /* Calculate displacement vector */ |
1220 | dx00 = _mm_sub_ps(ix0,jx0); |
1221 | dy00 = _mm_sub_ps(iy0,jy0); |
1222 | dz00 = _mm_sub_ps(iz0,jz0); |
1223 | dx11 = _mm_sub_ps(ix1,jx1); |
1224 | dy11 = _mm_sub_ps(iy1,jy1); |
1225 | dz11 = _mm_sub_ps(iz1,jz1); |
1226 | dx12 = _mm_sub_ps(ix1,jx2); |
1227 | dy12 = _mm_sub_ps(iy1,jy2); |
1228 | dz12 = _mm_sub_ps(iz1,jz2); |
1229 | dx13 = _mm_sub_ps(ix1,jx3); |
1230 | dy13 = _mm_sub_ps(iy1,jy3); |
1231 | dz13 = _mm_sub_ps(iz1,jz3); |
1232 | dx21 = _mm_sub_ps(ix2,jx1); |
1233 | dy21 = _mm_sub_ps(iy2,jy1); |
1234 | dz21 = _mm_sub_ps(iz2,jz1); |
1235 | dx22 = _mm_sub_ps(ix2,jx2); |
1236 | dy22 = _mm_sub_ps(iy2,jy2); |
1237 | dz22 = _mm_sub_ps(iz2,jz2); |
1238 | dx23 = _mm_sub_ps(ix2,jx3); |
1239 | dy23 = _mm_sub_ps(iy2,jy3); |
1240 | dz23 = _mm_sub_ps(iz2,jz3); |
1241 | dx31 = _mm_sub_ps(ix3,jx1); |
1242 | dy31 = _mm_sub_ps(iy3,jy1); |
1243 | dz31 = _mm_sub_ps(iz3,jz1); |
1244 | dx32 = _mm_sub_ps(ix3,jx2); |
1245 | dy32 = _mm_sub_ps(iy3,jy2); |
1246 | dz32 = _mm_sub_ps(iz3,jz2); |
1247 | dx33 = _mm_sub_ps(ix3,jx3); |
1248 | dy33 = _mm_sub_ps(iy3,jy3); |
1249 | dz33 = _mm_sub_ps(iz3,jz3); |
1250 | |
1251 | /* Calculate squared distance and things based on it */ |
1252 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
1253 | rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11); |
1254 | rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12); |
1255 | rsq13 = gmx_mm_calc_rsq_ps(dx13,dy13,dz13); |
1256 | rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21); |
1257 | rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22); |
1258 | rsq23 = gmx_mm_calc_rsq_ps(dx23,dy23,dz23); |
1259 | rsq31 = gmx_mm_calc_rsq_ps(dx31,dy31,dz31); |
1260 | rsq32 = gmx_mm_calc_rsq_ps(dx32,dy32,dz32); |
1261 | rsq33 = gmx_mm_calc_rsq_ps(dx33,dy33,dz33); |
1262 | |
1263 | rinv11 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq11); |
1264 | rinv12 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq12); |
1265 | rinv13 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq13); |
1266 | rinv21 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq21); |
1267 | rinv22 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq22); |
1268 | rinv23 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq23); |
1269 | rinv31 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq31); |
1270 | rinv32 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq32); |
1271 | rinv33 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq33); |
1272 | |
1273 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
1274 | rinvsq11 = _mm_mul_ps(rinv11,rinv11); |
1275 | rinvsq12 = _mm_mul_ps(rinv12,rinv12); |
1276 | rinvsq13 = _mm_mul_ps(rinv13,rinv13); |
1277 | rinvsq21 = _mm_mul_ps(rinv21,rinv21); |
1278 | rinvsq22 = _mm_mul_ps(rinv22,rinv22); |
1279 | rinvsq23 = _mm_mul_ps(rinv23,rinv23); |
1280 | rinvsq31 = _mm_mul_ps(rinv31,rinv31); |
1281 | rinvsq32 = _mm_mul_ps(rinv32,rinv32); |
1282 | rinvsq33 = _mm_mul_ps(rinv33,rinv33); |
1283 | |
1284 | fjx0 = _mm_setzero_ps(); |
1285 | fjy0 = _mm_setzero_ps(); |
1286 | fjz0 = _mm_setzero_ps(); |
1287 | fjx1 = _mm_setzero_ps(); |
1288 | fjy1 = _mm_setzero_ps(); |
1289 | fjz1 = _mm_setzero_ps(); |
1290 | fjx2 = _mm_setzero_ps(); |
1291 | fjy2 = _mm_setzero_ps(); |
1292 | fjz2 = _mm_setzero_ps(); |
1293 | fjx3 = _mm_setzero_ps(); |
1294 | fjy3 = _mm_setzero_ps(); |
1295 | fjz3 = _mm_setzero_ps(); |
1296 | |
1297 | /************************** |
1298 | * CALCULATE INTERACTIONS * |
1299 | **************************/ |
1300 | |
1301 | /* LENNARD-JONES DISPERSION/REPULSION */ |
1302 | |
1303 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
1304 | fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00)); |
1305 | |
1306 | fscal = fvdw; |
1307 | |
1308 | /* Calculate temporary vectorial force */ |
1309 | tx = _mm_mul_ps(fscal,dx00); |
1310 | ty = _mm_mul_ps(fscal,dy00); |
1311 | tz = _mm_mul_ps(fscal,dz00); |
1312 | |
1313 | /* Update vectorial force */ |
1314 | fix0 = _mm_add_ps(fix0,tx); |
1315 | fiy0 = _mm_add_ps(fiy0,ty); |
1316 | fiz0 = _mm_add_ps(fiz0,tz); |
1317 | |
1318 | fjx0 = _mm_add_ps(fjx0,tx); |
1319 | fjy0 = _mm_add_ps(fjy0,ty); |
1320 | fjz0 = _mm_add_ps(fjz0,tz); |
1321 | |
1322 | /************************** |
1323 | * CALCULATE INTERACTIONS * |
1324 | **************************/ |
1325 | |
1326 | /* COULOMB ELECTROSTATICS */ |
1327 | velec = _mm_mul_ps(qq11,rinv11); |
1328 | felec = _mm_mul_ps(velec,rinvsq11); |
1329 | |
1330 | fscal = felec; |
1331 | |
1332 | /* Calculate temporary vectorial force */ |
1333 | tx = _mm_mul_ps(fscal,dx11); |
1334 | ty = _mm_mul_ps(fscal,dy11); |
1335 | tz = _mm_mul_ps(fscal,dz11); |
1336 | |
1337 | /* Update vectorial force */ |
1338 | fix1 = _mm_add_ps(fix1,tx); |
1339 | fiy1 = _mm_add_ps(fiy1,ty); |
1340 | fiz1 = _mm_add_ps(fiz1,tz); |
1341 | |
1342 | fjx1 = _mm_add_ps(fjx1,tx); |
1343 | fjy1 = _mm_add_ps(fjy1,ty); |
1344 | fjz1 = _mm_add_ps(fjz1,tz); |
1345 | |
1346 | /************************** |
1347 | * CALCULATE INTERACTIONS * |
1348 | **************************/ |
1349 | |
1350 | /* COULOMB ELECTROSTATICS */ |
1351 | velec = _mm_mul_ps(qq12,rinv12); |
1352 | felec = _mm_mul_ps(velec,rinvsq12); |
1353 | |
1354 | fscal = felec; |
1355 | |
1356 | /* Calculate temporary vectorial force */ |
1357 | tx = _mm_mul_ps(fscal,dx12); |
1358 | ty = _mm_mul_ps(fscal,dy12); |
1359 | tz = _mm_mul_ps(fscal,dz12); |
1360 | |
1361 | /* Update vectorial force */ |
1362 | fix1 = _mm_add_ps(fix1,tx); |
1363 | fiy1 = _mm_add_ps(fiy1,ty); |
1364 | fiz1 = _mm_add_ps(fiz1,tz); |
1365 | |
1366 | fjx2 = _mm_add_ps(fjx2,tx); |
1367 | fjy2 = _mm_add_ps(fjy2,ty); |
1368 | fjz2 = _mm_add_ps(fjz2,tz); |
1369 | |
1370 | /************************** |
1371 | * CALCULATE INTERACTIONS * |
1372 | **************************/ |
1373 | |
1374 | /* COULOMB ELECTROSTATICS */ |
1375 | velec = _mm_mul_ps(qq13,rinv13); |
1376 | felec = _mm_mul_ps(velec,rinvsq13); |
1377 | |
1378 | fscal = felec; |
1379 | |
1380 | /* Calculate temporary vectorial force */ |
1381 | tx = _mm_mul_ps(fscal,dx13); |
1382 | ty = _mm_mul_ps(fscal,dy13); |
1383 | tz = _mm_mul_ps(fscal,dz13); |
1384 | |
1385 | /* Update vectorial force */ |
1386 | fix1 = _mm_add_ps(fix1,tx); |
1387 | fiy1 = _mm_add_ps(fiy1,ty); |
1388 | fiz1 = _mm_add_ps(fiz1,tz); |
1389 | |
1390 | fjx3 = _mm_add_ps(fjx3,tx); |
1391 | fjy3 = _mm_add_ps(fjy3,ty); |
1392 | fjz3 = _mm_add_ps(fjz3,tz); |
1393 | |
1394 | /************************** |
1395 | * CALCULATE INTERACTIONS * |
1396 | **************************/ |
1397 | |
1398 | /* COULOMB ELECTROSTATICS */ |
1399 | velec = _mm_mul_ps(qq21,rinv21); |
1400 | felec = _mm_mul_ps(velec,rinvsq21); |
1401 | |
1402 | fscal = felec; |
1403 | |
1404 | /* Calculate temporary vectorial force */ |
1405 | tx = _mm_mul_ps(fscal,dx21); |
1406 | ty = _mm_mul_ps(fscal,dy21); |
1407 | tz = _mm_mul_ps(fscal,dz21); |
1408 | |
1409 | /* Update vectorial force */ |
1410 | fix2 = _mm_add_ps(fix2,tx); |
1411 | fiy2 = _mm_add_ps(fiy2,ty); |
1412 | fiz2 = _mm_add_ps(fiz2,tz); |
1413 | |
1414 | fjx1 = _mm_add_ps(fjx1,tx); |
1415 | fjy1 = _mm_add_ps(fjy1,ty); |
1416 | fjz1 = _mm_add_ps(fjz1,tz); |
1417 | |
1418 | /************************** |
1419 | * CALCULATE INTERACTIONS * |
1420 | **************************/ |
1421 | |
1422 | /* COULOMB ELECTROSTATICS */ |
1423 | velec = _mm_mul_ps(qq22,rinv22); |
1424 | felec = _mm_mul_ps(velec,rinvsq22); |
1425 | |
1426 | fscal = felec; |
1427 | |
1428 | /* Calculate temporary vectorial force */ |
1429 | tx = _mm_mul_ps(fscal,dx22); |
1430 | ty = _mm_mul_ps(fscal,dy22); |
1431 | tz = _mm_mul_ps(fscal,dz22); |
1432 | |
1433 | /* Update vectorial force */ |
1434 | fix2 = _mm_add_ps(fix2,tx); |
1435 | fiy2 = _mm_add_ps(fiy2,ty); |
1436 | fiz2 = _mm_add_ps(fiz2,tz); |
1437 | |
1438 | fjx2 = _mm_add_ps(fjx2,tx); |
1439 | fjy2 = _mm_add_ps(fjy2,ty); |
1440 | fjz2 = _mm_add_ps(fjz2,tz); |
1441 | |
1442 | /************************** |
1443 | * CALCULATE INTERACTIONS * |
1444 | **************************/ |
1445 | |
1446 | /* COULOMB ELECTROSTATICS */ |
1447 | velec = _mm_mul_ps(qq23,rinv23); |
1448 | felec = _mm_mul_ps(velec,rinvsq23); |
1449 | |
1450 | fscal = felec; |
1451 | |
1452 | /* Calculate temporary vectorial force */ |
1453 | tx = _mm_mul_ps(fscal,dx23); |
1454 | ty = _mm_mul_ps(fscal,dy23); |
1455 | tz = _mm_mul_ps(fscal,dz23); |
1456 | |
1457 | /* Update vectorial force */ |
1458 | fix2 = _mm_add_ps(fix2,tx); |
1459 | fiy2 = _mm_add_ps(fiy2,ty); |
1460 | fiz2 = _mm_add_ps(fiz2,tz); |
1461 | |
1462 | fjx3 = _mm_add_ps(fjx3,tx); |
1463 | fjy3 = _mm_add_ps(fjy3,ty); |
1464 | fjz3 = _mm_add_ps(fjz3,tz); |
1465 | |
1466 | /************************** |
1467 | * CALCULATE INTERACTIONS * |
1468 | **************************/ |
1469 | |
1470 | /* COULOMB ELECTROSTATICS */ |
1471 | velec = _mm_mul_ps(qq31,rinv31); |
1472 | felec = _mm_mul_ps(velec,rinvsq31); |
1473 | |
1474 | fscal = felec; |
1475 | |
1476 | /* Calculate temporary vectorial force */ |
1477 | tx = _mm_mul_ps(fscal,dx31); |
1478 | ty = _mm_mul_ps(fscal,dy31); |
1479 | tz = _mm_mul_ps(fscal,dz31); |
1480 | |
1481 | /* Update vectorial force */ |
1482 | fix3 = _mm_add_ps(fix3,tx); |
1483 | fiy3 = _mm_add_ps(fiy3,ty); |
1484 | fiz3 = _mm_add_ps(fiz3,tz); |
1485 | |
1486 | fjx1 = _mm_add_ps(fjx1,tx); |
1487 | fjy1 = _mm_add_ps(fjy1,ty); |
1488 | fjz1 = _mm_add_ps(fjz1,tz); |
1489 | |
1490 | /************************** |
1491 | * CALCULATE INTERACTIONS * |
1492 | **************************/ |
1493 | |
1494 | /* COULOMB ELECTROSTATICS */ |
1495 | velec = _mm_mul_ps(qq32,rinv32); |
1496 | felec = _mm_mul_ps(velec,rinvsq32); |
1497 | |
1498 | fscal = felec; |
1499 | |
1500 | /* Calculate temporary vectorial force */ |
1501 | tx = _mm_mul_ps(fscal,dx32); |
1502 | ty = _mm_mul_ps(fscal,dy32); |
1503 | tz = _mm_mul_ps(fscal,dz32); |
1504 | |
1505 | /* Update vectorial force */ |
1506 | fix3 = _mm_add_ps(fix3,tx); |
1507 | fiy3 = _mm_add_ps(fiy3,ty); |
1508 | fiz3 = _mm_add_ps(fiz3,tz); |
1509 | |
1510 | fjx2 = _mm_add_ps(fjx2,tx); |
1511 | fjy2 = _mm_add_ps(fjy2,ty); |
1512 | fjz2 = _mm_add_ps(fjz2,tz); |
1513 | |
1514 | /************************** |
1515 | * CALCULATE INTERACTIONS * |
1516 | **************************/ |
1517 | |
1518 | /* COULOMB ELECTROSTATICS */ |
1519 | velec = _mm_mul_ps(qq33,rinv33); |
1520 | felec = _mm_mul_ps(velec,rinvsq33); |
1521 | |
1522 | fscal = felec; |
1523 | |
1524 | /* Calculate temporary vectorial force */ |
1525 | tx = _mm_mul_ps(fscal,dx33); |
1526 | ty = _mm_mul_ps(fscal,dy33); |
1527 | tz = _mm_mul_ps(fscal,dz33); |
1528 | |
1529 | /* Update vectorial force */ |
1530 | fix3 = _mm_add_ps(fix3,tx); |
1531 | fiy3 = _mm_add_ps(fiy3,ty); |
1532 | fiz3 = _mm_add_ps(fiz3,tz); |
1533 | |
1534 | fjx3 = _mm_add_ps(fjx3,tx); |
1535 | fjy3 = _mm_add_ps(fjy3,ty); |
1536 | fjz3 = _mm_add_ps(fjz3,tz); |
1537 | |
1538 | fjptrA = f+j_coord_offsetA; |
1539 | fjptrB = f+j_coord_offsetB; |
1540 | fjptrC = f+j_coord_offsetC; |
1541 | fjptrD = f+j_coord_offsetD; |
1542 | |
1543 | gmx_mm_decrement_4rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD, |
1544 | fjx0,fjy0,fjz0,fjx1,fjy1,fjz1, |
1545 | fjx2,fjy2,fjz2,fjx3,fjy3,fjz3); |
1546 | |
1547 | /* Inner loop uses 273 flops */ |
1548 | } |
1549 | |
1550 | if(jidx<j_index_end) |
1551 | { |
1552 | |
1553 | /* Get j neighbor index, and coordinate index */ |
1554 | jnrlistA = jjnr[jidx]; |
1555 | jnrlistB = jjnr[jidx+1]; |
1556 | jnrlistC = jjnr[jidx+2]; |
1557 | jnrlistD = jjnr[jidx+3]; |
1558 | /* Sign of each element will be negative for non-real atoms. |
1559 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
1560 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
1561 | */ |
1562 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
1563 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
1564 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
1565 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
1566 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
1567 | j_coord_offsetA = DIM3*jnrA; |
1568 | j_coord_offsetB = DIM3*jnrB; |
1569 | j_coord_offsetC = DIM3*jnrC; |
1570 | j_coord_offsetD = DIM3*jnrD; |
1571 | |
1572 | /* load j atom coordinates */ |
1573 | gmx_mm_load_4rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
1574 | x+j_coord_offsetC,x+j_coord_offsetD, |
1575 | &jx0,&jy0,&jz0,&jx1,&jy1,&jz1,&jx2, |
1576 | &jy2,&jz2,&jx3,&jy3,&jz3); |
1577 | |
1578 | /* Calculate displacement vector */ |
1579 | dx00 = _mm_sub_ps(ix0,jx0); |
1580 | dy00 = _mm_sub_ps(iy0,jy0); |
1581 | dz00 = _mm_sub_ps(iz0,jz0); |
1582 | dx11 = _mm_sub_ps(ix1,jx1); |
1583 | dy11 = _mm_sub_ps(iy1,jy1); |
1584 | dz11 = _mm_sub_ps(iz1,jz1); |
1585 | dx12 = _mm_sub_ps(ix1,jx2); |
1586 | dy12 = _mm_sub_ps(iy1,jy2); |
1587 | dz12 = _mm_sub_ps(iz1,jz2); |
1588 | dx13 = _mm_sub_ps(ix1,jx3); |
1589 | dy13 = _mm_sub_ps(iy1,jy3); |
1590 | dz13 = _mm_sub_ps(iz1,jz3); |
1591 | dx21 = _mm_sub_ps(ix2,jx1); |
1592 | dy21 = _mm_sub_ps(iy2,jy1); |
1593 | dz21 = _mm_sub_ps(iz2,jz1); |
1594 | dx22 = _mm_sub_ps(ix2,jx2); |
1595 | dy22 = _mm_sub_ps(iy2,jy2); |
1596 | dz22 = _mm_sub_ps(iz2,jz2); |
1597 | dx23 = _mm_sub_ps(ix2,jx3); |
1598 | dy23 = _mm_sub_ps(iy2,jy3); |
1599 | dz23 = _mm_sub_ps(iz2,jz3); |
1600 | dx31 = _mm_sub_ps(ix3,jx1); |
1601 | dy31 = _mm_sub_ps(iy3,jy1); |
1602 | dz31 = _mm_sub_ps(iz3,jz1); |
1603 | dx32 = _mm_sub_ps(ix3,jx2); |
1604 | dy32 = _mm_sub_ps(iy3,jy2); |
1605 | dz32 = _mm_sub_ps(iz3,jz2); |
1606 | dx33 = _mm_sub_ps(ix3,jx3); |
1607 | dy33 = _mm_sub_ps(iy3,jy3); |
1608 | dz33 = _mm_sub_ps(iz3,jz3); |
1609 | |
1610 | /* Calculate squared distance and things based on it */ |
1611 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
1612 | rsq11 = gmx_mm_calc_rsq_ps(dx11,dy11,dz11); |
1613 | rsq12 = gmx_mm_calc_rsq_ps(dx12,dy12,dz12); |
1614 | rsq13 = gmx_mm_calc_rsq_ps(dx13,dy13,dz13); |
1615 | rsq21 = gmx_mm_calc_rsq_ps(dx21,dy21,dz21); |
1616 | rsq22 = gmx_mm_calc_rsq_ps(dx22,dy22,dz22); |
1617 | rsq23 = gmx_mm_calc_rsq_ps(dx23,dy23,dz23); |
1618 | rsq31 = gmx_mm_calc_rsq_ps(dx31,dy31,dz31); |
1619 | rsq32 = gmx_mm_calc_rsq_ps(dx32,dy32,dz32); |
1620 | rsq33 = gmx_mm_calc_rsq_ps(dx33,dy33,dz33); |
1621 | |
1622 | rinv11 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq11); |
1623 | rinv12 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq12); |
1624 | rinv13 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq13); |
1625 | rinv21 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq21); |
1626 | rinv22 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq22); |
1627 | rinv23 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq23); |
1628 | rinv31 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq31); |
1629 | rinv32 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq32); |
1630 | rinv33 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq33); |
1631 | |
1632 | rinvsq00 = gmx_mm_inv_psgmx_simd_inv_f(rsq00); |
1633 | rinvsq11 = _mm_mul_ps(rinv11,rinv11); |
1634 | rinvsq12 = _mm_mul_ps(rinv12,rinv12); |
1635 | rinvsq13 = _mm_mul_ps(rinv13,rinv13); |
1636 | rinvsq21 = _mm_mul_ps(rinv21,rinv21); |
1637 | rinvsq22 = _mm_mul_ps(rinv22,rinv22); |
1638 | rinvsq23 = _mm_mul_ps(rinv23,rinv23); |
1639 | rinvsq31 = _mm_mul_ps(rinv31,rinv31); |
1640 | rinvsq32 = _mm_mul_ps(rinv32,rinv32); |
1641 | rinvsq33 = _mm_mul_ps(rinv33,rinv33); |
1642 | |
1643 | fjx0 = _mm_setzero_ps(); |
1644 | fjy0 = _mm_setzero_ps(); |
1645 | fjz0 = _mm_setzero_ps(); |
1646 | fjx1 = _mm_setzero_ps(); |
1647 | fjy1 = _mm_setzero_ps(); |
1648 | fjz1 = _mm_setzero_ps(); |
1649 | fjx2 = _mm_setzero_ps(); |
1650 | fjy2 = _mm_setzero_ps(); |
1651 | fjz2 = _mm_setzero_ps(); |
1652 | fjx3 = _mm_setzero_ps(); |
1653 | fjy3 = _mm_setzero_ps(); |
1654 | fjz3 = _mm_setzero_ps(); |
1655 | |
1656 | /************************** |
1657 | * CALCULATE INTERACTIONS * |
1658 | **************************/ |
1659 | |
1660 | /* LENNARD-JONES DISPERSION/REPULSION */ |
1661 | |
1662 | rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00); |
1663 | fvdw = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(c12_00,rinvsix),c6_00),_mm_mul_ps(rinvsix,rinvsq00)); |
1664 | |
1665 | fscal = fvdw; |
1666 | |
1667 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1668 | |
1669 | /* Calculate temporary vectorial force */ |
1670 | tx = _mm_mul_ps(fscal,dx00); |
1671 | ty = _mm_mul_ps(fscal,dy00); |
1672 | tz = _mm_mul_ps(fscal,dz00); |
1673 | |
1674 | /* Update vectorial force */ |
1675 | fix0 = _mm_add_ps(fix0,tx); |
1676 | fiy0 = _mm_add_ps(fiy0,ty); |
1677 | fiz0 = _mm_add_ps(fiz0,tz); |
1678 | |
1679 | fjx0 = _mm_add_ps(fjx0,tx); |
1680 | fjy0 = _mm_add_ps(fjy0,ty); |
1681 | fjz0 = _mm_add_ps(fjz0,tz); |
1682 | |
1683 | /************************** |
1684 | * CALCULATE INTERACTIONS * |
1685 | **************************/ |
1686 | |
1687 | /* COULOMB ELECTROSTATICS */ |
1688 | velec = _mm_mul_ps(qq11,rinv11); |
1689 | felec = _mm_mul_ps(velec,rinvsq11); |
1690 | |
1691 | fscal = felec; |
1692 | |
1693 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1694 | |
1695 | /* Calculate temporary vectorial force */ |
1696 | tx = _mm_mul_ps(fscal,dx11); |
1697 | ty = _mm_mul_ps(fscal,dy11); |
1698 | tz = _mm_mul_ps(fscal,dz11); |
1699 | |
1700 | /* Update vectorial force */ |
1701 | fix1 = _mm_add_ps(fix1,tx); |
1702 | fiy1 = _mm_add_ps(fiy1,ty); |
1703 | fiz1 = _mm_add_ps(fiz1,tz); |
1704 | |
1705 | fjx1 = _mm_add_ps(fjx1,tx); |
1706 | fjy1 = _mm_add_ps(fjy1,ty); |
1707 | fjz1 = _mm_add_ps(fjz1,tz); |
1708 | |
1709 | /************************** |
1710 | * CALCULATE INTERACTIONS * |
1711 | **************************/ |
1712 | |
1713 | /* COULOMB ELECTROSTATICS */ |
1714 | velec = _mm_mul_ps(qq12,rinv12); |
1715 | felec = _mm_mul_ps(velec,rinvsq12); |
1716 | |
1717 | fscal = felec; |
1718 | |
1719 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1720 | |
1721 | /* Calculate temporary vectorial force */ |
1722 | tx = _mm_mul_ps(fscal,dx12); |
1723 | ty = _mm_mul_ps(fscal,dy12); |
1724 | tz = _mm_mul_ps(fscal,dz12); |
1725 | |
1726 | /* Update vectorial force */ |
1727 | fix1 = _mm_add_ps(fix1,tx); |
1728 | fiy1 = _mm_add_ps(fiy1,ty); |
1729 | fiz1 = _mm_add_ps(fiz1,tz); |
1730 | |
1731 | fjx2 = _mm_add_ps(fjx2,tx); |
1732 | fjy2 = _mm_add_ps(fjy2,ty); |
1733 | fjz2 = _mm_add_ps(fjz2,tz); |
1734 | |
1735 | /************************** |
1736 | * CALCULATE INTERACTIONS * |
1737 | **************************/ |
1738 | |
1739 | /* COULOMB ELECTROSTATICS */ |
1740 | velec = _mm_mul_ps(qq13,rinv13); |
1741 | felec = _mm_mul_ps(velec,rinvsq13); |
1742 | |
1743 | fscal = felec; |
1744 | |
1745 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1746 | |
1747 | /* Calculate temporary vectorial force */ |
1748 | tx = _mm_mul_ps(fscal,dx13); |
1749 | ty = _mm_mul_ps(fscal,dy13); |
1750 | tz = _mm_mul_ps(fscal,dz13); |
1751 | |
1752 | /* Update vectorial force */ |
1753 | fix1 = _mm_add_ps(fix1,tx); |
1754 | fiy1 = _mm_add_ps(fiy1,ty); |
1755 | fiz1 = _mm_add_ps(fiz1,tz); |
1756 | |
1757 | fjx3 = _mm_add_ps(fjx3,tx); |
1758 | fjy3 = _mm_add_ps(fjy3,ty); |
1759 | fjz3 = _mm_add_ps(fjz3,tz); |
1760 | |
1761 | /************************** |
1762 | * CALCULATE INTERACTIONS * |
1763 | **************************/ |
1764 | |
1765 | /* COULOMB ELECTROSTATICS */ |
1766 | velec = _mm_mul_ps(qq21,rinv21); |
1767 | felec = _mm_mul_ps(velec,rinvsq21); |
1768 | |
1769 | fscal = felec; |
1770 | |
1771 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1772 | |
1773 | /* Calculate temporary vectorial force */ |
1774 | tx = _mm_mul_ps(fscal,dx21); |
1775 | ty = _mm_mul_ps(fscal,dy21); |
1776 | tz = _mm_mul_ps(fscal,dz21); |
1777 | |
1778 | /* Update vectorial force */ |
1779 | fix2 = _mm_add_ps(fix2,tx); |
1780 | fiy2 = _mm_add_ps(fiy2,ty); |
1781 | fiz2 = _mm_add_ps(fiz2,tz); |
1782 | |
1783 | fjx1 = _mm_add_ps(fjx1,tx); |
1784 | fjy1 = _mm_add_ps(fjy1,ty); |
1785 | fjz1 = _mm_add_ps(fjz1,tz); |
1786 | |
1787 | /************************** |
1788 | * CALCULATE INTERACTIONS * |
1789 | **************************/ |
1790 | |
1791 | /* COULOMB ELECTROSTATICS */ |
1792 | velec = _mm_mul_ps(qq22,rinv22); |
1793 | felec = _mm_mul_ps(velec,rinvsq22); |
1794 | |
1795 | fscal = felec; |
1796 | |
1797 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1798 | |
1799 | /* Calculate temporary vectorial force */ |
1800 | tx = _mm_mul_ps(fscal,dx22); |
1801 | ty = _mm_mul_ps(fscal,dy22); |
1802 | tz = _mm_mul_ps(fscal,dz22); |
1803 | |
1804 | /* Update vectorial force */ |
1805 | fix2 = _mm_add_ps(fix2,tx); |
1806 | fiy2 = _mm_add_ps(fiy2,ty); |
1807 | fiz2 = _mm_add_ps(fiz2,tz); |
1808 | |
1809 | fjx2 = _mm_add_ps(fjx2,tx); |
1810 | fjy2 = _mm_add_ps(fjy2,ty); |
1811 | fjz2 = _mm_add_ps(fjz2,tz); |
1812 | |
1813 | /************************** |
1814 | * CALCULATE INTERACTIONS * |
1815 | **************************/ |
1816 | |
1817 | /* COULOMB ELECTROSTATICS */ |
1818 | velec = _mm_mul_ps(qq23,rinv23); |
1819 | felec = _mm_mul_ps(velec,rinvsq23); |
1820 | |
1821 | fscal = felec; |
1822 | |
1823 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1824 | |
1825 | /* Calculate temporary vectorial force */ |
1826 | tx = _mm_mul_ps(fscal,dx23); |
1827 | ty = _mm_mul_ps(fscal,dy23); |
1828 | tz = _mm_mul_ps(fscal,dz23); |
1829 | |
1830 | /* Update vectorial force */ |
1831 | fix2 = _mm_add_ps(fix2,tx); |
1832 | fiy2 = _mm_add_ps(fiy2,ty); |
1833 | fiz2 = _mm_add_ps(fiz2,tz); |
1834 | |
1835 | fjx3 = _mm_add_ps(fjx3,tx); |
1836 | fjy3 = _mm_add_ps(fjy3,ty); |
1837 | fjz3 = _mm_add_ps(fjz3,tz); |
1838 | |
1839 | /************************** |
1840 | * CALCULATE INTERACTIONS * |
1841 | **************************/ |
1842 | |
1843 | /* COULOMB ELECTROSTATICS */ |
1844 | velec = _mm_mul_ps(qq31,rinv31); |
1845 | felec = _mm_mul_ps(velec,rinvsq31); |
1846 | |
1847 | fscal = felec; |
1848 | |
1849 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1850 | |
1851 | /* Calculate temporary vectorial force */ |
1852 | tx = _mm_mul_ps(fscal,dx31); |
1853 | ty = _mm_mul_ps(fscal,dy31); |
1854 | tz = _mm_mul_ps(fscal,dz31); |
1855 | |
1856 | /* Update vectorial force */ |
1857 | fix3 = _mm_add_ps(fix3,tx); |
1858 | fiy3 = _mm_add_ps(fiy3,ty); |
1859 | fiz3 = _mm_add_ps(fiz3,tz); |
1860 | |
1861 | fjx1 = _mm_add_ps(fjx1,tx); |
1862 | fjy1 = _mm_add_ps(fjy1,ty); |
1863 | fjz1 = _mm_add_ps(fjz1,tz); |
1864 | |
1865 | /************************** |
1866 | * CALCULATE INTERACTIONS * |
1867 | **************************/ |
1868 | |
1869 | /* COULOMB ELECTROSTATICS */ |
1870 | velec = _mm_mul_ps(qq32,rinv32); |
1871 | felec = _mm_mul_ps(velec,rinvsq32); |
1872 | |
1873 | fscal = felec; |
1874 | |
1875 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1876 | |
1877 | /* Calculate temporary vectorial force */ |
1878 | tx = _mm_mul_ps(fscal,dx32); |
1879 | ty = _mm_mul_ps(fscal,dy32); |
1880 | tz = _mm_mul_ps(fscal,dz32); |
1881 | |
1882 | /* Update vectorial force */ |
1883 | fix3 = _mm_add_ps(fix3,tx); |
1884 | fiy3 = _mm_add_ps(fiy3,ty); |
1885 | fiz3 = _mm_add_ps(fiz3,tz); |
1886 | |
1887 | fjx2 = _mm_add_ps(fjx2,tx); |
1888 | fjy2 = _mm_add_ps(fjy2,ty); |
1889 | fjz2 = _mm_add_ps(fjz2,tz); |
1890 | |
1891 | /************************** |
1892 | * CALCULATE INTERACTIONS * |
1893 | **************************/ |
1894 | |
1895 | /* COULOMB ELECTROSTATICS */ |
1896 | velec = _mm_mul_ps(qq33,rinv33); |
1897 | felec = _mm_mul_ps(velec,rinvsq33); |
1898 | |
1899 | fscal = felec; |
1900 | |
1901 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
1902 | |
1903 | /* Calculate temporary vectorial force */ |
1904 | tx = _mm_mul_ps(fscal,dx33); |
1905 | ty = _mm_mul_ps(fscal,dy33); |
1906 | tz = _mm_mul_ps(fscal,dz33); |
1907 | |
1908 | /* Update vectorial force */ |
1909 | fix3 = _mm_add_ps(fix3,tx); |
1910 | fiy3 = _mm_add_ps(fiy3,ty); |
1911 | fiz3 = _mm_add_ps(fiz3,tz); |
1912 | |
1913 | fjx3 = _mm_add_ps(fjx3,tx); |
1914 | fjy3 = _mm_add_ps(fjy3,ty); |
1915 | fjz3 = _mm_add_ps(fjz3,tz); |
1916 | |
1917 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
1918 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
1919 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
1920 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
1921 | |
1922 | gmx_mm_decrement_4rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD, |
1923 | fjx0,fjy0,fjz0,fjx1,fjy1,fjz1, |
1924 | fjx2,fjy2,fjz2,fjx3,fjy3,fjz3); |
1925 | |
1926 | /* Inner loop uses 273 flops */ |
1927 | } |
1928 | |
1929 | /* End of innermost loop */ |
1930 | |
1931 | gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3, |
1932 | f+i_coord_offset,fshift+i_shift_offset); |
1933 | |
1934 | /* Increment number of inner iterations */ |
1935 | inneriter += j_index_end - j_index_start; |
1936 | |
1937 | /* Outer loop uses 24 flops */ |
1938 | } |
1939 | |
1940 | /* Increment number of outer iterations */ |
1941 | outeriter += nri; |
1942 | |
1943 | /* Update outer/inner flops */ |
1944 | |
1945 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*24 + inneriter*273)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4W4_F] += outeriter*24 + inneriter *273; |
1946 | } |