Pass restraint data structures to bonded functions
[alexxy/gromacs.git] / src / gromacs / listed_forces / orires.cpp
index 47e3eb37144b663d113234d749991e5ff9e02923..ff9a7b5cec8375855afb1464652693c75c4d5c30 100644 (file)
@@ -658,28 +658,28 @@ real orires(int             nfa,
             real gmx_unused lambda,
             real gmx_unused* dvdlambda,
             const t_mdatoms gmx_unused* md,
-            t_fcdata*                   fcd,
+            t_fcdata gmx_unused* fcd,
+            t_disresdata gmx_unused* disresdata,
+            t_oriresdata*            oriresdata,
             int gmx_unused* global_atom_index)
 {
-    int                 ex, power, ki = CENTRAL;
-    real                r2, invr, invr2, fc, smooth_fc, dev, devins, pfac;
-    rvec                r, Sr, fij;
-    real                vtot;
-    const t_oriresdata* od;
-    gmx_bool            bTAV;
+    int      ex, power, ki = CENTRAL;
+    real     r2, invr, invr2, fc, smooth_fc, dev, devins, pfac;
+    rvec     r, Sr, fij;
+    real     vtot;
+    gmx_bool bTAV;
 
     vtot = 0;
-    od   = fcd->orires;
 
-    if (od->fc != 0)
+    if (oriresdata->fc != 0)
     {
-        bTAV = (od->edt != 0);
+        bTAV = (oriresdata->edt != 0);
 
-        smooth_fc = od->fc;
+        smooth_fc = oriresdata->fc;
         if (bTAV)
         {
             /* Smoothly switch on the restraining when time averaging is used */
-            smooth_fc *= (1.0 - od->exp_min_t_tau);
+            smooth_fc *= (1.0 - oriresdata->exp_min_t_tau);
         }
 
         for (int fa = 0; fa < nfa; fa += 3)
@@ -687,7 +687,7 @@ real orires(int             nfa,
             const int type           = forceatoms[fa];
             const int ai             = forceatoms[fa + 1];
             const int aj             = forceatoms[fa + 2];
-            const int restraintIndex = type - od->typeMin;
+            const int restraintIndex = type - oriresdata->typeMin;
             if (pbc)
             {
                 ki = pbc_dx_aiuc(pbc, x[ai], x[aj], r);
@@ -702,7 +702,7 @@ real orires(int             nfa,
             ex    = ip[type].orires.ex;
             power = ip[type].orires.power;
             fc    = smooth_fc * ip[type].orires.kfac;
-            dev   = od->otav[restraintIndex] - ip[type].orires.obs;
+            dev   = oriresdata->otav[restraintIndex] - ip[type].orires.obs;
 
             /* NOTE:
              * there is no real potential when time averaging is applied
@@ -712,7 +712,7 @@ real orires(int             nfa,
             if (bTAV)
             {
                 /* Calculate the force as the sqrt of tav times instantaneous */
-                devins = od->oins[restraintIndex] - ip[type].orires.obs;
+                devins = oriresdata->oins[restraintIndex] - ip[type].orires.obs;
                 if (dev * devins <= 0)
                 {
                     dev = 0;
@@ -732,7 +732,7 @@ real orires(int             nfa,
             {
                 pfac *= invr;
             }
-            mvmul(od->S[ex], r, Sr);
+            mvmul(oriresdata->S[ex], r, Sr);
             for (int i = 0; i < DIM; i++)
             {
                 fij[i] = -pfac * dev * (4 * Sr[i] - 2 * (2 + power) * invr2 * iprod(Sr, r) * r[i]);