Пример #1
0
static void receive_virial_energy(t_commrec *cr,
				  matrix vir,real *energy,real *dvdlambda,
				  float *pme_cycles) 
{
  gmx_pme_comm_vir_ene_t cve;

  if (cr->dd->pme_receive_vir_ener) {
    if (debug)
      fprintf(debug,
	      "PP node %d receiving from PME node %d: virial and energy\n",
	      cr->sim_nodeid,cr->dd->pme_nodeid);
#ifdef GMX_MPI
    MPI_Recv(&cve,sizeof(cve),MPI_BYTE,cr->dd->pme_nodeid,1,cr->mpi_comm_mysim,
	     MPI_STATUS_IGNORE);
#else
    memset(&cve,0,sizeof(cve));
#endif
	
    m_add(vir,cve.vir,vir);
    *energy = cve.energy;
    *dvdlambda += cve.dvdlambda;
    *pme_cycles = cve.cycles;

    if ( cve.stop_cond != gmx_stop_cond_none )
    {
        gmx_set_stop_condition(cve.stop_cond);
    }
  } else {
    *energy = 0;
    *pme_cycles = 0;
  }
}
Пример #2
0
/*! \brief Receive virial and energy from PME rank */
static void receive_virial_energy(t_commrec *cr,
                                  matrix vir_q, real *energy_q,
                                  matrix vir_lj, real *energy_lj,
                                  real *dvdlambda_q, real *dvdlambda_lj,
                                  float *pme_cycles)
{
    gmx_pme_comm_vir_ene_t cve;

    if (cr->dd->pme_receive_vir_ener)
    {
        if (debug)
        {
            fprintf(debug,
                    "PP rank %d receiving from PME rank %d: virial and energy\n",
                    cr->sim_nodeid, cr->dd->pme_nodeid);
        }
#if GMX_MPI
        MPI_Recv(&cve, sizeof(cve), MPI_BYTE, cr->dd->pme_nodeid, 1, cr->mpi_comm_mysim,
                 MPI_STATUS_IGNORE);
#else
        memset(&cve, 0, sizeof(cve));
#endif

        m_add(vir_q, cve.vir_q, vir_q);
        m_add(vir_lj, cve.vir_lj, vir_lj);
        *energy_q      = cve.energy_q;
        *energy_lj     = cve.energy_lj;
        *dvdlambda_q  += cve.dvdlambda_q;
        *dvdlambda_lj += cve.dvdlambda_lj;
        *pme_cycles    = cve.cycles;

        if (cve.stop_cond != gmx_stop_cond_none)
        {
            gmx_set_stop_condition(cve.stop_cond);
        }
    }
    else
    {
        *energy_q   = 0;
        *energy_lj  = 0;
        *pme_cycles = 0;
    }
}