Lorentz Force & Charged Particle Simulator Back
Physics Simulator

Lorentz Force & Charged Particle Simulator

Animate the trajectory of electrons, protons, and arbitrary charged particles in magnetic and electric fields in real time. Automatically calculate Lorentz force, cyclotron radius, and cyclotron frequency.

Parameters
Particle type
Charge q
×1.6×10⁻¹⁹ C
Mass m
x reference mass m0, log scale
Initial velocity vx
Initial velocity vy
magnetic field B
⊙ out of page / ⊗ into page (B > 0 / B < 0)
Electric field Ex
Electric field Ey
Playback Controls
t = 0.00 s
Drag the particle on the canvas to change its initial position
Results
Lorentz force F [N]
Gyroradius r [m]
Cyclotron Frequency fc
period T [s]
Visualization
Theory & Key Formulas

Lorentz force:

$$\vec{F}= q(\vec{E}+ \vec{v}\times \vec{B})$$

Gyroradius in a pure magnetic field: $r = \dfrac{mv}{|q|B}$

Cyclotron frequency: \ = \dfrac{|q|B}{2\pi m}\$ Period: \ = \dfrac{2\pi m}{|q|B}\$

Equation of motion: $m\dot{\vec{v}}= q(\vec{E}+ \vec{v}\times\vec{B})$, numerically integrated with RK4

What is Lorentz Force & Charged Particle Motion?

What exactly is the Lorentz force? I see it's the core of this simulator.
Basically, it's the total electromagnetic force on a charged particle. It has two parts: the electric force ($q\vec{E}$) and the magnetic force ($q\vec{v}\times \vec{B}$). In practice, the magnetic part is special because it's always perpendicular to the particle's velocity, so it can't speed it up or slow it down, only change its direction. Try setting the electric fields (Ex, Ey) to zero and giving the particle some initial velocity (vx, vy) in a magnetic field (B). You'll see it starts turning immediately.
Wait, really? So if the magnetic force can't change the speed, does that mean the particle just goes in a perfect circle forever?
In a perfectly uniform magnetic field with no electric field, yes! That's called cyclotron motion. The simulator calculates the radius of that circle for you. For instance, a fast-moving electron (high vx, vy) in a weak magnetic field (low B) will have a huge orbit. Try it: select "Electron" and crank up the initial speed while lowering the B-field slider. Watch the orbit radius grow on the plot.
That makes sense. But what happens when you turn the electric field back on? The path looks way more complicated.
Great observation! Now the electric force can change the particle's speed and energy. The resulting motion is a combination of a circular gyration and a steady drift perpendicular to both fields. This is called E×B drift. A common case is setting Ex=1 and B=1. The particle will slowly drift in the y-direction while gyrating. Change the particle type from an electron to a proton and see how the drift direction reverses because the charge $q$ changed sign!

Physical Model & Key Equations

The fundamental law of motion is Newton's second law with the Lorentz force as the driving mechanism. This gives us the equation of motion for the charged particle.

$$m \frac{d\vec{v}}{dt}= \vec{F}= q(\vec{E}+ \vec{v}\times \vec{B})$$

Here, $m$ is particle mass (kg), $q$ is electric charge (C), $\vec{v}$ is velocity (m/s), $\vec{E}$ is the electric field (V/m), and $\vec{B}$ is the magnetic flux density (T). The cross product $\vec{v}\times \vec{B}$ ensures the magnetic force is perpendicular to the plane containing $\vec{v}$ and $\vec{B}$.

For the special case of a uniform magnetic field ($\vec{B}=B\hat{z}$) and no electric field ($\vec{E}=0$), the motion is purely circular in the plane perpendicular to $\vec{B}$. Two key quantities define this motion:

$$r_c = \frac{m v_\perp}{|q| B}, \quad \omega_c = \frac{|q| B}{m}$$

$r_c$ is the cyclotron (or Larmor) radius — the radius of the circular orbit. $v_\perp$ is the speed component perpendicular to $\vec{B}$. $\omega_c$ is the cyclotron angular frequency (rad/s). The rotation period is $T = 2\pi / \omega_c$. Notice how a heavier particle (like a proton) has a larger radius and slower frequency than a light electron in the same field, which you can test directly with the "Particle Type" dropdown.

Frequently Asked Questions

Yes, it is possible. By selecting the 'Arbitrary Charged Particle' mode, you can freely set the mass, charge, and initial velocity. This allows you to simulate the trajectory of any charged particle, such as an alpha particle or muon.
Yes, you can adjust the magnetic flux density and each component of the electric field vector in real time using sliders or numerical input. Changes are immediately reflected in the trajectory calculation and animation, allowing you to intuitively observe the differences in particle motion due to parameter changes.
These values are theoretical values for a uniform magnetic field with the electric field set to zero and the velocity in the simulated 2D plane. When electric fields are enabled, the path includes drift, so use the displayed radius and frequency as reference values.
The current version operates with a fixed time step, but computational stability is guaranteed. If high accuracy is required, more precise trajectories can be obtained by not setting the velocity or magnetic field values too high (e.g., magnetic flux density below 1 T, velocity below 1e7 m/s).

