示例#1
0
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
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_observable_calc()
{
  /* Prepare particle structure: Communication step: number of ghosts and ghost information */

  if(resort_particles) {
    cells_resort_particles(CELL_GLOBAL_EXCHANGE);
    resort_particles = 0;
  }

#ifdef ELECTROSTATICS  
  if(reinit_electrostatics) {
    EVENT_TRACE(fprintf(stderr, "%d: reinit_electrostatics\n", this_node));
    switch (coulomb.method) {
#ifdef ELP3M
    case COULOMB_ELC_P3M:
    case COULOMB_P3M:
      P3M_count_charged_particles();
      break;
#endif
    case COULOMB_EWALD:
      EWALD_count_charged_particles();
      break;
    case COULOMB_MAGGS: 
      maggs_init(); 
      break;
    default: break;
    }
    reinit_electrostatics = 0;
  }
#endif /*ifdef ELECTROSTATICS */

#ifdef MAGNETOSTATICS
  if(reinit_magnetostatics) {
    EVENT_TRACE(fprintf(stderr, "%d: reinit_magnetostatics\n", this_node));
    switch (coulomb.Dmethod) {
    #ifdef ELP3M
    case DIPOLAR_MDLC_P3M:
    case DIPOLAR_P3M:
      P3M_count_magnetic_particles();
      break;
#endif
    default: break;
    }
    reinit_magnetostatics = 0;
  }
#endif /*ifdef ELECTROSTATICS */
}
示例#5
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;
}
示例#6
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 */

}