Skip to content

Commit

Permalink
Introduce sim.track_particles()
Browse files Browse the repository at this point in the history
We will have multiple ways to evolve the sim soon (particles,
only ref particle, only linear push of covariance matrix), so
it is time to rename our central loop.

For now, `sim.evolve()` just calls the `sim.track_particles()`
logic.
  • Loading branch information
ax3l committed Oct 11, 2024
1 parent 23b2808 commit f174650
Show file tree
Hide file tree
Showing 68 changed files with 90 additions and 72 deletions.
6 changes: 5 additions & 1 deletion docs/source/usage/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ Collective Effects & Overall Simulation Parameters

.. py:method:: evolve()
Run the main simulation loop for a number of steps.
Run the main simulation loop (deprecated, use ``track_particles``)

.. py:method:: track_particles()
Run the particle tracking simulation loop.

.. py:method:: resize_mesh()
Expand Down
2 changes: 1 addition & 1 deletion examples/achromatic_spectrometer/run_spectrometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/alignment/run_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
sim.lattice.extend(lattice)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/aperture/run_aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/apochromatic/run_apochromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
sim.lattice.extend(lattice_line)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/apochromatic/run_apochromatic_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
sim.lattice.extend(lattice_line)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cfbend/run_cfbend.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
sim.lattice.extend(bend)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cfbend/run_cfbend_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
sim.lattice.load_file("chicane.madx", nslice=25)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel_10nC_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cfchannel/run_cfchannel_10nC_mlmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/chicane/run_chicane.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/chicane/run_chicane_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/chicane/run_chicane_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
sim.lattice.load_file("chicane.madx", nslice=25)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/compression/run_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/coupled_optics/run_coupled_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/cyclotron/run_cyclotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
sim.periods = 150

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/distgen/run_gaussian_twiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/distgen/run_kurth4d.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
sim.lattice.extend(constf)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/distgen/run_kvdist_twiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/distgen/run_semigaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/dogleg/run_dogleg.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/epac2004_benchmarks/run_bithermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/epac2004_benchmarks/run_fodo_rf_SC.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/epac2004_benchmarks/run_thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/expanding_beam/run_expanding_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
sim.lattice.extend([monitor, elements.Drift(name="d1", ds=6.0, nslice=40), monitor])

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/expanding_beam/run_expanding_mlmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
sim.lattice.extend([monitor, elements.Drift(name="d1", ds=6.0, nslice=40), monitor])

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo/run_fodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo/run_fodo_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
sim.lattice.load_file("fodo.madx", nslice=25)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo/run_fodo_twiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo_channel/run_fodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
sim.periods = 101

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo_chromatic/run_fodo_chr.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo_programmable/run_fodo_programmable.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def my_ref_drift(pge, refpart):
sim.lattice.extend(fodo)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo_rf/run_fodo_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
sim.lattice.append(monitor)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/fodo_tune/run_fodo_tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
sim.periods = 100

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
del sim
Expand Down
2 changes: 1 addition & 1 deletion examples/initialize_from_array/run_from_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
]
)

sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/iota_lattice/run_iotalattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
sim.periods = 5

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/iota_lattice/run_iotalattice_sdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
sim.periods = 5

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/iota_lens/run_iotalens.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
sim.lattice.extend(nllens_lattice)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/iota_lens/run_iotalens_sdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
sim.periods = 1

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/kicker/run_hvkicker_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
sim.lattice.load_file("hvkicker.madx", nslice=1)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/kicker/run_kicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
sim.lattice.extend(kicklattice)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/kicker/run_kicker_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
sim.lattice.load_file("kicker.madx", nslice=1)

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
2 changes: 1 addition & 1 deletion examples/kurth/run_kurth_10nC_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
sim.lattice.extend([monitor, drift1, constf1, drift1, monitor])

# run simulation
sim.evolve()
sim.track_particles()

# clean shutdown
sim.finalize()
Loading

0 comments on commit f174650

Please sign in to comment.