@@ -83,7 +83,9 @@ void MSST::first_half()
8383
8484 const int sd = mdp.msst_direction;
8585 const double dthalf = 0.5 * mdp.md_dt;
86-
86+ double vol;
87+ if( GlobalV::MY_RANK == 0 )
88+ {
8789 energy_ = potential + kinetic;
8890
8991 // propagate the time derivative of volume 1/2 step
@@ -112,7 +114,7 @@ void MSST::first_half()
112114 propagate_vel();
113115
114116 // propagate volume 1/2 step
115- double vol = ucell.omega + omega[sd] * dthalf;
117+ vol = ucell.omega + omega[sd] * dthalf;
116118
117119 // rescale positions and change box size
118120 rescale(vol);
@@ -122,6 +124,11 @@ void MSST::first_half()
122124 {
123125 pos[i] += vel[i] * mdp.md_dt;
124126 }
127+ }
128+ #ifdef __MPI
129+ MPI_Bcast(pos , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
130+ #endif
131+
125132 ucell.update_pos_tau(pos);
126133 ucell.periodic_boundary_adjustment();
127134
@@ -141,7 +148,8 @@ void MSST::second_half()
141148
142149 const int sd = mdp.msst_direction;
143150 const double dthalf = 0.5 * mdp.md_dt;
144-
151+ if( GlobalV::MY_RANK == 0 )
152+ {
145153 energy_ = potential + kinetic;
146154
147155 // propagate velocities 1/2 step
@@ -156,6 +164,7 @@ void MSST::second_half()
156164
157165 // calculate Lagrangian position
158166 lag_pos -= mdp.msst_vel * ucell.omega / v0 * mdp.md_dt;
167+ }
159168
160169 ModuleBase::timer::tick("MSST", "second_half");
161170}
0 commit comments