@@ -84,6 +84,11 @@ void sparse_format::cal_HSR(const UnitCell& ucell,
8484{
8585 ModuleBase::TITLE (" sparse_format" , " cal_HSR" );
8686
87+ int my_rank = 0 ;
88+ int nproc = 1 ;
89+ MPI_Comm_rank (MPI_COMM_WORLD, &my_rank);
90+ MPI_Comm_size (MPI_COMM_WORLD, &nproc);
91+
8792 // sparse_format::set_R_range(HS_Arrays.all_R_coor, grid);
8893
8994 const int nspin = PARAM.inp .nspin ;
@@ -99,6 +104,20 @@ void sparse_format::cal_HSR(const UnitCell& ucell,
99104#ifdef __MPI
100105 // Fix: Sync all_R_coor across processes
101106 sparse_format::sync_all_R_coor (HS_Arrays.all_R_coor , MPI_COMM_WORLD);
107+
108+ // ===================== MPI debug =====================//
109+ std::string debug_file = " debug_fix_rank_" + std::to_string (my_rank) + " .log" ;
110+ std::ofstream fout (debug_file, std::ios::app);
111+
112+ fout << " Process " << my_rank + 1 << " /" << nproc
113+ << " : HS_Arrays.all_R_coor.size() = " << HS_Arrays.all_R_coor .size () << std::endl;
114+ for (const auto & R: HS_Arrays.all_R_coor )
115+ {
116+ fout << " R = (" << R.x << " , " << R.y << " , " << R.z << " )" << std::endl;
117+ }
118+ fout.close ();
119+ MPI_Barrier (MPI_COMM_WORLD);
120+ // ===================== debug end =====================//
102121#endif
103122
104123 if (TD_Velocity::tddft_velocity)
0 commit comments