void on_resort_particles() { EVENT_TRACE(fprintf(stderr, "%d: on_resort_particles\n", this_node)); #ifdef ELECTROSTATICS switch (coulomb.method) { #ifdef ELP3M case COULOMB_ELC_P3M: ELC_on_resort_particles(); break; #endif case COULOMB_MMM2D: MMM2D_on_resort_particles(); break; case COULOMB_EWALD: EWALD_on_resort_particles(); break; default: break; } #endif /* ifdef ELECTROSTATICS */ #ifdef MAGNETOSTATICS switch (coulomb.Dmethod) { #ifdef ELP3M case DIPOLAR_MDLC_P3M: /* dlc_on_resort_particles(); NOT NECESSARY DUE TO HOW WE COMPUTE THINGS*/ break; #endif default: break; } #endif /* ifdef MAGNETOSTATICS*/ }
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 */ }
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 }
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; }
void on_short_range_ia_change() { EVENT_TRACE(fprintf(stderr, "%d: on_short_range_ia_changes\n", this_node)); invalidate_obs(); recalc_maximal_cutoff(); cells_on_geometry_change(0); recalc_forces = 1; }
void on_short_range_ia_change() { EVENT_TRACE(fprintf(stderr, "%d: on_short_range_ia_changes\n", this_node)); invalidate_obs(); integrate_vv_recalc_maxrange(); on_parameter_change(FIELD_MAXRANGE); recalc_forces = 1; }
void on_lb_params_change(int field) { EVENT_TRACE(fprintf(stderr, "%d: on_lb_params_change\n", this_node)); if (field == LBPAR_AGRID) { lb_init(); } if (field == LBPAR_DENSITY) { lb_reinit_fluid(); } lb_reinit_parameters(); }
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 }
int on_program_start(Tcl_Interp *interp) { EVENT_TRACE(fprintf(stderr, "%d: on_program_start\n", this_node)); /* call the initialization of the modules here */ init_random(); init_bit_random(); setup_node_grid(); /* calculate initial minimimal number of cells (see tclcallback_min_num_cells) */ min_num_cells = calc_processor_min_num_cells(); cells_pre_init(); ghost_init(); /* Initialise force and energy tables */ force_and_energy_tables_init(); #ifdef ADRESS #ifdef INTERFACE_CORRECTION adress_force_and_energy_tables_init(); #endif /** #ifdef THERMODYNAMIC_FORCE */ tf_tables_init(); /** #endif */ #endif #ifdef ELP3M fft_pre_init(); #endif #ifdef LB_GPU if(this_node == 0){ lb_pre_init_gpu(); } #endif #ifdef LB lb_pre_init(); #endif /* call all initializations to do only on the master node here. */ if (this_node == 0) { /* interaction_data.c: make sure 0<->0 ia always exists */ make_particle_type_exist(0); init_tcl(interp); } return TCL_OK; }
void on_constraint_change() { EVENT_TRACE(fprintf(stderr, "%d: on_constraint_change\n", this_node)); invalidate_obs(); #ifdef LB #ifdef CONSTRAINTS if(lattice_switch & LATTICE_LB) { lb_init_constraints(); } #endif #endif recalc_forces = 1; }
void on_particle_change() { EVENT_TRACE(fprintf(stderr, "%d: on_particle_change\n", this_node)); resort_particles = 1; reinit_electrostatics = 1; reinit_magnetostatics = 1; #ifdef LB_GPU lb_reinit_particles_gpu = 1; #endif invalidate_obs(); /* the particle information is no longer valid */ freePartCfg(); }
void on_lb_params_change_gpu(int field) { EVENT_TRACE(fprintf(stderr, "%d: on_lb_params_change_gpu\n", this_node)); #ifdef LB_GPU if (field == LBPAR_AGRID) { lb_init_gpu(); #ifdef LB_BOUNDARIES_GPU lb_init_boundaries(); #endif } if (field == LBPAR_DENSITY) { lb_reinit_fluid_gpu(); } lb_reinit_parameters_gpu(); #endif }
void on_temperature_change() { EVENT_TRACE(fprintf(stderr, "%d: on_temperature_change\n", this_node)); #ifdef LB if (lattice_switch & LATTICE_LB) { lb_reinit_parameters(); } #endif #ifdef LB_GPU if(this_node == 0) { if (lattice_switch & LATTICE_LB_GPU) { lb_reinit_parameters_gpu(); } } #endif }
void on_lbboundary_change() { EVENT_TRACE(fprintf(stderr, "%d: on_lbboundary_change\n", this_node)); invalidate_obs(); #ifdef LB_BOUNDARIES if(lattice_switch & LATTICE_LB) { lb_init_boundaries(); } #endif #ifdef LB_BOUNDARIES_GPU if(this_node == 0) { if(lattice_switch & LATTICE_LB_GPU) { lb_init_boundaries(); } } #endif recalc_forces = 1; }
void on_resort_particles() { EVENT_TRACE(fprintf(stderr, "%d: on_resort_particles\n", this_node)); #ifdef ELECTROSTATICS switch (coulomb.method) { #ifdef P3M case COULOMB_ELC_P3M: ELC_on_resort_particles(); break; #endif case COULOMB_MMM2D: MMM2D_on_resort_particles(); break; default: break; } #endif /* ifdef ELECTROSTATICS */ /* DIPOLAR interactions so far don't need this */ recalc_forces = 1; }
void on_ghost_flags_change() { EVENT_TRACE(fprintf(stderr, "%d: on_ghost_flags_change\n", this_node)); /* that's all we change here */ extern int ghosts_have_v; int old_have_v = ghosts_have_v; ghosts_have_v = 0; /* DPD and LB need also ghost velocities */ if (thermo_switch & THERMO_DPD) ghosts_have_v = 1; #ifdef LB if (lattice_switch & LATTICE_LB) ghosts_have_v = 1; #endif #ifdef BOND_CONSTRAINT else if (n_rigidbonds) ghosts_have_v = 1; #endif #ifdef ELECTROSTATICS /* Maggs electrostatics needs ghost velocities too */ else if(coulomb.method == COULOMB_MAGGS) ghosts_have_v = 1; #endif #ifdef INTER_DPD //maybe we have to add a new global to differ between compile in and acctual use. ghosts_have_v = 1; #endif #ifdef VIRTUAL_SITES //VIRUTAL_SITES need v to update v of virtual sites ghosts_have_v = 1; #endif if (old_have_v != ghosts_have_v) cells_re_init(CELL_STRUCTURE_CURRENT); }
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; }
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 }
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_program_start() { EVENT_TRACE(fprintf(stderr, "%d: on_program_start\n", this_node)); /* tell Electric fence that we do realloc(0) on purpose. */ #ifdef EFENCE extern int EF_ALLOW_MALLOC_0; EF_ALLOW_MALLOC_0 = 1; #endif register_sigint_handler(); if (this_node == 0) { /* master node */ #ifdef FORCE_CORE /* core should be the last exit handler (process dies) */ atexit(core); #endif atexit(mpi_stop); } /* call the initialization of the modules here */ init_random(); init_bit_random(); setup_node_grid(); /* calculate initial minimimal number of cells (see tclcallback_min_num_cells) */ min_num_cells = calc_processor_min_num_cells(); /* initially go for domain decomposition */ dd_topology_init(&local_cells); ghost_init(); /* Initialise force and energy tables */ force_and_energy_tables_init(); #ifdef ADRESS #ifdef INTERFACE_CORRECTION adress_force_and_energy_tables_init(); #endif /* #ifdef THERMODYNAMIC_FORCE */ tf_tables_init(); /* #endif */ #endif #ifdef P3M p3m_pre_init(); #endif #ifdef DP3M dp3m_pre_init(); #endif #ifdef LB_GPU if(this_node == 0) { //lb_pre_init_gpu(); } #endif #ifdef LB lb_pre_init(); #endif #ifdef REACTIONS reaction.back_rate=-1.0; #endif /* call all initializations to do only on the master node here. */ if (this_node == 0) { /* interaction_data.c: make sure 0<->0 ia always exists */ make_particle_type_exist(0); } }
void on_integration_start() { char *errtext; int i; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } for (i = 0; i < 3; i++) if (local_box_l[i] < max_range) { errtext = runtime_error(128 + TCL_INTEGER_SPACE); ERROR_SPRINTF(errtext,"{013 box_l in direction %d is still too small} ", i); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } if(cell_structure.type!=CELL_STRUCTURE_DOMDEC) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt requires domain decomposition cellsystem} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef ELP3M case COULOMB_P3M: break; #endif /*ELP3M*/ case COULOMB_EWALD: break; default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with Ewald sum or P3M} "); } } #endif /*ELECTROSTATICS*/ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } } #endif #ifdef LB_GPU if(this_node == 0){ if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
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 */ }
void on_constraint_change() { EVENT_TRACE(fprintf(stderr, "%d: on_constraint_change\n", this_node)); invalidate_obs(); recalc_forces = 1; }
void on_cell_structure_change() { EVENT_TRACE(fprintf(stderr, "%d: on_cell_structure_change\n", this_node)); on_coulomb_change(); }
void on_integration_start() { EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ integrator_sanity_checks(); #ifdef NPT integrator_npt_sanity_checks(); #endif interactions_sanity_checks(); #ifdef CATALYTIC_REACTIONS reactions_sanity_checks(); #endif #ifdef LB if(lattice_switch & LATTICE_LB) { lb_sanity_checks(); } #endif #ifdef LB_GPU if(lattice_switch & LATTICE_LB_GPU) { lb_GPU_sanity_checks(); } #endif /********************************************/ /* end sanity checks */ /********************************************/ #ifdef LB_GPU if(this_node == 0){ if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } #endif #ifdef CUDA if (reinit_particle_comm_gpu){ gpu_change_number_of_part_to_comm(); reinit_particle_comm_gpu = 0; } MPI_Bcast(gpu_get_global_particle_vars_pointer_host(), sizeof(CUDA_global_part_vars), MPI_BYTE, 0, comm_cart); #endif #ifdef METADYNAMICS meta_init(); #endif /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.cpp */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
void on_integration_start() { char *errtext; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef P3M case COULOMB_P3M: break; #endif /*P3M*/ default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with P3M} "); } } #endif /*ELECTROSTATICS*/ #ifdef DIPOLES switch (coulomb.Dmethod) { case DIPOLAR_NONE: break; #ifdef DP3M case DIPOLAR_P3M: break; #endif default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"NpT does not work with your dipolar method, please use P3M."); } } #endif /* ifdef DIPOLES */ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (dd.use_vList && skin>=lbpar.agrid/2.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{104 LB requires either no Verlet lists or that the skin of the verlet list to be less than half of lattice-Boltzmann grid spacing.} "); } } #endif #ifdef LB_GPU if(this_node == 0){ if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif #ifdef CATALYTIC_REACTIONS if(reaction.ct_rate != 0.0) { if( dd.use_vList == 0 || cell_structure.type != CELL_STRUCTURE_DOMDEC) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{105 The CATALYTIC_REACTIONS feature requires verlet lists and domain decomposition} "); check_runtime_errors(); } if(max_cut < reaction.range) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{106 Reaction range of %f exceeds maximum cutoff of %f} ", reaction.range, max_cut); } } #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
void on_integration_start() { char *errtext; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef P3M case COULOMB_P3M: break; #endif /*P3M*/ default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with P3M} "); } } #endif /*ELECTROSTATICS*/ #ifdef DIPOLES switch (coulomb.Dmethod) { case DIPOLAR_NONE: break; #ifdef DP3M case DIPOLAR_P3M: break; #endif default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"NpT does not work with your dipolar method, please use P3M."); } } #endif /* ifdef DIPOLES */ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (dd.use_vList && skin>=lbpar.agrid/2.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{104 LB requires either no Verlet lists or that the skin of the verlet list to be less than half of lattice-Boltzmann grid spacing.} "); } } #endif #ifdef LB_GPU if(this_node == 0) { if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif #ifdef REACTIONS if(reaction.rate != 0.0) { if(max_cut < reaction.range) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{105 Reaction range of %f exceeds maximum cutoff of %f} ", reaction.range, max_cut); } } #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); #ifdef SCAFACOS /* initialize Scafacos, set up the system and solver specific parameters, all on each node. functions include MPI_Bcast */ mpi_bcast_coulomb_method(); switch(coulomb.method) { case COULOMB_SCAFACOS_DIRECT: case COULOMB_SCAFACOS_EWALD: case COULOMB_SCAFACOS_FMM: case COULOMB_SCAFACOS_MEMD: case COULOMB_SCAFACOS_MMM1D: case COULOMB_SCAFACOS_MMM2D: case COULOMB_SCAFACOS_P2NFFT: case COULOMB_SCAFACOS_P3M: case COULOMB_SCAFACOS_PEPC: case COULOMB_SCAFACOS_PP3MG: case COULOMB_SCAFACOS_VMG: { mpi_scafacos_bcast_common_params(); mpi_scafacos_bcast_solver_specific(); mpi_scafacos_init(); mpi_scafacos_common_set(); mpi_scafacos_solver_specific_set(); break; } default: break; } /* tune in order to generate at least defaults for cutoff, transfer the cutoff back to Espresso and generate new cell system on each node*/ switch(coulomb.method) { case COULOMB_SCAFACOS_P2NFFT: if( scafacos.short_range_flag == 0 ) { scafacos_tune(); recalc_maximal_cutoff(); cells_on_geometry_change(0); } break; case COULOMB_SCAFACOS_P3M: if( scafacos.short_range_flag == 0 ) { scafacos_tune(); recalc_maximal_cutoff(); cells_on_geometry_change(0); } default: break; } #endif /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }