예제 #1
0
파일: initialize.c 프로젝트: andmi/espresso
void on_cell_structure_change()
{
    EVENT_TRACE(fprintf(stderr, "%d: on_cell_structure_change\n", this_node));

    /* Now give methods a chance to react to the change in cell
       structure.  Most ES methods need to reinitialize, as they depend
       on skin, node grid and so on. Only for a change in box length we
       have separate, faster methods, as this might happend frequently
       in a NpT simulation. */
#ifdef ELECTROSTATICS
    switch (coulomb.method) {
    case COULOMB_DH:
        break;
#ifdef P3M
    case COULOMB_ELC_P3M:
        ELC_init();
    // fall through
    case COULOMB_P3M:
        p3m_init();
        break;
#endif
    case COULOMB_MMM1D:
        MMM1D_init();
        break;
    case COULOMB_MMM2D:
        MMM2D_init();
        break;
    case COULOMB_MAGGS:
        maggs_init();
        /* Maggs electrostatics needs ghost velocities */
        on_ghost_flags_change();
        break;
    default:
        break;
    }
#endif  /* ifdef ELECTROSTATICS */

#ifdef DIPOLES
    switch (coulomb.Dmethod) {
#ifdef DP3M
    case DIPOLAR_MDLC_P3M:
    // fall through
    case DIPOLAR_P3M:
        dp3m_init();
        break;
#endif
    default:
        break;
    }
#endif  /* ifdef DIPOLES */

#ifdef LB
    if(lattice_switch & LATTICE_LB) {
        lb_init();
    }
#endif
}
예제 #2
0
파일: initialize.c 프로젝트: andmi/espresso
void on_coulomb_change()
{
    EVENT_TRACE(fprintf(stderr, "%d: on_coulomb_change\n", this_node));
    invalidate_obs();

    recalc_coulomb_prefactor();

#ifdef ELECTROSTATICS
    switch (coulomb.method) {
    case COULOMB_DH:
        break;
#ifdef P3M
    case COULOMB_ELC_P3M:
        ELC_init();
    // fall through
    case COULOMB_P3M:
        p3m_init();
        break;
#endif
    case COULOMB_MMM1D:
        MMM1D_init();
        break;
    case COULOMB_MMM2D:
        MMM2D_init();
        break;
    case COULOMB_MAGGS:
        maggs_init();
        /* Maggs electrostatics needs ghost velocities */
        on_ghost_flags_change();
        break;
    default:
        break;
    }
#endif  /* ifdef ELECTROSTATICS */

#ifdef DIPOLES
    switch (coulomb.Dmethod) {
#ifdef DP3M
    case DIPOLAR_MDLC_P3M:
    // fall through
    case DIPOLAR_P3M:
        dp3m_init();
        break;
#endif
    default:
        break;
    }
#endif  /* ifdef DIPOLES */

    /* all Coulomb methods have a short range part, aka near field
       correction. Even in case of switching off, we should call this,
       since the required cutoff might have reduced. */
    on_short_range_ia_change();

    recalc_forces = 1;
}
예제 #3
0
void on_boxl_change() {
  EVENT_TRACE(fprintf(stderr, "%d: on_boxl_change\n", this_node));

  /* Now give methods a chance to react to the change in box length */
#ifdef ELECTROSTATICS
  switch(coulomb.method) {
#ifdef P3M
  case COULOMB_ELC_P3M:
	  ELC_init();
	  // fall through
  case COULOMB_P3M_GPU:
  case COULOMB_P3M:
	  p3m_scaleby_box_l();
	  break;
#endif
  case COULOMB_MMM1D:
	  MMM1D_init();
	  break;
  case COULOMB_MMM2D:
	  MMM2D_init();
	  break;
  case COULOMB_MAGGS: 
	  maggs_init();
	  break;
  default:
	  break;
  }
#endif

#ifdef DIPOLES
  switch(coulomb.Dmethod) {
#ifdef DP3M
  case DIPOLAR_MDLC_P3M:
    // fall through
  case DIPOLAR_P3M:
    dp3m_scaleby_box_l();
    break;
#endif
  default:
      break;
  }
#endif

#ifdef LB
  if(lattice_switch & LATTICE_LB) {
    lb_init();
#ifdef LB_BOUNDARIES
    lb_init_boundaries();
#endif
  }
#endif
}
예제 #4
0
void on_coulomb_change()
{
  EVENT_TRACE(fprintf(stderr, "%d: on_coulomb_change\n", this_node));
  invalidate_obs();

  recalc_coulomb_prefactor();

#ifdef ELECTROSTATICS
  switch (coulomb.method) {
  case COULOMB_DH:
    break;    
#ifdef P3M
#ifdef CUDA
  case COULOMB_P3M_GPU:
    if ( box_l[0] != box_l[1] || box_l[0] != box_l[2] ) {
      fprintf (stderr, "P3M on the GPU requires a cubic box!\n");
      exit(1);
    }
    p3m_gpu_init(p3m.params.cao, p3m.params.mesh[0], p3m.params.alpha, box_l[0]);
    MPI_Bcast(gpu_get_global_particle_vars_pointer_host(), sizeof(CUDA_global_part_vars), MPI_BYTE, 0, comm_cart);
    p3m_init();
    break;
#endif
  case COULOMB_ELC_P3M:
    ELC_init();
    // fall through
  case COULOMB_P3M:
    p3m_init();
    break;
#endif
  case COULOMB_MMM1D:
    MMM1D_init();
    break;
  case COULOMB_MMM2D:
    MMM2D_init();
    break;
  case COULOMB_MAGGS: 
    maggs_init();
    /* Maggs electrostatics needs ghost velocities */
    on_ghost_flags_change();
    break;
  default: break;
  }
#endif  /* ifdef ELECTROSTATICS */

#ifdef DIPOLES
  switch (coulomb.Dmethod) {
#ifdef DP3M
  case DIPOLAR_MDLC_P3M:
    // fall through
  case DIPOLAR_P3M:
    dp3m_init();
    break;
#endif
  default: break;
  }
#endif  /* ifdef DIPOLES */

  /* all Coulomb methods have a short range part, aka near field
     correction. Even in case of switching off, we should call this,
     since the required cutoff might have reduced. */
  on_short_range_ia_change();

  recalc_forces = 1;
}
예제 #5
0
void on_coulomb_change()
{
  EVENT_TRACE(fprintf(stderr, "%d: on_coulomb_change\n", this_node));
  invalidate_obs();

#ifdef ELECTROSTATICS
  if(temperature > 0.0)
    coulomb.prefactor = coulomb.bjerrum * temperature; 
  else
    coulomb.prefactor = coulomb.bjerrum;
  switch (coulomb.method) {
#ifdef ELP3M
  case COULOMB_ELC_P3M:
    ELC_init();
    // fall through
  case COULOMB_P3M:
    P3M_init_charges();
    integrate_vv_recalc_maxrange();
    on_parameter_change(FIELD_MAXRANGE);
    break;
#endif
  case COULOMB_EWALD:
    EWALD_init();
    integrate_vv_recalc_maxrange();
    on_parameter_change(FIELD_MAXRANGE);
    break;
  case COULOMB_MMM1D:
    MMM1D_init();
    break;
  case COULOMB_MMM2D:
    MMM2D_init();
    break;
  case COULOMB_MAGGS: 
    maggs_init(); 
    break;
  default: break;
  }

  recalc_forces = 1;
#endif  /* ifdef ELECTROSTATICS */

#ifdef MAGNETOSTATICS
  if(temperature > 0.0)
    coulomb.Dprefactor = coulomb.Dbjerrum * temperature; 
  else
    coulomb.Dprefactor = coulomb.Dbjerrum;
  
  switch (coulomb.Dmethod) {
#ifdef ELP3M
    case DIPOLAR_MDLC_P3M:
       // fall through
  case DIPOLAR_P3M:
    P3M_init_dipoles();
    integrate_vv_recalc_maxrange();
    on_parameter_change(FIELD_MAXRANGE);
    break;
#endif
  default: break;
  }

  recalc_forces = 1;
#endif  /* ifdef MAGNETOSTATICS */

}