Broke some useless dependencies
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 28 Sep 2013 22:51:17 +0000 (00:51 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 1 Oct 2013 17:16:27 +0000 (19:16 +0200)
g_disre does not need t_commrec or t_forcerec

Change-Id: I626487b777f4c18152741a74bd18053eda11c6b2

src/gromacs/gmxana/gmx_disre.c
src/gromacs/gmxlib/bondfree.c
src/gromacs/gmxlib/disre.c
src/gromacs/legacyheaders/disre.h

index 17d2e0facfd660f8404ee658b8daf3e6647ae298..297fa89e47766de44527b5c562a104aa0afb416d 100644 (file)
@@ -142,16 +142,17 @@ static void print5(FILE *fp)
     fprintf(fp, "\n");
 }
 
-static void check_viol(FILE *log, t_commrec *cr,
+static void check_viol(FILE *log,
                        t_ilist *disres, t_iparams forceparams[],
                        rvec x[], rvec f[],
-                       t_forcerec *fr, t_pbc *pbc, t_graph *g, t_dr_result dr[],
+                       t_pbc *pbc, t_graph *g, t_dr_result dr[],
                        int clust_id, int isize, atom_id index[], real vvindex[],
                        t_fcdata *fcd)
 {
     t_iatom         *forceatoms;
     int              i, j, nat, n, type, nviol, ndr, label;
     real             ener, rt, mviol, tviol, viol, lam, dvdl, drt;
+    rvec            *fshift;
     static  gmx_bool bFirst = TRUE;
 
     lam   = 0;
@@ -191,7 +192,7 @@ static void check_viol(FILE *log, t_commrec *cr,
         while (((i+n) < disres->nr) &&
                (forceparams[forceatoms[i+n]].disres.label == label));
 
-        calc_disres_R_6(cr->ms, n, &forceatoms[i], forceparams,
+        calc_disres_R_6(n, &forceatoms[i], forceparams,
                         (const rvec*)x, pbc, fcd, NULL);
 
         if (fcd->disres.Rt_6[0] <= 0)
@@ -206,9 +207,11 @@ static void check_viol(FILE *log, t_commrec *cr,
         dr[clust_id].aver_3[ndr] += drt;
         dr[clust_id].aver_6[ndr] += fcd->disres.Rt_6[0];
 
+        snew(fshift, SHIFTS);
         ener = interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams,
-                                                    (const rvec*)x, f, fr->fshift,
+                                                    (const rvec*)x, f, fshift,
                                                     pbc, g, lam, &dvdl, NULL, fcd, NULL);
+        sfree(fshift);
         viol = fcd->disres.sumviol;
 
         if (viol > 0)
@@ -682,10 +685,8 @@ int gmx_disre(int argc, char *argv[])
     rvec           *xtop;
     gmx_localtop_t *top;
     t_atoms        *atoms = NULL;
-    t_forcerec     *fr;
     t_fcdata        fcd;
     t_nrnb          nrnb;
-    t_commrec      *cr;
     t_graph        *g;
     int             ntopatoms, natoms, i, j, kkk;
     t_trxstatus    *status;
@@ -723,14 +724,13 @@ int gmx_disre(int argc, char *argv[])
     };
 #define NFILE asize(fnm)
 
-    cr  = init_par();
     if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW | PCA_BE_NICE,
                            NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
     {
         return 0;
     }
 
-    gmx_log_open(ftp2fn(efLOG, NFILE, fnm), cr, FALSE, 0, &fplog);
+    fplog = ftp2FILE(efLOG, NFILE, fnm, "w");
 
     if (ntop)
     {
@@ -828,10 +828,6 @@ int gmx_disre(int argc, char *argv[])
     mdatoms = init_mdatoms(fplog, &mtop, ir.efep != efepNO);
     atoms2md(&mtop, &ir, 0, NULL, 0, mtop.natoms, mdatoms);
     update_mdatoms(mdatoms, ir.fepvals->init_lambda);
-    fr      = mk_forcerec();
-    fprintf(fplog, "Made forcerec\n");
-    init_forcerec(fplog, oenv, fr, NULL, &ir, &mtop, cr, box,
-                  NULL, NULL, NULL, NULL, NULL, FALSE, -1);
     init_nrnb(&nrnb);
     if (ir.ePBC != epbcNONE)
     {
@@ -861,15 +857,15 @@ int gmx_disre(int argc, char *argv[])
             }
             my_clust = clust->inv_clust[j];
             range_check(my_clust, 0, clust->clust->nr);
-            check_viol(fplog, cr, &(top->idef.il[F_DISRES]),
+            check_viol(fplog, &(top->idef.il[F_DISRES]),
                        top->idef.iparams,
-                       x, f, fr, pbc_null, g, dr_clust, my_clust, isize, index, vvindex, &fcd);
+                       x, f, pbc_null, g, dr_clust, my_clust, isize, index, vvindex, &fcd);
         }
         else
         {
-            check_viol(fplog, cr, &(top->idef.il[F_DISRES]),
+            check_viol(fplog, &(top->idef.il[F_DISRES]),
                        top->idef.iparams,
-                       x, f, fr, pbc_null, g, &dr, 0, isize, index, vvindex, &fcd);
+                       x, f, pbc_null, g, &dr, 0, isize, index, vvindex, &fcd);
         }
         if (bPDB)
         {
index ae984652fa819bf7f541c09f1a1f01cb6c2dcc19..5b22169427a14df679513740be6aefc645c2eea9 100644 (file)
@@ -4266,10 +4266,16 @@ void calc_bonds(FILE *fplog, const gmx_multisim_t *ms,
     }
     if (idef->il[F_DISRES].nr)
     {
-        calc_disres_R_6(ms, idef->il[F_DISRES].nr,
+        calc_disres_R_6(idef->il[F_DISRES].nr,
                         idef->il[F_DISRES].iatoms,
                         idef->iparams, (const rvec*)x, pbc_null,
                         fcd, hist);
+#ifdef GMX_MPI
+        if (fcd->disres.nsystems > 1)
+        {
+            gmx_sum_sim(2*fcd->disres.nres, fcd->disres.Rt_6, ms);
+        }
+#endif
     }
 
 #pragma omp parallel for num_threads(fr->nthreads) schedule(static)
index b54c0b409119c8f99fc4903fd4fb251f13fd9d2b..b3ab78184bd44dcf746b66d38004aaa8b38c8dbe 100644 (file)
@@ -256,8 +256,7 @@ void init_disres(FILE *fplog, const gmx_mtop_t *mtop,
     }
 }
 
-void calc_disres_R_6(const gmx_multisim_t *ms,
-                     int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+void calc_disres_R_6(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
                      const rvec x[], const t_pbc *pbc,
                      t_fcdata *fcd, history_t *hist)
 {
@@ -360,13 +359,6 @@ void calc_disres_R_6(const gmx_multisim_t *ms,
 
         res++;
     }
-
-#ifdef GMX_MPI
-    if (dd->nsystems > 1)
-    {
-        gmx_sum_sim(2*dd->nres, Rt_6, ms);
-    }
-#endif
 }
 
 real ta_disres(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
index 6abbd710a5706c998c531ea226dc431701cc303f..08924f926521fedc296d2fc94fadbe0f2293ef63 100644 (file)
@@ -55,8 +55,7 @@ void init_disres(FILE *fplog, const gmx_mtop_t *mtop,
  * must differ according to whether REMD is active.
  */
 
-void calc_disres_R_6(const gmx_multisim_t *ms,
-                     int nfa, const t_iatom *fa, const t_iparams ip[],
+void calc_disres_R_6(int nfa, const t_iatom *fa, const t_iparams ip[],
                      const rvec *x, const t_pbc *pbc,
                      t_fcdata *fcd, history_t *hist);
 /* Calculates r and r^-3 (inst. and time averaged) for all pairs