diff --git a/src/main.cu b/src/main.cu index feb026f..2b66297 100644 --- a/src/main.cu +++ b/src/main.cu @@ -310,52 +310,96 @@ void run_computes(){ void run_frame_printing() { // I/O blocks // - if (traj_freq > 0 && step % traj_freq == 0) { - print_t_in = int(time(0)); - //cudaDeviceSynchronize(); - - cuda_collect_x(); - write_lammps_traj(); - print_t_out = int(time(0)); - print_tot_time += print_t_out - print_t_in; - } - - if (gsd_freq > 0 && step % gsd_freq == 0) { - print_t_in = int(time(0)); - //cudaDeviceSynchronize(); - - cuda_collect_x(); - write_gsd_traj(); - print_t_out = int(time(0)); - print_tot_time += print_t_out - print_t_in; - } + if (log_traj_flag == 1) { + if (traj_freq > 0 && step % traj_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_x(); + write_lammps_traj(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + traj_freq *= traj_mult_factor; + } + } + else if(traj_freq > 0 && step % traj_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_x(); + write_lammps_traj(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + } - if (grid_freq > 0 && step % grid_freq == 0) { - print_t_in = int(time(0)); - //cudaDeviceSynchronize(); - cuda_collect_rho(); - for (int i = 0; i < ntypes; i++) { - char nm[30]; - sprintf(nm, "rho%d.dat", i); - write_grid_data(nm, Components[i].rho); + if (log_gsd_flag == 1) { + if (gsd_freq > 0 && step % gsd_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_x(); + write_gsd_traj(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + gsd_freq *= gsd_mult_factor; + } + } + else if(gsd_freq > 0 && step % gsd_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_x(); + write_gsd_traj(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; } - print_t_out = int(time(0)); - print_tot_time += print_t_out - print_t_in; - } - - if (bin_freq > 0 && step % bin_freq == 0) { - print_t_in = int(time(0)); - //cudaDeviceSynchronize(); - cuda_collect_rho(); - cuda_collect_x(); + if (log_grid_flag == 1) { + if (grid_freq > 0 && step % grid_freq == 0) { + //cudaDeviceSynchronize(); + cuda_collect_rho(); + for (int i = 0; i < ntypes; i++) { + char nm[30]; + sprintf(nm, "rho%d.dat", i); + write_grid_data(nm, Components[i].rho); + } + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in;; + grid_freq *= grid_mult_factor; + } + } + else if (grid_freq > 0 && step % grid_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_rho(); + for (int i = 0; i < ntypes; i++) { + char nm[30]; + sprintf(nm, "rho%d.dat", i); + write_grid_data(nm, Components[i].rho); + } + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + } - write_binary(); - print_t_out = int(time(0)); - print_tot_time += print_t_out - print_t_in; - } + if (log_bin_flag == 1) { + if (bin_freq > 0 && step % bin_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_rho(); + cuda_collect_x(); + write_binary(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + bin_freq *= bin_mult_factor; + } + } + else if(bin_freq > 0 && step % bin_freq == 0) { + print_t_in = int(time(0)); + //cudaDeviceSynchronize(); + cuda_collect_rho(); + cuda_collect_x(); + write_binary(); + print_t_out = int(time(0)); + print_tot_time += print_t_out - print_t_in; + } } void write_data_header(const char* lbl){ @@ -482,4 +526,4 @@ void set_ft_config(){ global_step = 0; LOW_DENS_FLAG = 0; -} \ No newline at end of file +}