Merge branch 'release-4-6'
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nonbonded.c
index d6de9b0058c0164c6c04d36ea2e1e9fbe2066810..5a7c1ad7434d30bf7a23d7635a63556fb218abae 100644 (file)
@@ -322,7 +322,7 @@ gmx_setup_adress_kernels(FILE *fplog,gmx_bool bGenericKernelOnly) {
 void do_nonbonded(t_commrec *cr,t_forcerec *fr,
                   rvec x[],rvec f[],t_mdatoms *mdatoms,t_blocka *excl,
                   real egnb[],real egcoul[],real egpol[],rvec box_size,
-                  t_nrnb *nrnb,real lambda,real *dvdlambda,
+                  t_nrnb *nrnb,real *lambda, real *dvdl,
                   int nls,int eNL,int flags)
 {
     gmx_bool            bLR,bDoForces,bForeignLambda;
@@ -524,7 +524,7 @@ void do_nonbonded(t_commrec *cr,t_forcerec *fr,
                                
                                if(nlist->free_energy)
                                {
-                                       if(nlist->ivdw==2)
+                                       if(nlist->ivdw==enbvdwBHAM)
                                        {
                                                gmx_fatal(FARGS,"Cannot do free energy Buckingham interactions.");
                                        }
@@ -555,10 +555,13 @@ void do_nonbonded(t_commrec *cr,t_forcerec *fr,
                                                                                          egnb,
                                                                                          nblists->tab.scale,
                                                                                          tabledata,
-                                                                                         lambda,
-                                                                                         dvdlambda,
-                                                                                         fr->sc_alpha,
+                                                                                         lambda[efptCOUL],
+                                              lambda[efptVDW],
+                                              dvdl,
+                                              fr->sc_alphacoul,
+                                                                                         fr->sc_alphavdw,
                                                                                          fr->sc_power,
+                                                                                         fr->sc_r_power,
                                                                                          fr->sc_sigma6_def,
                                               fr->sc_sigma6_min,
                                               bDoForces,
@@ -777,7 +780,7 @@ do_listed_vdw_q(int ftype,int nbonds,
                 const t_iatom iatoms[],const t_iparams iparams[],
                 const rvec x[],rvec f[],rvec fshift[],
                 const t_pbc *pbc,const t_graph *g,
-                real lambda,real *dvdlambda,
+                real *lambda, real *dvdl,
                 const t_mdatoms *md,
                 const t_forcerec *fr,gmx_grppairener_t *grppener,
                 int *global_atom_index)
@@ -846,32 +849,28 @@ do_listed_vdw_q(int ftype,int nbonds,
 
     /* Determine the values for icoul/ivdw. */
     if (fr->bEwald) {
-        icoul = 1;
+        icoul = enbcoulOOR;
     } 
     else if(fr->bcoultab)
     {
-        icoul = 3;
+        icoul = enbcoulTAB;
     }
     else if(fr->eeltype == eelRF_NEC)
     {
-        icoul = 2;
+        icoul = enbcoulRF;
     }
     else 
     {
-        icoul = 1;
+        icoul = enbcoulOOR;
     }
     
     if(fr->bvdwtab)
     {
-        ivdw = 3;
+        ivdw = enbvdwTAB;
     }
-    else if(fr->bBHAM)
-    {
-        ivdw = 2;
-    }
-    else 
+    else
     {
-        ivdw = 1;
+        ivdw = enbvdwLJ;
     }
     
     
@@ -980,7 +979,12 @@ do_listed_vdw_q(int ftype,int nbonds,
              * in the innerloops if we assign type combinations 0-0 and 0-1
              * to atom pair ai-aj in topologies A and B respectively.
              */
-            if(ivdw==2)
+
+            /* need to do a bit of a kludge here -- the way it is set up,
+               if the charges change, but the vdw do not, then even though bFreeEnergy is on,
+               it won't work, because all the bonds are perturbed.
+            */
+            if(ivdw==enbvdwBHAM)
             {
                 gmx_fatal(FARGS,"Cannot do free energy Buckingham interactions.");
             }
@@ -1011,10 +1015,13 @@ do_listed_vdw_q(int ftype,int nbonds,
                                       egnb,
                                       tabscale,
                                       tab,
-                                      lambda,
-                                      dvdlambda,
-                                      fr->sc_alpha,
+                                      lambda[efptCOUL],
+                                      lambda[efptVDW],
+                                      dvdl,
+                                      fr->sc_alphacoul,
+                                      fr->sc_alphavdw,
                                       fr->sc_power,
+                                      6.0, /* for 1-4's use the 6 power always - 48 power too high because of where they are forced to be */
                                       fr->sc_sigma6_def,
                                       fr->sc_sigma6_min,
                                       TRUE,