2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * Note: this file was generated by the GROMACS c kernel generator.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4P1_VF_c
49 * Electrostatics interaction: Ewald
50 * VdW interaction: CubicSplineTable
51 * Geometry: Water4-Particle
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_VF_c
56 (t_nblist
* gmx_restrict nlist
,
57 rvec
* gmx_restrict xx
,
58 rvec
* gmx_restrict ff
,
59 t_forcerec
* gmx_restrict fr
,
60 t_mdatoms
* gmx_restrict mdatoms
,
61 nb_kernel_data_t gmx_unused
* gmx_restrict kernel_data
,
62 t_nrnb
* gmx_restrict nrnb
)
64 int i_shift_offset
,i_coord_offset
,j_coord_offset
;
65 int j_index_start
,j_index_end
;
66 int nri
,inr
,ggid
,iidx
,jidx
,jnr
,outeriter
,inneriter
;
67 real shX
,shY
,shZ
,tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
;
68 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
69 real
*shiftvec
,*fshift
,*x
,*f
;
71 real ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
73 real ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
,iq1
,isai1
;
75 real ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
,iq2
,isai2
;
77 real ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
,iq3
,isai3
;
79 real jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
80 real dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
,cexp1_00
,cexp2_00
;
81 real dx10
,dy10
,dz10
,rsq10
,rinv10
,rinvsq10
,r10
,qq10
,c6_10
,c12_10
,cexp1_10
,cexp2_10
;
82 real dx20
,dy20
,dz20
,rsq20
,rinv20
,rinvsq20
,r20
,qq20
,c6_20
,c12_20
,cexp1_20
,cexp2_20
;
83 real dx30
,dy30
,dz30
,rsq30
,rinv30
,rinvsq30
,r30
,qq30
,c6_30
,c12_30
,cexp1_30
,cexp2_30
;
84 real velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
87 real rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,br
,vvdwexp
,sh_vdw_invrcut6
;
91 real rt
,vfeps
,vftabscale
,Y
,F
,Geps
,Heps2
,Fp
,VV
,FF
;
94 real ewtabscale
,eweps
,sh_ewald
,ewrt
,ewtabhalfspace
;
102 jindex
= nlist
->jindex
;
104 shiftidx
= nlist
->shift
;
106 shiftvec
= fr
->shift_vec
[0];
107 fshift
= fr
->fshift
[0];
109 charge
= mdatoms
->chargeA
;
110 nvdwtype
= fr
->ntype
;
112 vdwtype
= mdatoms
->typeA
;
114 vftab
= kernel_data
->table_vdw
->data
;
115 vftabscale
= kernel_data
->table_vdw
->scale
;
117 sh_ewald
= fr
->ic
->sh_ewald
;
118 ewtab
= fr
->ic
->tabq_coul_FDV0
;
119 ewtabscale
= fr
->ic
->tabq_scale
;
120 ewtabhalfspace
= 0.5/ewtabscale
;
122 /* Setup water-specific parameters */
123 inr
= nlist
->iinr
[0];
124 iq1
= facel
*charge
[inr
+1];
125 iq2
= facel
*charge
[inr
+2];
126 iq3
= facel
*charge
[inr
+3];
127 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
132 /* Start outer loop over neighborlists */
133 for(iidx
=0; iidx
<nri
; iidx
++)
135 /* Load shift vector for this list */
136 i_shift_offset
= DIM
*shiftidx
[iidx
];
137 shX
= shiftvec
[i_shift_offset
+XX
];
138 shY
= shiftvec
[i_shift_offset
+YY
];
139 shZ
= shiftvec
[i_shift_offset
+ZZ
];
141 /* Load limits for loop over neighbors */
142 j_index_start
= jindex
[iidx
];
143 j_index_end
= jindex
[iidx
+1];
145 /* Get outer coordinate index */
147 i_coord_offset
= DIM
*inr
;
149 /* Load i particle coords and add shift vector */
150 ix0
= shX
+ x
[i_coord_offset
+DIM
*0+XX
];
151 iy0
= shY
+ x
[i_coord_offset
+DIM
*0+YY
];
152 iz0
= shZ
+ x
[i_coord_offset
+DIM
*0+ZZ
];
153 ix1
= shX
+ x
[i_coord_offset
+DIM
*1+XX
];
154 iy1
= shY
+ x
[i_coord_offset
+DIM
*1+YY
];
155 iz1
= shZ
+ x
[i_coord_offset
+DIM
*1+ZZ
];
156 ix2
= shX
+ x
[i_coord_offset
+DIM
*2+XX
];
157 iy2
= shY
+ x
[i_coord_offset
+DIM
*2+YY
];
158 iz2
= shZ
+ x
[i_coord_offset
+DIM
*2+ZZ
];
159 ix3
= shX
+ x
[i_coord_offset
+DIM
*3+XX
];
160 iy3
= shY
+ x
[i_coord_offset
+DIM
*3+YY
];
161 iz3
= shZ
+ x
[i_coord_offset
+DIM
*3+ZZ
];
176 /* Reset potential sums */
180 /* Start inner kernel loop */
181 for(jidx
=j_index_start
; jidx
<j_index_end
; jidx
++)
183 /* Get j neighbor index, and coordinate index */
185 j_coord_offset
= DIM
*jnr
;
187 /* load j atom coordinates */
188 jx0
= x
[j_coord_offset
+DIM
*0+XX
];
189 jy0
= x
[j_coord_offset
+DIM
*0+YY
];
190 jz0
= x
[j_coord_offset
+DIM
*0+ZZ
];
192 /* Calculate displacement vector */
206 /* Calculate squared distance and things based on it */
207 rsq00
= dx00
*dx00
+dy00
*dy00
+dz00
*dz00
;
208 rsq10
= dx10
*dx10
+dy10
*dy10
+dz10
*dz10
;
209 rsq20
= dx20
*dx20
+dy20
*dy20
+dz20
*dz20
;
210 rsq30
= dx30
*dx30
+dy30
*dy30
+dz30
*dz30
;
212 rinv00
= gmx_invsqrt(rsq00
);
213 rinv10
= gmx_invsqrt(rsq10
);
214 rinv20
= gmx_invsqrt(rsq20
);
215 rinv30
= gmx_invsqrt(rsq30
);
217 rinvsq10
= rinv10
*rinv10
;
218 rinvsq20
= rinv20
*rinv20
;
219 rinvsq30
= rinv30
*rinv30
;
221 /* Load parameters for j particles */
223 vdwjidx0
= 2*vdwtype
[jnr
+0];
225 /**************************
226 * CALCULATE INTERACTIONS *
227 **************************/
231 c6_00
= vdwparam
[vdwioffset0
+vdwjidx0
];
232 c12_00
= vdwparam
[vdwioffset0
+vdwjidx0
+1];
234 /* Calculate table index by multiplying r with table scale and truncate to integer */
240 /* CUBIC SPLINE TABLE DISPERSION */
244 Geps
= vfeps
*vftab
[vfitab
+2];
245 Heps2
= vfeps
*vfeps
*vftab
[vfitab
+3];
249 FF
= Fp
+Geps
+2.0*Heps2
;
252 /* CUBIC SPLINE TABLE REPULSION */
255 Geps
= vfeps
*vftab
[vfitab
+6];
256 Heps2
= vfeps
*vfeps
*vftab
[vfitab
+7];
260 FF
= Fp
+Geps
+2.0*Heps2
;
263 fvdw
= -(fvdw6
+fvdw12
)*vftabscale
*rinv00
;
265 /* Update potential sums from outer loop */
270 /* Calculate temporary vectorial force */
275 /* Update vectorial force */
279 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
280 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
281 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
283 /**************************
284 * CALCULATE INTERACTIONS *
285 **************************/
291 /* EWALD ELECTROSTATICS */
293 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
294 ewrt
= r10
*ewtabscale
;
298 felec
= ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
299 velec
= qq10
*(rinv10
-(ewtab
[ewitab
+2]-ewtabhalfspace
*eweps
*(ewtab
[ewitab
]+felec
)));
300 felec
= qq10
*rinv10
*(rinvsq10
-felec
);
302 /* Update potential sums from outer loop */
307 /* Calculate temporary vectorial force */
312 /* Update vectorial force */
316 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
317 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
318 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
320 /**************************
321 * CALCULATE INTERACTIONS *
322 **************************/
328 /* EWALD ELECTROSTATICS */
330 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
331 ewrt
= r20
*ewtabscale
;
335 felec
= ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
336 velec
= qq20
*(rinv20
-(ewtab
[ewitab
+2]-ewtabhalfspace
*eweps
*(ewtab
[ewitab
]+felec
)));
337 felec
= qq20
*rinv20
*(rinvsq20
-felec
);
339 /* Update potential sums from outer loop */
344 /* Calculate temporary vectorial force */
349 /* Update vectorial force */
353 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
354 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
355 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
357 /**************************
358 * CALCULATE INTERACTIONS *
359 **************************/
365 /* EWALD ELECTROSTATICS */
367 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
368 ewrt
= r30
*ewtabscale
;
372 felec
= ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
373 velec
= qq30
*(rinv30
-(ewtab
[ewitab
+2]-ewtabhalfspace
*eweps
*(ewtab
[ewitab
]+felec
)));
374 felec
= qq30
*rinv30
*(rinvsq30
-felec
);
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
391 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
392 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
394 /* Inner loop uses 178 flops */
396 /* End of innermost loop */
399 f
[i_coord_offset
+DIM
*0+XX
] += fix0
;
400 f
[i_coord_offset
+DIM
*0+YY
] += fiy0
;
401 f
[i_coord_offset
+DIM
*0+ZZ
] += fiz0
;
405 f
[i_coord_offset
+DIM
*1+XX
] += fix1
;
406 f
[i_coord_offset
+DIM
*1+YY
] += fiy1
;
407 f
[i_coord_offset
+DIM
*1+ZZ
] += fiz1
;
411 f
[i_coord_offset
+DIM
*2+XX
] += fix2
;
412 f
[i_coord_offset
+DIM
*2+YY
] += fiy2
;
413 f
[i_coord_offset
+DIM
*2+ZZ
] += fiz2
;
417 f
[i_coord_offset
+DIM
*3+XX
] += fix3
;
418 f
[i_coord_offset
+DIM
*3+YY
] += fiy3
;
419 f
[i_coord_offset
+DIM
*3+ZZ
] += fiz3
;
423 fshift
[i_shift_offset
+XX
] += tx
;
424 fshift
[i_shift_offset
+YY
] += ty
;
425 fshift
[i_shift_offset
+ZZ
] += tz
;
428 /* Update potential energies */
429 kernel_data
->energygrp_elec
[ggid
] += velecsum
;
430 kernel_data
->energygrp_vdw
[ggid
] += vvdwsum
;
432 /* Increment number of inner iterations */
433 inneriter
+= j_index_end
- j_index_start
;
435 /* Outer loop uses 41 flops */
438 /* Increment number of outer iterations */
441 /* Update outer/inner flops */
443 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_W4_VF
,outeriter
*41 + inneriter
*178);
446 * Gromacs nonbonded kernel: nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_c
447 * Electrostatics interaction: Ewald
448 * VdW interaction: CubicSplineTable
449 * Geometry: Water4-Particle
450 * Calculate force/pot: Force
453 nb_kernel_ElecEw_VdwCSTab_GeomW4P1_F_c
454 (t_nblist
* gmx_restrict nlist
,
455 rvec
* gmx_restrict xx
,
456 rvec
* gmx_restrict ff
,
457 t_forcerec
* gmx_restrict fr
,
458 t_mdatoms
* gmx_restrict mdatoms
,
459 nb_kernel_data_t gmx_unused
* gmx_restrict kernel_data
,
460 t_nrnb
* gmx_restrict nrnb
)
462 int i_shift_offset
,i_coord_offset
,j_coord_offset
;
463 int j_index_start
,j_index_end
;
464 int nri
,inr
,ggid
,iidx
,jidx
,jnr
,outeriter
,inneriter
;
465 real shX
,shY
,shZ
,tx
,ty
,tz
,fscal
,rcutoff
,rcutoff2
;
466 int *iinr
,*jindex
,*jjnr
,*shiftidx
,*gid
;
467 real
*shiftvec
,*fshift
,*x
,*f
;
469 real ix0
,iy0
,iz0
,fix0
,fiy0
,fiz0
,iq0
,isai0
;
471 real ix1
,iy1
,iz1
,fix1
,fiy1
,fiz1
,iq1
,isai1
;
473 real ix2
,iy2
,iz2
,fix2
,fiy2
,fiz2
,iq2
,isai2
;
475 real ix3
,iy3
,iz3
,fix3
,fiy3
,fiz3
,iq3
,isai3
;
477 real jx0
,jy0
,jz0
,fjx0
,fjy0
,fjz0
,jq0
,isaj0
;
478 real dx00
,dy00
,dz00
,rsq00
,rinv00
,rinvsq00
,r00
,qq00
,c6_00
,c12_00
,cexp1_00
,cexp2_00
;
479 real dx10
,dy10
,dz10
,rsq10
,rinv10
,rinvsq10
,r10
,qq10
,c6_10
,c12_10
,cexp1_10
,cexp2_10
;
480 real dx20
,dy20
,dz20
,rsq20
,rinv20
,rinvsq20
,r20
,qq20
,c6_20
,c12_20
,cexp1_20
,cexp2_20
;
481 real dx30
,dy30
,dz30
,rsq30
,rinv30
,rinvsq30
,r30
,qq30
,c6_30
,c12_30
,cexp1_30
,cexp2_30
;
482 real velec
,felec
,velecsum
,facel
,crf
,krf
,krf2
;
485 real rinvsix
,rvdw
,vvdw
,vvdw6
,vvdw12
,fvdw
,fvdw6
,fvdw12
,vvdwsum
,br
,vvdwexp
,sh_vdw_invrcut6
;
489 real rt
,vfeps
,vftabscale
,Y
,F
,Geps
,Heps2
,Fp
,VV
,FF
;
492 real ewtabscale
,eweps
,sh_ewald
,ewrt
,ewtabhalfspace
;
500 jindex
= nlist
->jindex
;
502 shiftidx
= nlist
->shift
;
504 shiftvec
= fr
->shift_vec
[0];
505 fshift
= fr
->fshift
[0];
507 charge
= mdatoms
->chargeA
;
508 nvdwtype
= fr
->ntype
;
510 vdwtype
= mdatoms
->typeA
;
512 vftab
= kernel_data
->table_vdw
->data
;
513 vftabscale
= kernel_data
->table_vdw
->scale
;
515 sh_ewald
= fr
->ic
->sh_ewald
;
516 ewtab
= fr
->ic
->tabq_coul_F
;
517 ewtabscale
= fr
->ic
->tabq_scale
;
518 ewtabhalfspace
= 0.5/ewtabscale
;
520 /* Setup water-specific parameters */
521 inr
= nlist
->iinr
[0];
522 iq1
= facel
*charge
[inr
+1];
523 iq2
= facel
*charge
[inr
+2];
524 iq3
= facel
*charge
[inr
+3];
525 vdwioffset0
= 2*nvdwtype
*vdwtype
[inr
+0];
530 /* Start outer loop over neighborlists */
531 for(iidx
=0; iidx
<nri
; iidx
++)
533 /* Load shift vector for this list */
534 i_shift_offset
= DIM
*shiftidx
[iidx
];
535 shX
= shiftvec
[i_shift_offset
+XX
];
536 shY
= shiftvec
[i_shift_offset
+YY
];
537 shZ
= shiftvec
[i_shift_offset
+ZZ
];
539 /* Load limits for loop over neighbors */
540 j_index_start
= jindex
[iidx
];
541 j_index_end
= jindex
[iidx
+1];
543 /* Get outer coordinate index */
545 i_coord_offset
= DIM
*inr
;
547 /* Load i particle coords and add shift vector */
548 ix0
= shX
+ x
[i_coord_offset
+DIM
*0+XX
];
549 iy0
= shY
+ x
[i_coord_offset
+DIM
*0+YY
];
550 iz0
= shZ
+ x
[i_coord_offset
+DIM
*0+ZZ
];
551 ix1
= shX
+ x
[i_coord_offset
+DIM
*1+XX
];
552 iy1
= shY
+ x
[i_coord_offset
+DIM
*1+YY
];
553 iz1
= shZ
+ x
[i_coord_offset
+DIM
*1+ZZ
];
554 ix2
= shX
+ x
[i_coord_offset
+DIM
*2+XX
];
555 iy2
= shY
+ x
[i_coord_offset
+DIM
*2+YY
];
556 iz2
= shZ
+ x
[i_coord_offset
+DIM
*2+ZZ
];
557 ix3
= shX
+ x
[i_coord_offset
+DIM
*3+XX
];
558 iy3
= shY
+ x
[i_coord_offset
+DIM
*3+YY
];
559 iz3
= shZ
+ x
[i_coord_offset
+DIM
*3+ZZ
];
574 /* Start inner kernel loop */
575 for(jidx
=j_index_start
; jidx
<j_index_end
; jidx
++)
577 /* Get j neighbor index, and coordinate index */
579 j_coord_offset
= DIM
*jnr
;
581 /* load j atom coordinates */
582 jx0
= x
[j_coord_offset
+DIM
*0+XX
];
583 jy0
= x
[j_coord_offset
+DIM
*0+YY
];
584 jz0
= x
[j_coord_offset
+DIM
*0+ZZ
];
586 /* Calculate displacement vector */
600 /* Calculate squared distance and things based on it */
601 rsq00
= dx00
*dx00
+dy00
*dy00
+dz00
*dz00
;
602 rsq10
= dx10
*dx10
+dy10
*dy10
+dz10
*dz10
;
603 rsq20
= dx20
*dx20
+dy20
*dy20
+dz20
*dz20
;
604 rsq30
= dx30
*dx30
+dy30
*dy30
+dz30
*dz30
;
606 rinv00
= gmx_invsqrt(rsq00
);
607 rinv10
= gmx_invsqrt(rsq10
);
608 rinv20
= gmx_invsqrt(rsq20
);
609 rinv30
= gmx_invsqrt(rsq30
);
611 rinvsq10
= rinv10
*rinv10
;
612 rinvsq20
= rinv20
*rinv20
;
613 rinvsq30
= rinv30
*rinv30
;
615 /* Load parameters for j particles */
617 vdwjidx0
= 2*vdwtype
[jnr
+0];
619 /**************************
620 * CALCULATE INTERACTIONS *
621 **************************/
625 c6_00
= vdwparam
[vdwioffset0
+vdwjidx0
];
626 c12_00
= vdwparam
[vdwioffset0
+vdwjidx0
+1];
628 /* Calculate table index by multiplying r with table scale and truncate to integer */
634 /* CUBIC SPLINE TABLE DISPERSION */
637 Geps
= vfeps
*vftab
[vfitab
+2];
638 Heps2
= vfeps
*vfeps
*vftab
[vfitab
+3];
640 FF
= Fp
+Geps
+2.0*Heps2
;
643 /* CUBIC SPLINE TABLE REPULSION */
645 Geps
= vfeps
*vftab
[vfitab
+6];
646 Heps2
= vfeps
*vfeps
*vftab
[vfitab
+7];
648 FF
= Fp
+Geps
+2.0*Heps2
;
650 fvdw
= -(fvdw6
+fvdw12
)*vftabscale
*rinv00
;
654 /* Calculate temporary vectorial force */
659 /* Update vectorial force */
663 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
664 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
665 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
667 /**************************
668 * CALCULATE INTERACTIONS *
669 **************************/
675 /* EWALD ELECTROSTATICS */
677 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
678 ewrt
= r10
*ewtabscale
;
681 felec
= (1.0-eweps
)*ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
682 felec
= qq10
*rinv10
*(rinvsq10
-felec
);
686 /* Calculate temporary vectorial force */
691 /* Update vectorial force */
695 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
696 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
697 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
699 /**************************
700 * CALCULATE INTERACTIONS *
701 **************************/
707 /* EWALD ELECTROSTATICS */
709 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
710 ewrt
= r20
*ewtabscale
;
713 felec
= (1.0-eweps
)*ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
714 felec
= qq20
*rinv20
*(rinvsq20
-felec
);
718 /* Calculate temporary vectorial force */
723 /* Update vectorial force */
727 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
728 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
729 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
731 /**************************
732 * CALCULATE INTERACTIONS *
733 **************************/
739 /* EWALD ELECTROSTATICS */
741 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
742 ewrt
= r30
*ewtabscale
;
745 felec
= (1.0-eweps
)*ewtab
[ewitab
]+eweps
*ewtab
[ewitab
+1];
746 felec
= qq30
*rinv30
*(rinvsq30
-felec
);
750 /* Calculate temporary vectorial force */
755 /* Update vectorial force */
759 f
[j_coord_offset
+DIM
*0+XX
] -= tx
;
760 f
[j_coord_offset
+DIM
*0+YY
] -= ty
;
761 f
[j_coord_offset
+DIM
*0+ZZ
] -= tz
;
763 /* Inner loop uses 149 flops */
765 /* End of innermost loop */
768 f
[i_coord_offset
+DIM
*0+XX
] += fix0
;
769 f
[i_coord_offset
+DIM
*0+YY
] += fiy0
;
770 f
[i_coord_offset
+DIM
*0+ZZ
] += fiz0
;
774 f
[i_coord_offset
+DIM
*1+XX
] += fix1
;
775 f
[i_coord_offset
+DIM
*1+YY
] += fiy1
;
776 f
[i_coord_offset
+DIM
*1+ZZ
] += fiz1
;
780 f
[i_coord_offset
+DIM
*2+XX
] += fix2
;
781 f
[i_coord_offset
+DIM
*2+YY
] += fiy2
;
782 f
[i_coord_offset
+DIM
*2+ZZ
] += fiz2
;
786 f
[i_coord_offset
+DIM
*3+XX
] += fix3
;
787 f
[i_coord_offset
+DIM
*3+YY
] += fiy3
;
788 f
[i_coord_offset
+DIM
*3+ZZ
] += fiz3
;
792 fshift
[i_shift_offset
+XX
] += tx
;
793 fshift
[i_shift_offset
+YY
] += ty
;
794 fshift
[i_shift_offset
+ZZ
] += tz
;
796 /* Increment number of inner iterations */
797 inneriter
+= j_index_end
- j_index_start
;
799 /* Outer loop uses 39 flops */
802 /* Increment number of outer iterations */
805 /* Update outer/inner flops */
807 inc_nrnb(nrnb
,eNR_NBKERNEL_ELEC_VDW_W4_F
,outeriter
*39 + inneriter
*149);