@@ -288,26 +288,29 @@ WarpX::WarpX ()
288
288
t_old.resize (nlevs_max, std::numeric_limits<Real>::lowest ());
289
289
dt.resize (nlevs_max, std::numeric_limits<Real>::max ());
290
290
291
- // Loop over species (particles and lasers)
292
- // and set current injection position per species
293
291
mypc = std::make_unique<MultiParticleContainer>(this );
294
- const int n_containers = mypc->nContainers ();
295
- for (int i=0 ; i<n_containers; i++)
296
- {
297
- WarpXParticleContainer& pc = mypc->GetParticleContainer (i);
298
292
299
- // Storing injection position for all species, regardless of whether
300
- // they are continuously injected, since it makes looping over the
301
- // elements of current_injection_position easier elsewhere in the code.
302
- if (moving_window_v > 0 ._rt )
303
- {
304
- // Inject particles continuously from the right end of the box
305
- pc.m_current_injection_position = geom[0 ].ProbHi (moving_window_dir);
306
- }
307
- else if (moving_window_v < 0 ._rt )
293
+ // Loop over species (particles and lasers)
294
+ // and set current injection position per species
295
+ if (do_moving_window){
296
+ const int n_containers = mypc->nContainers ();
297
+ for (int i=0 ; i<n_containers; i++)
308
298
{
309
- // Inject particles continuously from the left end of the box
310
- pc.m_current_injection_position = geom[0 ].ProbLo (moving_window_dir);
299
+ WarpXParticleContainer& pc = mypc->GetParticleContainer (i);
300
+
301
+ // Storing injection position for all species, regardless of whether
302
+ // they are continuously injected, since it makes looping over the
303
+ // elements of current_injection_position easier elsewhere in the code.
304
+ if (moving_window_v > 0 ._rt )
305
+ {
306
+ // Inject particles continuously from the right end of the box
307
+ pc.m_current_injection_position = geom[0 ].ProbHi (moving_window_dir);
308
+ }
309
+ else if (moving_window_v < 0 ._rt )
310
+ {
311
+ // Inject particles continuously from the left end of the box
312
+ pc.m_current_injection_position = geom[0 ].ProbLo (moving_window_dir);
313
+ }
311
314
}
312
315
}
313
316
0 commit comments