* the research papers on the package. Check out http://www.gromacs.org.
*/
/* This file is completely threadsafe - keep it that way! */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/mvdata.h"
#include <string.h>
-#include "typedefs.h"
-#include "main.h"
-#include "mvdata.h"
-#include "network.h"
-#include "smalloc.h"
-#include "gmx_fatal.h"
-#include "symtab.h"
-#include "vec.h"
-#include "tgroup.h"
+#include "gromacs/legacyheaders/main.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/tgroup.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/topology/symtab.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
#define block_bc(cr, d) gmx_bcast( sizeof(d), &(d), (cr))
/* Probably the test for (nr) > 0 in the next macro is only needed
}
}
-void bcast_state_setup(const t_commrec *cr, t_state *state)
+void bcast_state(const t_commrec *cr, t_state *state)
{
+ int i, nnht, nnhtp;
+ gmx_bool bAlloc;
+
+ if (!PAR(cr))
+ {
+ return;
+ }
+
+ /* Broadcasts the state sizes and flags from the master to all nodes
+ * in cr->mpi_comm_mygroup. The arrays are not broadcasted. */
block_bc(cr, state->natoms);
block_bc(cr, state->ngtc);
block_bc(cr, state->nnhpres);
block_bc(cr, state->nhchainlength);
- block_bc(cr, state->nrng);
- block_bc(cr, state->nrngi);
block_bc(cr, state->flags);
if (state->lambda == NULL)
{
snew_bc(cr, state->lambda, efptNR)
}
-}
-
-void bcast_state(const t_commrec *cr, t_state *state, gmx_bool bAlloc)
-{
- int i, nnht, nnhtp;
- bcast_state_setup(cr, state);
+ if (cr->dd)
+ {
+ /* We allocate dynamically in dd_partition_system. */
+ return;
+ }
+ /* The code below is reachable only by TPI and NM, so it is not
+ tested by anything. */
nnht = (state->ngtc)*(state->nhchainlength);
nnhtp = (state->nnhpres)*(state->nhchainlength);
- if (MASTER(cr))
- {
- bAlloc = FALSE;
- }
+ /* We still need to allocate the arrays in state for non-master
+ * ranks, which is done (implicitly via bAlloc) in the dirty,
+ * dirty nblock_abc macro. */
+ bAlloc = !MASTER(cr);
if (bAlloc)
{
state->nalloc = state->natoms;
case estV: nblock_abc(cr, state->natoms, state->v); break;
case estSDX: nblock_abc(cr, state->natoms, state->sd_X); break;
case estCGP: nblock_abc(cr, state->natoms, state->cg_p); break;
- case estLD_RNG: if (state->nrngi == 1)
- {
- nblock_abc(cr, state->nrng, state->ld_rng);
- }
- break;
- case estLD_RNGI: if (state->nrngi == 1)
- {
- nblock_abc(cr, state->nrngi, state->ld_rngi);
- }
- break;
case estDISRE_INITF: block_bc(cr, state->hist.disre_initf); break;
case estDISRE_RM3TAV:
block_bc(cr, state->hist.ndisrepairs);
nblock_bc(cr, adress->n_energy_grps, adress->group_explicit);
}
}
+
+static void bc_imd(const t_commrec *cr, t_IMD *imd)
+{
+ int g;
+
+ block_bc(cr, *imd);
+ snew_bc(cr, imd->ind, imd->nat);
+ nblock_bc(cr, imd->nat, imd->ind);
+}
+
static void bc_fepvals(const t_commrec *cr, t_lambda *fep)
{
gmx_bool bAlloc = TRUE;
block_bc(cr, fep->init_lambda);
block_bc(cr, fep->init_fep_state);
block_bc(cr, fep->delta_lambda);
- block_bc(cr, fep->bPrintEnergy);
+ block_bc(cr, fep->edHdLPrintEnergy);
block_bc(cr, fep->n_lambda);
if (fep->n_lambda > 0)
{
}
}
+
+static void bc_swapions(const t_commrec *cr, t_swapcoords *swap)
+{
+ int i;
+
+
+ block_bc(cr, *swap);
+
+ /* Broadcast ion group atom indices */
+ snew_bc(cr, swap->ind, swap->nat);
+ nblock_bc(cr, swap->nat, swap->ind);
+
+ /* Broadcast split groups atom indices */
+ for (i = 0; i < 2; i++)
+ {
+ snew_bc(cr, swap->ind_split[i], swap->nat_split[i]);
+ nblock_bc(cr, swap->nat_split[i], swap->ind_split[i]);
+ }
+
+ /* Broadcast solvent group atom indices */
+ snew_bc(cr, swap->ind_sol, swap->nat_sol);
+ nblock_bc(cr, swap->nat_sol, swap->ind_sol);
+}
+
+
static void bc_inputrec(const t_commrec *cr, t_inputrec *inputrec)
{
gmx_bool bAlloc = TRUE;
snew_bc(cr, inputrec->rot, 1);
bc_rot(cr, inputrec->rot);
}
+ if (inputrec->bIMD)
+ {
+ snew_bc(cr, inputrec->imd, 1);
+ bc_imd(cr, inputrec->imd);
+ }
for (i = 0; (i < DIM); i++)
{
bc_cosines(cr, &(inputrec->ex[i]));
bc_cosines(cr, &(inputrec->et[i]));
}
+ if (inputrec->eSwapCoords != eswapNO)
+ {
+ snew_bc(cr, inputrec->swap, 1);
+ bc_swapions(cr, inputrec->swap);
+ }
if (inputrec->bAdress)
{
snew_bc(cr, inputrec->adress, 1);