Merge remote-tracking branch 'origin/release-4-6' into HEAD
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_adress_c / nb_kernel311_c_adress.c
1 /*
2  * Copyright (c) Erik Lindahl, David van der Spoel 2003
3  * 
4  * This file is generated automatically at compile time
5  * by the program mknb in the Gromacs distribution.
6  *
7  * Options used when generation this file:
8  * Language:         c
9  * Precision:        single
10  * Threads:          yes
11  * Software invsqrt: no
12  * PowerPC invsqrt:  no
13  * Prefetch forces:  no
14  * Adress kernel:  yes
15  * Comments:         no
16  */
17 #ifdef HAVE_CONFIG_H
18 #include<config.h>
19 #endif
20 #ifdef GMX_THREAD_SHM_FDECOMP
21 #include<thread_mpi.h>
22 #endif
23 #define ALMOST_ZERO 1e-30
24 #define ALMOST_ONE 1-(1e-30)
25 #include<math.h>
26
27 #include "nb_kernel311_adress.h"
28
29
30
31 /*
32  * Gromacs nonbonded kernel nb_kernel311_adress_cg
33  * Coulomb interaction:     Tabulated
34  * VdW interaction:         Lennard-Jones
35  * water optimization:      SPC/TIP3P - other atoms
36  * Calculate forces:        yes
37  */
38 void nb_kernel311_adress_cg(
39                     int *           p_nri,
40                     int *           iinr,
41                     int *           jindex,
42                     int *           jjnr,
43                     int *           shift,
44                     real *         shiftvec,
45                     real *         fshift,
46                     int *           gid,
47                     real *         pos,
48                     real *         faction,
49                     real *         charge,
50                     real *         p_facel,
51                     real *         p_krf,
52                     real *         p_crf,
53                     real *         Vc,
54                     int *           type,
55                     int *           p_ntype,
56                     real *         vdwparam,
57                     real *         Vvdw,
58                     real *         p_tabscale,
59                     real *         VFtab,
60                     real *         invsqrta,
61                     real *         dvda,
62                     real *         p_gbtabscale,
63                     real *         GBtab,
64                     int *           p_nthreads,
65                     int *           count,
66                     void *          mtx,
67                     int *           outeriter,
68                     int *           inneriter,
69                     real           force_cap,
70                     real *         wf)
71 {
72     int           nri,ntype,nthreads;
73     real         facel,krf,crf,tabscale,gbtabscale;
74     int           n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
75     int           nn0,nn1,nouter,ninner;
76     real         shX,shY,shZ;
77     real         fscal,tx,ty,tz;
78     real         rinvsq;
79     real         jq;
80     real         qq,vcoul,vctot;
81     int           nti;
82     int           tj;
83     real         rinvsix;
84     real         Vvdw6,Vvdwtot;
85     real         Vvdw12;
86     real         r,rt,eps,eps2;
87     int           n0,nnn;
88     real         Y,F,Geps,Heps2,Fp,VV;
89     real         FF;
90     real         fijC;
91     real         ix1,iy1,iz1,fix1,fiy1,fiz1;
92     real         ix2,iy2,iz2,fix2,fiy2,fiz2;
93     real         ix3,iy3,iz3,fix3,fiy3,fiz3;
94     real         jx1,jy1,jz1,fjx1,fjy1,fjz1;
95     real         dx11,dy11,dz11,rsq11,rinv11;
96     real         dx21,dy21,dz21,rsq21,rinv21;
97     real         dx31,dy31,dz31,rsq31,rinv31;
98     real         qO,qH;
99     real         c6,c12;
100     real         weight_cg1, weight_cg2, weight_product;
101     real         hybscal;
102
103     nri              = *p_nri;         
104     ntype            = *p_ntype;       
105     nthreads         = *p_nthreads;    
106     facel            = *p_facel;       
107     krf              = *p_krf;         
108     crf              = *p_crf;         
109     tabscale         = *p_tabscale;    
110     ii               = iinr[0];        
111     qO               = facel*charge[ii];
112     qH               = facel*charge[ii+1];
113     nti              = 2*ntype*type[ii];
114
115     nouter           = 0;              
116     ninner           = 0;              
117     
118     do
119     {
120         #ifdef GMX_THREAD_SHM_FDECOMP
121         tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
122         nn0              = *count;         
123         nn1              = nn0+(nri-nn0)/(2*nthreads)+10;
124         *count           = nn1;            
125         tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
126         if(nn1>nri) nn1=nri;
127         #else
128         nn0 = 0;
129         nn1 = nri;
130         #endif
131         
132         for(n=nn0; (n<nn1); n++)
133         {
134             is3              = 3*shift[n];     
135             shX              = shiftvec[is3];  
136             shY              = shiftvec[is3+1];
137             shZ              = shiftvec[is3+2];
138             nj0              = jindex[n];      
139             nj1              = jindex[n+1];    
140             ii               = iinr[n];        
141             ii3              = 3*ii;           
142             ix1              = shX + pos[ii3+0];
143             iy1              = shY + pos[ii3+1];
144             iz1              = shZ + pos[ii3+2];
145             ix2              = shX + pos[ii3+3];
146             iy2              = shY + pos[ii3+4];
147             iz2              = shZ + pos[ii3+5];
148             ix3              = shX + pos[ii3+6];
149             iy3              = shY + pos[ii3+7];
150             iz3              = shZ + pos[ii3+8];
151             weight_cg1       = wf[ii];         
152             vctot            = 0;              
153             Vvdwtot          = 0;              
154             fix1             = 0;              
155             fiy1             = 0;              
156             fiz1             = 0;              
157             fix2             = 0;              
158             fiy2             = 0;              
159             fiz2             = 0;              
160             fix3             = 0;              
161             fiy3             = 0;              
162             fiz3             = 0;              
163             
164             for(k=nj0; (k<nj1); k++)
165             {
166                 jnr              = jjnr[k];        
167                 weight_cg2       = wf[jnr];        
168                 weight_product   = weight_cg1*weight_cg2;
169                 if (weight_product < ALMOST_ZERO) {
170                        hybscal = 1.0;
171                 }
172                 else if (weight_product >= ALMOST_ONE)
173                 {
174                   /* force is zero, skip this molecule */
175                        continue;
176                 }
177                 else
178                 {
179                    hybscal = 1.0 - weight_product;
180                 }
181                 j3               = 3*jnr;          
182                 jx1              = pos[j3+0];      
183                 jy1              = pos[j3+1];      
184                 jz1              = pos[j3+2];      
185                 dx11             = ix1 - jx1;      
186                 dy11             = iy1 - jy1;      
187                 dz11             = iz1 - jz1;      
188                 rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
189                 dx21             = ix2 - jx1;      
190                 dy21             = iy2 - jy1;      
191                 dz21             = iz2 - jz1;      
192                 rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
193                 dx31             = ix3 - jx1;      
194                 dy31             = iy3 - jy1;      
195                 dz31             = iz3 - jz1;      
196                 rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
197                 rinv11           = 1.0/sqrt(rsq11);
198                 rinv21           = 1.0/sqrt(rsq21);
199                 rinv31           = 1.0/sqrt(rsq31);
200                 jq               = charge[jnr+0];  
201                 qq               = qO*jq;          
202                 tj               = nti+2*type[jnr];
203                 c6               = vdwparam[tj];   
204                 c12              = vdwparam[tj+1]; 
205                 rinvsq           = rinv11*rinv11;  
206                 r                = rsq11*rinv11;   
207                 rt               = r*tabscale;     
208                 n0               = rt;             
209                 eps              = rt-n0;          
210                 eps2             = eps*eps;        
211                 nnn              = 4*n0;           
212                 Y                = VFtab[nnn];     
213                 F                = VFtab[nnn+1];   
214                 Geps             = eps*VFtab[nnn+2];
215                 Heps2            = eps2*VFtab[nnn+3];
216                 Fp               = F+Geps+Heps2;   
217                 VV               = Y+eps*Fp;       
218                 FF               = Fp+Geps+2.0*Heps2;
219                 vcoul            = qq*VV;          
220                 fijC             = qq*FF;          
221                 vctot            = vctot + vcoul;  
222                 rinvsix          = rinvsq*rinvsq*rinvsq;
223                 Vvdw6            = c6*rinvsix;     
224                 Vvdw12           = c12*rinvsix*rinvsix;
225                 Vvdwtot          = Vvdwtot+Vvdw12-Vvdw6;
226                 fscal            = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
227                 fscal *= hybscal;
228                 tx               = fscal*dx11;     
229                 ty               = fscal*dy11;     
230                 tz               = fscal*dz11;     
231                 fix1             = fix1 + tx;      
232                 fiy1             = fiy1 + ty;      
233                 fiz1             = fiz1 + tz;      
234                 fjx1             = faction[j3+0] - tx;
235                 fjy1             = faction[j3+1] - ty;
236                 fjz1             = faction[j3+2] - tz;
237                 qq               = qH*jq;          
238                 r                = rsq21*rinv21;   
239                 rt               = r*tabscale;     
240                 n0               = rt;             
241                 eps              = rt-n0;          
242                 eps2             = eps*eps;        
243                 nnn              = 4*n0;           
244                 Y                = VFtab[nnn];     
245                 F                = VFtab[nnn+1];   
246                 Geps             = eps*VFtab[nnn+2];
247                 Heps2            = eps2*VFtab[nnn+3];
248                 Fp               = F+Geps+Heps2;   
249                 VV               = Y+eps*Fp;       
250                 FF               = Fp+Geps+2.0*Heps2;
251                 vcoul            = qq*VV;          
252                 fijC             = qq*FF;          
253                 vctot            = vctot + vcoul;  
254                 fscal            = -((fijC)*tabscale)*rinv21;
255                 fscal *= hybscal;
256                 tx               = fscal*dx21;     
257                 ty               = fscal*dy21;     
258                 tz               = fscal*dz21;     
259                 fix2             = fix2 + tx;      
260                 fiy2             = fiy2 + ty;      
261                 fiz2             = fiz2 + tz;      
262                 fjx1             = fjx1 - tx;      
263                 fjy1             = fjy1 - ty;      
264                 fjz1             = fjz1 - tz;      
265                 r                = rsq31*rinv31;   
266                 rt               = r*tabscale;     
267                 n0               = rt;             
268                 eps              = rt-n0;          
269                 eps2             = eps*eps;        
270                 nnn              = 4*n0;           
271                 Y                = VFtab[nnn];     
272                 F                = VFtab[nnn+1];   
273                 Geps             = eps*VFtab[nnn+2];
274                 Heps2            = eps2*VFtab[nnn+3];
275                 Fp               = F+Geps+Heps2;   
276                 VV               = Y+eps*Fp;       
277                 FF               = Fp+Geps+2.0*Heps2;
278                 vcoul            = qq*VV;          
279                 fijC             = qq*FF;          
280                 vctot            = vctot + vcoul;  
281                 fscal            = -((fijC)*tabscale)*rinv31;
282                 fscal *= hybscal;
283                 tx               = fscal*dx31;     
284                 ty               = fscal*dy31;     
285                 tz               = fscal*dz31;     
286                 fix3             = fix3 + tx;      
287                 fiy3             = fiy3 + ty;      
288                 fiz3             = fiz3 + tz;      
289                 faction[j3+0]    = fjx1 - tx;      
290                 faction[j3+1]    = fjy1 - ty;      
291                 faction[j3+2]    = fjz1 - tz;      
292             }
293             
294             faction[ii3+0]   = faction[ii3+0] + fix1;
295             faction[ii3+1]   = faction[ii3+1] + fiy1;
296             faction[ii3+2]   = faction[ii3+2] + fiz1;
297             faction[ii3+3]   = faction[ii3+3] + fix2;
298             faction[ii3+4]   = faction[ii3+4] + fiy2;
299             faction[ii3+5]   = faction[ii3+5] + fiz2;
300             faction[ii3+6]   = faction[ii3+6] + fix3;
301             faction[ii3+7]   = faction[ii3+7] + fiy3;
302             faction[ii3+8]   = faction[ii3+8] + fiz3;
303             fshift[is3]      = fshift[is3]+fix1+fix2+fix3;
304             fshift[is3+1]    = fshift[is3+1]+fiy1+fiy2+fiy3;
305             fshift[is3+2]    = fshift[is3+2]+fiz1+fiz2+fiz3;
306             ggid             = gid[n];         
307             Vc[ggid]         = Vc[ggid] + vctot;
308             Vvdw[ggid]       = Vvdw[ggid] + Vvdwtot;
309             ninner           = ninner + nj1 - nj0;
310         }
311         
312         nouter           = nouter + nn1 - nn0;
313     }
314     while (nn1<nri);
315     
316     *outeriter       = nouter;         
317     *inneriter       = ninner;         
318 }
319
320
321
322
323
324 /*
325  * Gromacs nonbonded kernel nb_kernel311_adress_ex
326  * Coulomb interaction:     Tabulated
327  * VdW interaction:         Lennard-Jones
328  * water optimization:      SPC/TIP3P - other atoms
329  * Calculate forces:        yes
330  */
331 void nb_kernel311_adress_ex(
332                     int *           p_nri,
333                     int *           iinr,
334                     int *           jindex,
335                     int *           jjnr,
336                     int *           shift,
337                     real *         shiftvec,
338                     real *         fshift,
339                     int *           gid,
340                     real *         pos,
341                     real *         faction,
342                     real *         charge,
343                     real *         p_facel,
344                     real *         p_krf,
345                     real *         p_crf,
346                     real *         Vc,
347                     int *           type,
348                     int *           p_ntype,
349                     real *         vdwparam,
350                     real *         Vvdw,
351                     real *         p_tabscale,
352                     real *         VFtab,
353                     real *         invsqrta,
354                     real *         dvda,
355                     real *         p_gbtabscale,
356                     real *         GBtab,
357                     int *           p_nthreads,
358                     int *           count,
359                     void *          mtx,
360                     int *           outeriter,
361                     int *           inneriter,
362                     real           force_cap,
363                     real *         wf)
364 {
365     int           nri,ntype,nthreads;
366     real         facel,krf,crf,tabscale,gbtabscale;
367     int           n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
368     int           nn0,nn1,nouter,ninner;
369     real         shX,shY,shZ;
370     real         fscal,tx,ty,tz;
371     real         rinvsq;
372     real         jq;
373     real         qq,vcoul,vctot;
374     int           nti;
375     int           tj;
376     real         rinvsix;
377     real         Vvdw6,Vvdwtot;
378     real         Vvdw12;
379     real         r,rt,eps,eps2;
380     int           n0,nnn;
381     real         Y,F,Geps,Heps2,Fp,VV;
382     real         FF;
383     real         fijC;
384     real         ix1,iy1,iz1,fix1,fiy1,fiz1;
385     real         ix2,iy2,iz2,fix2,fiy2,fiz2;
386     real         ix3,iy3,iz3,fix3,fiy3,fiz3;
387     real         jx1,jy1,jz1,fjx1,fjy1,fjz1;
388     real         dx11,dy11,dz11,rsq11,rinv11;
389     real         dx21,dy21,dz21,rsq21,rinv21;
390     real         dx31,dy31,dz31,rsq31,rinv31;
391     real         qO,qH;
392     real         c6,c12;
393     real         weight_cg1, weight_cg2, weight_product;
394     real         hybscal;
395
396     nri              = *p_nri;         
397     ntype            = *p_ntype;       
398     nthreads         = *p_nthreads;    
399     facel            = *p_facel;       
400     krf              = *p_krf;         
401     crf              = *p_crf;         
402     tabscale         = *p_tabscale;    
403     ii               = iinr[0];        
404     qO               = facel*charge[ii];
405     qH               = facel*charge[ii+1];
406     nti              = 2*ntype*type[ii];
407
408     nouter           = 0;              
409     ninner           = 0;              
410     
411     do
412     {
413         #ifdef GMX_THREAD_SHM_FDECOMP
414         tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
415         nn0              = *count;         
416         nn1              = nn0+(nri-nn0)/(2*nthreads)+10;
417         *count           = nn1;            
418         tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
419         if(nn1>nri) nn1=nri;
420         #else
421         nn0 = 0;
422         nn1 = nri;
423         #endif
424         
425         for(n=nn0; (n<nn1); n++)
426         {
427             is3              = 3*shift[n];     
428             shX              = shiftvec[is3];  
429             shY              = shiftvec[is3+1];
430             shZ              = shiftvec[is3+2];
431             nj0              = jindex[n];      
432             nj1              = jindex[n+1];    
433             ii               = iinr[n];        
434             ii3              = 3*ii;           
435             ix1              = shX + pos[ii3+0];
436             iy1              = shY + pos[ii3+1];
437             iz1              = shZ + pos[ii3+2];
438             ix2              = shX + pos[ii3+3];
439             iy2              = shY + pos[ii3+4];
440             iz2              = shZ + pos[ii3+5];
441             ix3              = shX + pos[ii3+6];
442             iy3              = shY + pos[ii3+7];
443             iz3              = shZ + pos[ii3+8];
444             weight_cg1       = wf[ii];         
445             vctot            = 0;              
446             Vvdwtot          = 0;              
447             fix1             = 0;              
448             fiy1             = 0;              
449             fiz1             = 0;              
450             fix2             = 0;              
451             fiy2             = 0;              
452             fiz2             = 0;              
453             fix3             = 0;              
454             fiy3             = 0;              
455             fiz3             = 0;              
456             
457             for(k=nj0; (k<nj1); k++)
458             {
459                 jnr              = jjnr[k];        
460                 weight_cg2       = wf[jnr];        
461                 weight_product   = weight_cg1*weight_cg2;
462                 if (weight_product < ALMOST_ZERO) {
463                 /* force is zero, skip this molecule */
464                  continue;
465                 }
466                 else if (weight_product >= ALMOST_ONE)
467                 {
468                        hybscal = 1.0;
469                 }
470                 else
471                 {
472                    hybscal = weight_product;
473                 }
474                 j3               = 3*jnr;          
475                 jx1              = pos[j3+0];      
476                 jy1              = pos[j3+1];      
477                 jz1              = pos[j3+2];      
478                 dx11             = ix1 - jx1;      
479                 dy11             = iy1 - jy1;      
480                 dz11             = iz1 - jz1;      
481                 rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
482                 dx21             = ix2 - jx1;      
483                 dy21             = iy2 - jy1;      
484                 dz21             = iz2 - jz1;      
485                 rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
486                 dx31             = ix3 - jx1;      
487                 dy31             = iy3 - jy1;      
488                 dz31             = iz3 - jz1;      
489                 rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
490                 rinv11           = 1.0/sqrt(rsq11);
491                 rinv21           = 1.0/sqrt(rsq21);
492                 rinv31           = 1.0/sqrt(rsq31);
493                 jq               = charge[jnr+0];  
494                 qq               = qO*jq;          
495                 tj               = nti+2*type[jnr];
496                 c6               = vdwparam[tj];   
497                 c12              = vdwparam[tj+1]; 
498                 rinvsq           = rinv11*rinv11;  
499                 r                = rsq11*rinv11;   
500                 rt               = r*tabscale;     
501                 n0               = rt;             
502                 eps              = rt-n0;          
503                 eps2             = eps*eps;        
504                 nnn              = 4*n0;           
505                 Y                = VFtab[nnn];     
506                 F                = VFtab[nnn+1];   
507                 Geps             = eps*VFtab[nnn+2];
508                 Heps2            = eps2*VFtab[nnn+3];
509                 Fp               = F+Geps+Heps2;   
510                 VV               = Y+eps*Fp;       
511                 FF               = Fp+Geps+2.0*Heps2;
512                 vcoul            = qq*VV;          
513                 fijC             = qq*FF;          
514                 vctot            = vctot + vcoul;  
515                 rinvsix          = rinvsq*rinvsq*rinvsq;
516                 Vvdw6            = c6*rinvsix;     
517                 Vvdw12           = c12*rinvsix*rinvsix;
518                 Vvdwtot          = Vvdwtot+Vvdw12-Vvdw6;
519                 fscal            = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
520                 fscal *= hybscal;
521                 if(force_cap>0 && (fabs(fscal)> force_cap)){
522                 fscal=force_cap*fscal/fabs(fscal);
523                 }
524                 tx               = fscal*dx11;     
525                 ty               = fscal*dy11;     
526                 tz               = fscal*dz11;     
527                 fix1             = fix1 + tx;      
528                 fiy1             = fiy1 + ty;      
529                 fiz1             = fiz1 + tz;      
530                 fjx1             = faction[j3+0] - tx;
531                 fjy1             = faction[j3+1] - ty;
532                 fjz1             = faction[j3+2] - tz;
533                 qq               = qH*jq;          
534                 r                = rsq21*rinv21;   
535                 rt               = r*tabscale;     
536                 n0               = rt;             
537                 eps              = rt-n0;          
538                 eps2             = eps*eps;        
539                 nnn              = 4*n0;           
540                 Y                = VFtab[nnn];     
541                 F                = VFtab[nnn+1];   
542                 Geps             = eps*VFtab[nnn+2];
543                 Heps2            = eps2*VFtab[nnn+3];
544                 Fp               = F+Geps+Heps2;   
545                 VV               = Y+eps*Fp;       
546                 FF               = Fp+Geps+2.0*Heps2;
547                 vcoul            = qq*VV;          
548                 fijC             = qq*FF;          
549                 vctot            = vctot + vcoul;  
550                 fscal            = -((fijC)*tabscale)*rinv21;
551                 fscal *= hybscal;
552                 if(force_cap>0 && (fabs(fscal)> force_cap)){
553                 fscal=force_cap*fscal/fabs(fscal);
554                 }
555                 tx               = fscal*dx21;     
556                 ty               = fscal*dy21;     
557                 tz               = fscal*dz21;     
558                 fix2             = fix2 + tx;      
559                 fiy2             = fiy2 + ty;      
560                 fiz2             = fiz2 + tz;      
561                 fjx1             = fjx1 - tx;      
562                 fjy1             = fjy1 - ty;      
563                 fjz1             = fjz1 - tz;      
564                 r                = rsq31*rinv31;   
565                 rt               = r*tabscale;     
566                 n0               = rt;             
567                 eps              = rt-n0;          
568                 eps2             = eps*eps;        
569                 nnn              = 4*n0;           
570                 Y                = VFtab[nnn];     
571                 F                = VFtab[nnn+1];   
572                 Geps             = eps*VFtab[nnn+2];
573                 Heps2            = eps2*VFtab[nnn+3];
574                 Fp               = F+Geps+Heps2;   
575                 VV               = Y+eps*Fp;       
576                 FF               = Fp+Geps+2.0*Heps2;
577                 vcoul            = qq*VV;          
578                 fijC             = qq*FF;          
579                 vctot            = vctot + vcoul;  
580                 fscal            = -((fijC)*tabscale)*rinv31;
581                 fscal *= hybscal;
582                 if(force_cap>0 && (fabs(fscal)> force_cap)){
583                 fscal=force_cap*fscal/fabs(fscal);
584                 }
585                 tx               = fscal*dx31;     
586                 ty               = fscal*dy31;     
587                 tz               = fscal*dz31;     
588                 fix3             = fix3 + tx;      
589                 fiy3             = fiy3 + ty;      
590                 fiz3             = fiz3 + tz;      
591                 faction[j3+0]    = fjx1 - tx;      
592                 faction[j3+1]    = fjy1 - ty;      
593                 faction[j3+2]    = fjz1 - tz;      
594             }
595             
596             faction[ii3+0]   = faction[ii3+0] + fix1;
597             faction[ii3+1]   = faction[ii3+1] + fiy1;
598             faction[ii3+2]   = faction[ii3+2] + fiz1;
599             faction[ii3+3]   = faction[ii3+3] + fix2;
600             faction[ii3+4]   = faction[ii3+4] + fiy2;
601             faction[ii3+5]   = faction[ii3+5] + fiz2;
602             faction[ii3+6]   = faction[ii3+6] + fix3;
603             faction[ii3+7]   = faction[ii3+7] + fiy3;
604             faction[ii3+8]   = faction[ii3+8] + fiz3;
605             fshift[is3]      = fshift[is3]+fix1+fix2+fix3;
606             fshift[is3+1]    = fshift[is3+1]+fiy1+fiy2+fiy3;
607             fshift[is3+2]    = fshift[is3+2]+fiz1+fiz2+fiz3;
608             ggid             = gid[n];         
609             Vc[ggid]         = Vc[ggid] + vctot;
610             Vvdw[ggid]       = Vvdw[ggid] + Vvdwtot;
611             ninner           = ninner + nj1 - nj0;
612         }
613         
614         nouter           = nouter + nn1 - nn0;
615     }
616     while (nn1<nri);
617     
618     *outeriter       = nouter;         
619     *inneriter       = ninner;         
620 }
621
622