Merge remote-tracking branch 'origin/release-4-6' into HEAD
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_adress_c / nb_kernel123_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_kernel123_adress.h"
28
29
30
31 /*
32  * Gromacs nonbonded kernel nb_kernel123_adress_cg
33  * Coulomb interaction:     Normal Coulomb
34  * VdW interaction:         Buckingham
35  * water optimization:      TIP4P - other atoms
36  * Calculate forces:        yes
37  */
38 void nb_kernel123_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         Vvdwexp,br;
86     real         ix1,iy1,iz1,fix1,fiy1,fiz1;
87     real         ix2,iy2,iz2,fix2,fiy2,fiz2;
88     real         ix3,iy3,iz3,fix3,fiy3,fiz3;
89     real         ix4,iy4,iz4,fix4,fiy4,fiz4;
90     real         jx1,jy1,jz1,fjx1,fjy1,fjz1;
91     real         dx11,dy11,dz11,rsq11,rinv11;
92     real         dx21,dy21,dz21,rsq21,rinv21;
93     real         dx31,dy31,dz31,rsq31,rinv31;
94     real         dx41,dy41,dz41,rsq41,rinv41;
95     real         qH,qM;
96     real         c6,cexp1,cexp2;
97     real         weight_cg1, weight_cg2, weight_product;
98     real         hybscal;
99
100     nri              = *p_nri;         
101     ntype            = *p_ntype;       
102     nthreads         = *p_nthreads;    
103     facel            = *p_facel;       
104     krf              = *p_krf;         
105     crf              = *p_crf;         
106     tabscale         = *p_tabscale;    
107     ii               = iinr[0];        
108     qH               = facel*charge[ii+1];
109     qM               = facel*charge[ii+3];
110     nti              = 3*ntype*type[ii];
111
112     nouter           = 0;              
113     ninner           = 0;              
114     
115     do
116     {
117         #ifdef GMX_THREAD_SHM_FDECOMP
118         tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
119         nn0              = *count;         
120         nn1              = nn0+(nri-nn0)/(2*nthreads)+10;
121         *count           = nn1;            
122         tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
123         if(nn1>nri) nn1=nri;
124         #else
125         nn0 = 0;
126         nn1 = nri;
127         #endif
128         
129         for(n=nn0; (n<nn1); n++)
130         {
131             is3              = 3*shift[n];     
132             shX              = shiftvec[is3];  
133             shY              = shiftvec[is3+1];
134             shZ              = shiftvec[is3+2];
135             nj0              = jindex[n];      
136             nj1              = jindex[n+1];    
137             ii               = iinr[n];        
138             ii3              = 3*ii;           
139             ix1              = shX + pos[ii3+0];
140             iy1              = shY + pos[ii3+1];
141             iz1              = shZ + pos[ii3+2];
142             ix2              = shX + pos[ii3+3];
143             iy2              = shY + pos[ii3+4];
144             iz2              = shZ + pos[ii3+5];
145             ix3              = shX + pos[ii3+6];
146             iy3              = shY + pos[ii3+7];
147             iz3              = shZ + pos[ii3+8];
148             ix4              = shX + pos[ii3+9];
149             iy4              = shY + pos[ii3+10];
150             iz4              = shZ + pos[ii3+11];
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             fix4             = 0;              
164             fiy4             = 0;              
165             fiz4             = 0;              
166             
167             for(k=nj0; (k<nj1); k++)
168             {
169                 jnr              = jjnr[k];        
170                 weight_cg2       = wf[jnr];        
171                 weight_product   = weight_cg1*weight_cg2;
172                 if (weight_product < ALMOST_ZERO) {
173                        hybscal = 1.0;
174                 }
175                 else if (weight_product >= ALMOST_ONE)
176                 {
177                   /* force is zero, skip this molecule */
178                        continue;
179                 }
180                 else
181                 {
182                    hybscal = 1.0 - weight_product;
183                 }
184                 j3               = 3*jnr;          
185                 jx1              = pos[j3+0];      
186                 jy1              = pos[j3+1];      
187                 jz1              = pos[j3+2];      
188                 dx11             = ix1 - jx1;      
189                 dy11             = iy1 - jy1;      
190                 dz11             = iz1 - jz1;      
191                 rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
192                 dx21             = ix2 - jx1;      
193                 dy21             = iy2 - jy1;      
194                 dz21             = iz2 - jz1;      
195                 rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
196                 dx31             = ix3 - jx1;      
197                 dy31             = iy3 - jy1;      
198                 dz31             = iz3 - jz1;      
199                 rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
200                 dx41             = ix4 - jx1;      
201                 dy41             = iy4 - jy1;      
202                 dz41             = iz4 - jz1;      
203                 rsq41            = dx41*dx41+dy41*dy41+dz41*dz41;
204                 rinv11           = 1.0/sqrt(rsq11);
205                 rinv21           = 1.0/sqrt(rsq21);
206                 rinv31           = 1.0/sqrt(rsq31);
207                 rinv41           = 1.0/sqrt(rsq41);
208                 tj               = nti+3*type[jnr];
209                 c6               = vdwparam[tj];   
210                 cexp1            = vdwparam[tj+1]; 
211                 cexp2            = vdwparam[tj+2]; 
212                 rinvsq           = rinv11*rinv11;  
213                 rinvsix          = rinvsq*rinvsq*rinvsq;
214                 Vvdw6            = c6*rinvsix;     
215                 br               = cexp2*rsq11*rinv11;
216                 Vvdwexp          = cexp1*exp(-br); 
217                 Vvdwtot          = Vvdwtot+Vvdwexp-Vvdw6;
218                 fscal            = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
219                 fscal *= hybscal;
220                 tx               = fscal*dx11;     
221                 ty               = fscal*dy11;     
222                 tz               = fscal*dz11;     
223                 fix1             = fix1 + tx;      
224                 fiy1             = fiy1 + ty;      
225                 fiz1             = fiz1 + tz;      
226                 fjx1             = faction[j3+0] - tx;
227                 fjy1             = faction[j3+1] - ty;
228                 fjz1             = faction[j3+2] - tz;
229                 jq               = charge[jnr+0];  
230                 qq               = qH*jq;          
231                 rinvsq           = rinv21*rinv21;  
232                 vcoul            = qq*rinv21;      
233                 vctot            = vctot+vcoul;    
234                 fscal            = (vcoul)*rinvsq; 
235                 fscal *= hybscal;
236                 tx               = fscal*dx21;     
237                 ty               = fscal*dy21;     
238                 tz               = fscal*dz21;     
239                 fix2             = fix2 + tx;      
240                 fiy2             = fiy2 + ty;      
241                 fiz2             = fiz2 + tz;      
242                 fjx1             = fjx1 - tx;      
243                 fjy1             = fjy1 - ty;      
244                 fjz1             = fjz1 - tz;      
245                 rinvsq           = rinv31*rinv31;  
246                 vcoul            = qq*rinv31;      
247                 vctot            = vctot+vcoul;    
248                 fscal            = (vcoul)*rinvsq; 
249                 fscal *= hybscal;
250                 tx               = fscal*dx31;     
251                 ty               = fscal*dy31;     
252                 tz               = fscal*dz31;     
253                 fix3             = fix3 + tx;      
254                 fiy3             = fiy3 + ty;      
255                 fiz3             = fiz3 + tz;      
256                 fjx1             = fjx1 - tx;      
257                 fjy1             = fjy1 - ty;      
258                 fjz1             = fjz1 - tz;      
259                 qq               = qM*jq;          
260                 rinvsq           = rinv41*rinv41;  
261                 vcoul            = qq*rinv41;      
262                 vctot            = vctot+vcoul;    
263                 fscal            = (vcoul)*rinvsq; 
264                 fscal *= hybscal;
265                 tx               = fscal*dx41;     
266                 ty               = fscal*dy41;     
267                 tz               = fscal*dz41;     
268                 fix4             = fix4 + tx;      
269                 fiy4             = fiy4 + ty;      
270                 fiz4             = fiz4 + tz;      
271                 faction[j3+0]    = fjx1 - tx;      
272                 faction[j3+1]    = fjy1 - ty;      
273                 faction[j3+2]    = fjz1 - tz;      
274             }
275             
276             faction[ii3+0]   = faction[ii3+0] + fix1;
277             faction[ii3+1]   = faction[ii3+1] + fiy1;
278             faction[ii3+2]   = faction[ii3+2] + fiz1;
279             faction[ii3+3]   = faction[ii3+3] + fix2;
280             faction[ii3+4]   = faction[ii3+4] + fiy2;
281             faction[ii3+5]   = faction[ii3+5] + fiz2;
282             faction[ii3+6]   = faction[ii3+6] + fix3;
283             faction[ii3+7]   = faction[ii3+7] + fiy3;
284             faction[ii3+8]   = faction[ii3+8] + fiz3;
285             faction[ii3+9]   = faction[ii3+9] + fix4;
286             faction[ii3+10]  = faction[ii3+10] + fiy4;
287             faction[ii3+11]  = faction[ii3+11] + fiz4;
288             fshift[is3]      = fshift[is3]+fix1+fix2+fix3+fix4;
289             fshift[is3+1]    = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
290             fshift[is3+2]    = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
291             ggid             = gid[n];         
292             Vc[ggid]         = Vc[ggid] + vctot;
293             Vvdw[ggid]       = Vvdw[ggid] + Vvdwtot;
294             ninner           = ninner + nj1 - nj0;
295         }
296         
297         nouter           = nouter + nn1 - nn0;
298     }
299     while (nn1<nri);
300     
301     *outeriter       = nouter;         
302     *inneriter       = ninner;         
303 }
304
305
306
307
308
309 /*
310  * Gromacs nonbonded kernel nb_kernel123_adress_ex
311  * Coulomb interaction:     Normal Coulomb
312  * VdW interaction:         Buckingham
313  * water optimization:      TIP4P - other atoms
314  * Calculate forces:        yes
315  */
316 void nb_kernel123_adress_ex(
317                     int *           p_nri,
318                     int *           iinr,
319                     int *           jindex,
320                     int *           jjnr,
321                     int *           shift,
322                     real *         shiftvec,
323                     real *         fshift,
324                     int *           gid,
325                     real *         pos,
326                     real *         faction,
327                     real *         charge,
328                     real *         p_facel,
329                     real *         p_krf,
330                     real *         p_crf,
331                     real *         Vc,
332                     int *           type,
333                     int *           p_ntype,
334                     real *         vdwparam,
335                     real *         Vvdw,
336                     real *         p_tabscale,
337                     real *         VFtab,
338                     real *         invsqrta,
339                     real *         dvda,
340                     real *         p_gbtabscale,
341                     real *         GBtab,
342                     int *           p_nthreads,
343                     int *           count,
344                     void *          mtx,
345                     int *           outeriter,
346                     int *           inneriter,
347                     real           force_cap,
348                     real *         wf)
349 {
350     int           nri,ntype,nthreads;
351     real         facel,krf,crf,tabscale,gbtabscale;
352     int           n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
353     int           nn0,nn1,nouter,ninner;
354     real         shX,shY,shZ;
355     real         fscal,tx,ty,tz;
356     real         rinvsq;
357     real         jq;
358     real         qq,vcoul,vctot;
359     int           nti;
360     int           tj;
361     real         rinvsix;
362     real         Vvdw6,Vvdwtot;
363     real         Vvdwexp,br;
364     real         ix1,iy1,iz1,fix1,fiy1,fiz1;
365     real         ix2,iy2,iz2,fix2,fiy2,fiz2;
366     real         ix3,iy3,iz3,fix3,fiy3,fiz3;
367     real         ix4,iy4,iz4,fix4,fiy4,fiz4;
368     real         jx1,jy1,jz1,fjx1,fjy1,fjz1;
369     real         dx11,dy11,dz11,rsq11,rinv11;
370     real         dx21,dy21,dz21,rsq21,rinv21;
371     real         dx31,dy31,dz31,rsq31,rinv31;
372     real         dx41,dy41,dz41,rsq41,rinv41;
373     real         qH,qM;
374     real         c6,cexp1,cexp2;
375     real         weight_cg1, weight_cg2, weight_product;
376     real         hybscal;
377
378     nri              = *p_nri;         
379     ntype            = *p_ntype;       
380     nthreads         = *p_nthreads;    
381     facel            = *p_facel;       
382     krf              = *p_krf;         
383     crf              = *p_crf;         
384     tabscale         = *p_tabscale;    
385     ii               = iinr[0];        
386     qH               = facel*charge[ii+1];
387     qM               = facel*charge[ii+3];
388     nti              = 3*ntype*type[ii];
389
390     nouter           = 0;              
391     ninner           = 0;              
392     
393     do
394     {
395         #ifdef GMX_THREAD_SHM_FDECOMP
396         tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
397         nn0              = *count;         
398         nn1              = nn0+(nri-nn0)/(2*nthreads)+10;
399         *count           = nn1;            
400         tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
401         if(nn1>nri) nn1=nri;
402         #else
403         nn0 = 0;
404         nn1 = nri;
405         #endif
406         
407         for(n=nn0; (n<nn1); n++)
408         {
409             is3              = 3*shift[n];     
410             shX              = shiftvec[is3];  
411             shY              = shiftvec[is3+1];
412             shZ              = shiftvec[is3+2];
413             nj0              = jindex[n];      
414             nj1              = jindex[n+1];    
415             ii               = iinr[n];        
416             ii3              = 3*ii;           
417             ix1              = shX + pos[ii3+0];
418             iy1              = shY + pos[ii3+1];
419             iz1              = shZ + pos[ii3+2];
420             ix2              = shX + pos[ii3+3];
421             iy2              = shY + pos[ii3+4];
422             iz2              = shZ + pos[ii3+5];
423             ix3              = shX + pos[ii3+6];
424             iy3              = shY + pos[ii3+7];
425             iz3              = shZ + pos[ii3+8];
426             ix4              = shX + pos[ii3+9];
427             iy4              = shY + pos[ii3+10];
428             iz4              = shZ + pos[ii3+11];
429             weight_cg1       = wf[ii];         
430             vctot            = 0;              
431             Vvdwtot          = 0;              
432             fix1             = 0;              
433             fiy1             = 0;              
434             fiz1             = 0;              
435             fix2             = 0;              
436             fiy2             = 0;              
437             fiz2             = 0;              
438             fix3             = 0;              
439             fiy3             = 0;              
440             fiz3             = 0;              
441             fix4             = 0;              
442             fiy4             = 0;              
443             fiz4             = 0;              
444             
445             for(k=nj0; (k<nj1); k++)
446             {
447                 jnr              = jjnr[k];        
448                 weight_cg2       = wf[jnr];        
449                 weight_product   = weight_cg1*weight_cg2;
450                 if (weight_product < ALMOST_ZERO) {
451                 /* force is zero, skip this molecule */
452                  continue;
453                 }
454                 else if (weight_product >= ALMOST_ONE)
455                 {
456                        hybscal = 1.0;
457                 }
458                 else
459                 {
460                    hybscal = weight_product;
461                 }
462                 j3               = 3*jnr;          
463                 jx1              = pos[j3+0];      
464                 jy1              = pos[j3+1];      
465                 jz1              = pos[j3+2];      
466                 dx11             = ix1 - jx1;      
467                 dy11             = iy1 - jy1;      
468                 dz11             = iz1 - jz1;      
469                 rsq11            = dx11*dx11+dy11*dy11+dz11*dz11;
470                 dx21             = ix2 - jx1;      
471                 dy21             = iy2 - jy1;      
472                 dz21             = iz2 - jz1;      
473                 rsq21            = dx21*dx21+dy21*dy21+dz21*dz21;
474                 dx31             = ix3 - jx1;      
475                 dy31             = iy3 - jy1;      
476                 dz31             = iz3 - jz1;      
477                 rsq31            = dx31*dx31+dy31*dy31+dz31*dz31;
478                 dx41             = ix4 - jx1;      
479                 dy41             = iy4 - jy1;      
480                 dz41             = iz4 - jz1;      
481                 rsq41            = dx41*dx41+dy41*dy41+dz41*dz41;
482                 rinv11           = 1.0/sqrt(rsq11);
483                 rinv21           = 1.0/sqrt(rsq21);
484                 rinv31           = 1.0/sqrt(rsq31);
485                 rinv41           = 1.0/sqrt(rsq41);
486                 tj               = nti+3*type[jnr];
487                 c6               = vdwparam[tj];   
488                 cexp1            = vdwparam[tj+1]; 
489                 cexp2            = vdwparam[tj+2]; 
490                 rinvsq           = rinv11*rinv11;  
491                 rinvsix          = rinvsq*rinvsq*rinvsq;
492                 Vvdw6            = c6*rinvsix;     
493                 br               = cexp2*rsq11*rinv11;
494                 Vvdwexp          = cexp1*exp(-br); 
495                 Vvdwtot          = Vvdwtot+Vvdwexp-Vvdw6;
496                 fscal            = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
497                 fscal *= hybscal;
498                 if(force_cap>0 && (fabs(fscal)> force_cap)){
499                 fscal=force_cap*fscal/fabs(fscal);
500                 }
501                 tx               = fscal*dx11;     
502                 ty               = fscal*dy11;     
503                 tz               = fscal*dz11;     
504                 fix1             = fix1 + tx;      
505                 fiy1             = fiy1 + ty;      
506                 fiz1             = fiz1 + tz;      
507                 fjx1             = faction[j3+0] - tx;
508                 fjy1             = faction[j3+1] - ty;
509                 fjz1             = faction[j3+2] - tz;
510                 jq               = charge[jnr+0];  
511                 qq               = qH*jq;          
512                 rinvsq           = rinv21*rinv21;  
513                 vcoul            = qq*rinv21;      
514                 vctot            = vctot+vcoul;    
515                 fscal            = (vcoul)*rinvsq; 
516                 fscal *= hybscal;
517                 if(force_cap>0 && (fabs(fscal)> force_cap)){
518                 fscal=force_cap*fscal/fabs(fscal);
519                 }
520                 tx               = fscal*dx21;     
521                 ty               = fscal*dy21;     
522                 tz               = fscal*dz21;     
523                 fix2             = fix2 + tx;      
524                 fiy2             = fiy2 + ty;      
525                 fiz2             = fiz2 + tz;      
526                 fjx1             = fjx1 - tx;      
527                 fjy1             = fjy1 - ty;      
528                 fjz1             = fjz1 - tz;      
529                 rinvsq           = rinv31*rinv31;  
530                 vcoul            = qq*rinv31;      
531                 vctot            = vctot+vcoul;    
532                 fscal            = (vcoul)*rinvsq; 
533                 fscal *= hybscal;
534                 if(force_cap>0 && (fabs(fscal)> force_cap)){
535                 fscal=force_cap*fscal/fabs(fscal);
536                 }
537                 tx               = fscal*dx31;     
538                 ty               = fscal*dy31;     
539                 tz               = fscal*dz31;     
540                 fix3             = fix3 + tx;      
541                 fiy3             = fiy3 + ty;      
542                 fiz3             = fiz3 + tz;      
543                 fjx1             = fjx1 - tx;      
544                 fjy1             = fjy1 - ty;      
545                 fjz1             = fjz1 - tz;      
546                 qq               = qM*jq;          
547                 rinvsq           = rinv41*rinv41;  
548                 vcoul            = qq*rinv41;      
549                 vctot            = vctot+vcoul;    
550                 fscal            = (vcoul)*rinvsq; 
551                 fscal *= hybscal;
552                 if(force_cap>0 && (fabs(fscal)> force_cap)){
553                 fscal=force_cap*fscal/fabs(fscal);
554                 }
555                 tx               = fscal*dx41;     
556                 ty               = fscal*dy41;     
557                 tz               = fscal*dz41;     
558                 fix4             = fix4 + tx;      
559                 fiy4             = fiy4 + ty;      
560                 fiz4             = fiz4 + tz;      
561                 faction[j3+0]    = fjx1 - tx;      
562                 faction[j3+1]    = fjy1 - ty;      
563                 faction[j3+2]    = fjz1 - tz;      
564             }
565             
566             faction[ii3+0]   = faction[ii3+0] + fix1;
567             faction[ii3+1]   = faction[ii3+1] + fiy1;
568             faction[ii3+2]   = faction[ii3+2] + fiz1;
569             faction[ii3+3]   = faction[ii3+3] + fix2;
570             faction[ii3+4]   = faction[ii3+4] + fiy2;
571             faction[ii3+5]   = faction[ii3+5] + fiz2;
572             faction[ii3+6]   = faction[ii3+6] + fix3;
573             faction[ii3+7]   = faction[ii3+7] + fiy3;
574             faction[ii3+8]   = faction[ii3+8] + fiz3;
575             faction[ii3+9]   = faction[ii3+9] + fix4;
576             faction[ii3+10]  = faction[ii3+10] + fiy4;
577             faction[ii3+11]  = faction[ii3+11] + fiz4;
578             fshift[is3]      = fshift[is3]+fix1+fix2+fix3+fix4;
579             fshift[is3+1]    = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
580             fshift[is3+2]    = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
581             ggid             = gid[n];         
582             Vc[ggid]         = Vc[ggid] + vctot;
583             Vvdw[ggid]       = Vvdw[ggid] + Vvdwtot;
584             ninner           = ninner + nj1 - nj0;
585         }
586         
587         nouter           = nouter + nn1 - nn0;
588     }
589     while (nn1<nri);
590     
591     *outeriter       = nouter;         
592     *inneriter       = ninner;         
593 }
594
595