Merge branch 'release-4-5-patches' into release-4-6
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 17 Jan 2013 18:29:08 +0000 (19:29 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 17 Jan 2013 18:48:37 +0000 (19:48 +0100)
Conflicts:
src/gmxlib/disre.c
src/kernel/runner.c
src/mdlib/minimize.c
src/tools/gmx_membed.c

Change-Id: I1d5f72a3a9b8468cf478890791bc67d247c1e2c5

1  2 
include/disre.h
src/gmxlib/disre.c
src/gmxlib/mtop_util.c
src/kernel/gmxdump.c
src/kernel/runner.c
src/mdlib/minimize.c
src/tools/gmx_disre.c
src/tools/gmx_trjconv.c

diff --cc include/disre.h
index 9b7b6df11fe0acb20e379c1a48f965bf75535339,646c7d1830b8bce42b83f9582aafbf33e6a96908..e0e917f4dee9440922b8fb466c7ec4e5d03659dc
  extern "C" {
  #endif
  
 +GMX_LIBGMX_EXPORT
  void init_disres(FILE *fplog,const gmx_mtop_t *mtop,
-                       t_inputrec *ir,const t_commrec *cr,gmx_bool bPartDecomp,
-                       t_fcdata *fcd,t_state *state);
+                  t_inputrec *ir,const t_commrec *cr,gmx_bool bPartDecomp,
+                  t_fcdata *fcd,t_state *state, gmx_bool bIsREMD);
  /* Initiate *fcd data, must be called once, nbonds is the number 
   * of iatoms in the ilist of the idef struct.
   * When time averaging is used, the history is initialized in state,
   * unless it was read before from a checkpoint file.
+  * The implementation of distance restraints with -multi
+  * must differ according to whether REMD is active.
   */
  
 +GMX_LIBGMX_EXPORT
  void calc_disres_R_6(const gmx_multisim_t *ms,
                            int nfa,const t_iatom *fa,const t_iparams ip[],
                            const rvec *x,const t_pbc *pbc,
index 2124384c90448b3f2846e70c5df8a228801fa870,1af415b295920d8e2d8ac1eb24a3d09139c60b32..1b2fddadae03c8fca879d16f523af75e92bb5d71
@@@ -192,18 -190,25 +192,25 @@@ void init_disres(FILE *fplog,const gmx_
          {
              fprintf(fplog,"Found GMX_DISRE_ENSEMBLE_SIZE set to %d systems per ensemble\n",dd->nsystems);
          }
-         check_multi_int(fplog,cr->ms,dd->nsystems,
-                         "the number of systems per ensemble",
-                         FALSE);
+         /* This check is only valid on MASTER(cr), so probably
+          * ensemble-averaged distance restraints are broken on more
+          * than one processor per simulation system. */
+         if (MASTER(cr))
+         {
+             check_multi_int(fplog,cr->ms,dd->nsystems,
 -                            "the number of systems per ensemble");
++                            "the number of systems per ensemble",
++                            FALSE);
+         }
+         gmx_bcast_sim(sizeof(int), &dd->nsystems, cr);
 -        if (dd->nsystems <= 0 ||  cr->ms->nsim % dd->nsystems != 0)
 +        /* We use to allow any value of nsystems which was a divisor
 +         * of ms->nsim. But this required an extra communicator which
 +         * was stored in t_fcdata. This pulled in mpi.h in nearly all C files.
 +         */
 +        if (!(cr->ms->nsim == 1 || cr->ms->nsim == dd->nsystems))
          {
 -            gmx_fatal(FARGS,"The number of systems %d is not divisible by the number of systems per ensemble %d\n",cr->ms->nsim,dd->nsystems);
 +            gmx_fatal(FARGS,"GMX_DISRE_ENSEMBLE_SIZE (%d) is not equal to 1 or the number of systems (option -multi) %d",dd->nsystems,cr->ms->nsim);
          }
 -        /* Split the inter-master communicator into different ensembles */
 -        MPI_Comm_split(cr->ms->mpi_comm_masters,
 -                       cr->ms->sim/dd->nsystems,
 -                       cr->ms->sim,
 -                       &dd->mpi_comm_ensemble);
          if (fplog)
          {
              fprintf(fplog,"Our ensemble consists of systems:");
          if (fplog) {
              fprintf(fplog,"There are %d distance restraints involving %d atom pairs\n",dd->nres,dd->npair);
          }
-         if (cr && cr->ms)
+         /* Have to avoid g_disre de-referencing cr blindly, mdrun not
+          * doing consistency checks for ensemble-averaged distance
+          * restraints when that's not happening, and only doing those
+          * checks from appropriate processes (since check_multi_int is
+          * too broken to check whether the communication will
+          * succeed...) */
+         if (cr && cr->ms && dd->nsystems > 1 && MASTER(cr))
          {
              check_multi_int(fplog,cr->ms,fcd->disres.nres,
 -                            "the number of distance restraints");
 +                            "the number of distance restraints",
 +                            FALSE);
          }
          please_cite(fplog,"Tropp80a");
          please_cite(fplog,"Torda89a");
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge