Пример #1
0
void bcast_state(const t_commrec *cr,t_state *state,bool bAlloc)
{
  int i;

  bcast_state_setup(cr,state);

  if (MASTER(cr)) {
    bAlloc = FALSE;
  }
  if (bAlloc) {
    state->nalloc = state->natoms;
  }
  for(i=0; i<estNR; i++) {
    if (state->flags & (1<<i)) {
      switch (i) {
      case estLAMBDA:  block_bc(cr,state->lambda); break;
      case estBOX:     block_bc(cr,state->box); break;
      case estBOX_REL: block_bc(cr,state->box_rel); break;
      case estBOXV:    block_bc(cr,state->boxv); break;
      case estPRES_PREV: block_bc(cr,state->pres_prev); break;
      case estNH_XI:   nblock_abc(cr,state->ngtc,state->nosehoover_xi); break;
      case estTC_INT:  nblock_abc(cr,state->ngtc,state->therm_integral); break;
      case estX:       nblock_abc(cr,state->natoms,state->x); break;
      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_abc(cr,state->hist.ndisrepairs,state->hist.disre_rm3tav);
	break;
      case estORIRE_INITF: block_bc(cr,state->hist.orire_initf); break;
      case estORIRE_DTAV:
	block_bc(cr,state->hist.norire_Dtav);
	nblock_abc(cr,state->hist.norire_Dtav,state->hist.orire_Dtav);
	break;
      default:
	gmx_fatal(FARGS,
		  "Communication is not implemented for %s in bcast_state",
		  est_names[i]);
      }
    }
  }
}
Пример #2
0
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->flags);
    if (state->lambda == NULL)
    {
        snew_bc(cr, state->lambda, efptNR)
    }

    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);

    /* 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;
    }
    for (i = 0; i < estNR; i++)
    {
        if (state->flags & (1<<i))
        {
            switch (i)
            {
                case estLAMBDA:  nblock_bc(cr, efptNR, state->lambda); break;
                case estFEPSTATE: block_bc(cr, state->fep_state); break;
                case estBOX:     block_bc(cr, state->box); break;
                case estBOX_REL: block_bc(cr, state->box_rel); break;
                case estBOXV:    block_bc(cr, state->boxv); break;
                case estPRES_PREV: block_bc(cr, state->pres_prev); break;
                case estSVIR_PREV: block_bc(cr, state->svir_prev); break;
                case estFVIR_PREV: block_bc(cr, state->fvir_prev); break;
                case estNH_XI:   nblock_abc(cr, nnht, state->nosehoover_xi); break;
                case estNH_VXI:  nblock_abc(cr, nnht, state->nosehoover_vxi); break;
                case estNHPRES_XI:   nblock_abc(cr, nnhtp, state->nhpres_xi); break;
                case estNHPRES_VXI:  nblock_abc(cr, nnhtp, state->nhpres_vxi); break;
                case estTC_INT:  nblock_abc(cr, state->ngtc, state->therm_integral); break;
                case estVETA:    block_bc(cr, state->veta); break;
                case estVOL0:    block_bc(cr, state->vol0); break;
                case estX:       nblock_abc(cr, state->natoms, state->x); break;
                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 estDISRE_INITF: block_bc(cr, state->hist.disre_initf); break;
                case estDISRE_RM3TAV:
                    block_bc(cr, state->hist.ndisrepairs);
                    nblock_abc(cr, state->hist.ndisrepairs, state->hist.disre_rm3tav);
                    break;
                case estORIRE_INITF: block_bc(cr, state->hist.orire_initf); break;
                case estORIRE_DTAV:
                    block_bc(cr, state->hist.norire_Dtav);
                    nblock_abc(cr, state->hist.norire_Dtav, state->hist.orire_Dtav);
                    break;
                default:
                    gmx_fatal(FARGS,
                              "Communication is not implemented for %s in bcast_state",
                              est_names[i]);
            }
        }
    }
}
Пример #3
0
void bcast_state(const t_commrec *cr, t_state *state)
{
    int      i, nnht, nnhtp;

    if (!PAR(cr) || (cr->nnodes - cr->npmenodes <= 1))
    {
        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->flags);
    state->lambda.resize(efptNR);

    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);

    for (i = 0; i < estNR; i++)
    {
        if (state->flags & (1<<i))
        {
            switch (i)
            {
                case estLAMBDA:  nblock_bc(cr, efptNR, state->lambda.data()); break;
                case estFEPSTATE: block_bc(cr, state->fep_state); break;
                case estBOX:     block_bc(cr, state->box); break;
                case estBOX_REL: block_bc(cr, state->box_rel); break;
                case estBOXV:    block_bc(cr, state->boxv); break;
                case estPRES_PREV: block_bc(cr, state->pres_prev); break;
                case estSVIR_PREV: block_bc(cr, state->svir_prev); break;
                case estFVIR_PREV: block_bc(cr, state->fvir_prev); break;
                case estNH_XI:   nblock_abc(cr, nnht, &state->nosehoover_xi); break;
                case estNH_VXI:  nblock_abc(cr, nnht, &state->nosehoover_vxi); break;
                case estNHPRES_XI:   nblock_abc(cr, nnhtp, &state->nhpres_xi); break;
                case estNHPRES_VXI:  nblock_abc(cr, nnhtp, &state->nhpres_vxi); break;
                case estTC_INT:  nblock_abc(cr, state->ngtc, &state->therm_integral); break;
                case estVETA:    block_bc(cr, state->veta); break;
                case estVOL0:    block_bc(cr, state->vol0); break;
                case estX:       bcastPaddedRVecVector(cr, &state->x, state->natoms);
                case estV:       bcastPaddedRVecVector(cr, &state->v, state->natoms);
                case estCGP:     bcastPaddedRVecVector(cr, &state->cg_p, state->natoms);
                case estDISRE_INITF: block_bc(cr, state->hist.disre_initf); break;
                case estDISRE_RM3TAV:
                    block_bc(cr, state->hist.ndisrepairs);
                    nblock_abc(cr, state->hist.ndisrepairs, &state->hist.disre_rm3tav);
                    break;
                case estORIRE_INITF: block_bc(cr, state->hist.orire_initf); break;
                case estORIRE_DTAV:
                    block_bc(cr, state->hist.norire_Dtav);
                    nblock_abc(cr, state->hist.norire_Dtav, &state->hist.orire_Dtav);
                    break;
                default:
                    gmx_fatal(FARGS,
                              "Communication is not implemented for %s in bcast_state",
                              est_names[i]);
            }
        }
    }
}