diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp index dfc090a0d9620fca665b6c059e48615fd8904862..ae4fae9fed32536d117bd990fb9c80ca30ac5c83 100644 --- a/src/cluster/cluster.cpp +++ b/src/cluster/cluster.cpp @@ -434,6 +434,11 @@ void cluster(const string& config_file, const string& data_file, const string& o p_outarray[myompthread] = p_output_2; } int jer = cluster_jxi488_cycle(myjxi488, sconf, gconf, p_scattering_angles, cid_2, p_output_2, output_path, vtppoanp_2); + } else { + if (myompthread > 0) { + // If there is no input for this thread, set output pointer to NULL. + p_outarray[myompthread] = NULL; + } } #pragma omp barrier @@ -616,7 +621,12 @@ void cluster(const string& config_file, const string& data_file, const string& o p_outarray[0] = p_output_2; } int jer = cluster_jxi488_cycle(myjxi488, sconf, gconf, p_scattering_angles, cid_2, p_output_2, output_path, vtppoanp_2); - } // close the OMP parallel for loop + } else { + if (myompthread > 0) { + // If there is no input for this thread, set the output pointer to NULL. + p_outarray[myompthread] = NULL; + } + } #pragma omp barrier // threads different from 0 append their virtual files to the one of thread 0, and delete them