Real-World Applications

Cyclotron & Synchrotron Design: These particle accelerators use a constant magnetic field to bend charged particles into circular paths while an oscillating electric field accelerates them at just the right frequency ($\omega_c$). Engineers use these exact equations to design the magnet size and RF frequency. The simulator's frequency calculation shows why heavier particles require lower frequency accelerators.

Magnetic Resonance Imaging (MRI): The core principle involves the precession (a form of gyration) of proton spins in a massive static magnetic field. The resonant frequency at which these spins absorb energy is directly proportional to the field strength ($\omega \propto B$), just like the cyclotron frequency. Adjusting the B-field slider changes the calculated frequency, mimicking how different MRI machines operate.

Plasma Confinement in Fusion Devices: To contain a 100-million-degree plasma, powerful magnetic fields are used. The charged particles in the plasma gyrate around magnetic field lines. The E×B drift phenomenon you can create in the simulator is critical for analyzing and controlling plasma stability in devices like tokamaks, as unwanted drifts can lead to energy loss.

Mass Spectrometry: In a magnetic sector mass spectrometer, ions are sent into a known magnetic field. Heavier ions (larger $m$) bend with a larger radius ($r_c \propto m$), while lighter ions bend more sharply. By measuring the radius of curvature, the mass-to-charge ratio ($m/q$) of an unknown ion can be determined. Try varying the mass and charge sliders independently to see how the orbit radius changes.

Common Misconceptions and Points to Note

First, let's establish the point that "magnetic fields do no work." You can confirm this in the simulator by observing that a particle's speed doesn't change when only a magnetic field is applied. The Lorentz force $q \vec{v} \times \vec{B}$ is always perpendicular to velocity, so it does not increase or decrease the particle's kinetic energy. Only the work done by the electric field can change the energy. In practice, attempting to accelerate a particle using only a magnetic field is a fundamental error.

Next, pay attention to the relationship between velocity and magnetic-field strength. In this 2D simulator, the velocity is the in-plane speed perpendicular to the uniform magnetic field. The magnetic force changes direction but not speed, so the orbit radius follows $r = mv/(|q|B)$: larger speed or mass gives a larger radius, while stronger magnetic field or larger charge magnitude gives a smaller radius.

Finally, beware of confusion between unit systems. The tesla (T) is easy to misread. For example, 0.01 T is about 200 times Earth's magnetic field (roughly 50 μT), 0.1–0.5 T is typical near the surface of a common permanent magnet, and MRI machines use 1.5 T or 3 T. In the simulator, a proton at 1×10⁶ m/s in 0.01 T has a radius of about 1.04 m; at 1 T, the radius is about 10.4 mm. Always check the order of magnitude.

How to Use

  1. Select electron, proton, or custom particle. Custom charge q uses slider values −10 to +10 multiplied by 1.602×10⁻¹⁹ C.
  2. Set mass on the logarithmic m slider and choose in-plane initial velocities vx and vy.
  3. Set magnetic field B over ±0.02 T; the sign switches the field direction between ⊙ and ⊗. Set Ex and Ey over ±1×10⁴ V/m.
  4. Read Lorentz force F, gyroradius r, cyclotron frequency fc, and period T. These reference values assume uniform B and no electric-field drift.

Worked Example

Default electron case after initialization: vx = 1×10⁷ m/s, vy = 0, B = 0.01 T, and electric field zero. The Lorentz force magnitude is F = |q|vB = 1.602×10⁻¹⁹ × 1×10⁷ × 0.01 ≈ 1.60×10⁻¹⁴ N. The gyroradius is r = mv/(|q|B) ≈ 5.69×10⁻³ m, or 5.69 mm. The cyclotron frequency is fc = |q|B/(2πm) ≈ 2.80×10⁸ Hz (280 MHz), so the period is T = 1/fc ≈ 3.6 ns.

Practical Notes

  1. At identical velocity and magnetic field, protons have about 1836 times the electron gyroradius because r ∝ m.
  2. Gyroradius grows with speed (r ∝ v), so faster ions draw larger orbits; use stronger B to confine them more tightly.
  3. 0.01 T is about 200 times Earth's geomagnetic field (roughly 50 μT), so always check magnetic-field order of magnitude.
  4. This tool handles 2D motion in the plane perpendicular to a uniform magnetic field; vz, helical pitch, and magnetic-bottle effects are outside its model.