void init_node_grid() { grid_changed_n_nodes(); cells_on_geometry_change(CELL_FLAG_GRIDCHANGED); }
void on_parameter_change(int field) { EVENT_TRACE(fprintf(stderr, "%d: on_parameter_change %s\n", this_node, fields[field].name)); switch (field) { case FIELD_BOXL: grid_changed_box_l(); /* Electrostatics cutoffs mostly depend on the system size, therefore recalculate them. */ recalc_maximal_cutoff(); cells_on_geometry_change(0); break; case FIELD_MIN_GLOBAL_CUT: recalc_maximal_cutoff(); cells_on_geometry_change(0); break; case FIELD_SKIN: cells_on_geometry_change(0); case FIELD_PERIODIC: cells_on_geometry_change(CELL_FLAG_GRIDCHANGED); break; case FIELD_NODEGRID: grid_changed_n_nodes(); cells_on_geometry_change(CELL_FLAG_GRIDCHANGED); break; case FIELD_MINNUMCELLS: case FIELD_MAXNUMCELLS: cells_re_init(CELL_STRUCTURE_CURRENT); case FIELD_TEMPERATURE: on_temperature_change(); reinit_thermo = 1; break; case FIELD_TIMESTEP: #ifdef LB_GPU if(this_node == 0) { if (lattice_switch & LATTICE_LB_GPU) { lb_reinit_parameters_gpu(); } } #endif #ifdef LB if (lattice_switch & LATTICE_LB) { lb_reinit_parameters(); } #endif case FIELD_LANGEVIN_GAMMA: case FIELD_DPD_TGAMMA: case FIELD_DPD_GAMMA: case FIELD_NPTISO_G0: case FIELD_NPTISO_GV: case FIELD_NPTISO_PISTON: reinit_thermo = 1; break; #ifdef NPT case FIELD_INTEG_SWITCH: if (integ_switch != INTEG_METHOD_NPT_ISO) nptiso.invalidate_p_vel = 1; break; #endif case FIELD_THERMO_SWITCH: /* DPD needs ghost velocities, other thermostats not */ on_ghost_flags_change(); break; #ifdef LB case FIELD_LATTICE_SWITCH: /* LB needs ghost velocities */ on_ghost_flags_change(); break; #endif } }
void on_parameter_change(int field) { /* to prevent two on_coulomb_change */ #if defined(ELECTROSTATICS) || defined(MAGNETOSTATICS) int cc = 0; #endif EVENT_TRACE(fprintf(stderr, "%d: on_parameter_change %s\n", this_node, fields[field].name)); if (field == FIELD_SKIN) { integrate_vv_recalc_maxrange(); on_parameter_change(FIELD_MAXRANGE); } if (field == FIELD_NODEGRID) grid_changed_n_nodes(); if (field == FIELD_BOXL || field == FIELD_NODEGRID) grid_changed_box_l(); if (field == FIELD_TIMESTEP || field == FIELD_TEMPERATURE || field == FIELD_LANGEVIN_GAMMA || field == FIELD_DPD_TGAMMA || field == FIELD_DPD_GAMMA || field == FIELD_NPTISO_G0 || field == FIELD_NPTISO_GV || field == FIELD_NPTISO_PISTON ) reinit_thermo = 1; #ifdef NPT if ((field == FIELD_INTEG_SWITCH) && (integ_switch != INTEG_METHOD_NPT_ISO)) nptiso.invalidate_p_vel = 1; #endif #ifdef ADRESS // if (field == FIELD_BOXL) // adress_changed_box_l(); #endif #ifdef ELECTROSTATICS switch (coulomb.method) { #ifdef ELP3M case COULOMB_ELC_P3M: if (field == FIELD_TEMPERATURE || field == FIELD_BOXL) cc = 1; // fall through case COULOMB_P3M: if (field == FIELD_TEMPERATURE || field == FIELD_NODEGRID || field == FIELD_SKIN) cc = 1; else if (field == FIELD_BOXL) { P3M_scaleby_box_l_charges(); integrate_vv_recalc_maxrange(); } break; #endif case COULOMB_EWALD: if (field == FIELD_TEMPERATURE || field == FIELD_SKIN) cc = 1; else if (field == FIELD_BOXL) { EWALD_scaleby_box_l(); integrate_vv_recalc_maxrange(); } break; case COULOMB_DH: if (field == FIELD_TEMPERATURE) cc = 1; break; case COULOMB_RF: case COULOMB_INTER_RF: if (field == FIELD_TEMPERATURE) cc = 1; break; case COULOMB_MMM1D: if (field == FIELD_TEMPERATURE || field == FIELD_BOXL) cc = 1; break; case COULOMB_MMM2D: if (field == FIELD_TEMPERATURE || field == FIELD_BOXL || field == FIELD_NLAYERS) cc = 1; break; case COULOMB_MAGGS: /* Maggs electrostatics needs ghost velocities */ on_ghost_flags_change(); cells_re_init(CELL_STRUCTURE_CURRENT); break; default: break; } #endif /*ifdef ELECTROSTATICS */ #ifdef MAGNETOSTATICS switch (coulomb.Dmethod) { #ifdef ELP3M case DIPOLAR_MDLC_P3M: if (field == FIELD_TEMPERATURE || field == FIELD_BOXL) cc = 1; // fall through case DIPOLAR_P3M: if (field == FIELD_TEMPERATURE || field == FIELD_NODEGRID || field == FIELD_SKIN) cc = 1; else if (field == FIELD_BOXL) { P3M_scaleby_box_l_dipoles(); integrate_vv_recalc_maxrange(); } break; #endif default: break; } #endif /*ifdef MAGNETOSTATICS */ #if defined(ELECTROSTATICS) || defined(MAGNETOSTATICS) if (cc) on_coulomb_change(); #endif /* DPD needs ghost velocities, other thermostats not */ if (field == FIELD_THERMO_SWITCH) { on_ghost_flags_change(); cells_re_init(CELL_STRUCTURE_CURRENT); } if (field == FIELD_MAXRANGE) rebuild_verletlist = 1; switch (cell_structure.type) { case CELL_STRUCTURE_LAYERED: if (field == FIELD_NODEGRID) { if (node_grid[0] != 1 || node_grid[1] != 1) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{091 layered cellsystem requires 1 1 n node grid} "); } } if (field == FIELD_BOXL || field == FIELD_MAXRANGE || field == FIELD_THERMO_SWITCH) cells_re_init(CELL_STRUCTURE_LAYERED); break; case CELL_STRUCTURE_DOMDEC: if (field == FIELD_BOXL || field == FIELD_NODEGRID || field == FIELD_MAXRANGE || field == FIELD_MINNUMCELLS || field == FIELD_MAXNUMCELLS || field == FIELD_THERMO_SWITCH) cells_re_init(CELL_STRUCTURE_DOMDEC); break; } #ifdef LB /* LB needs ghost velocities */ if (field == FIELD_LATTICE_SWITCH) { on_ghost_flags_change(); cells_re_init(CELL_STRUCTURE_CURRENT); } if (lattice_switch & LATTICE_LB) { if (field == FIELD_TEMPERATURE) { lb_reinit_parameters(); } if (field == FIELD_BOXL || field == FIELD_CELLGRID || field == FIELD_NNODES || field == FIELD_NODEGRID) { lb_init(); } } #endif #ifdef LB_GPU if(this_node == 0){ if (lattice_switch & LATTICE_LB_GPU) { if (field == FIELD_TEMPERATURE) lb_init_gpu(); } } #endif }