Skip to content

Commit

Permalink
rearrange calculation of matrix terms
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmoerland committed Nov 14, 2024
1 parent 826258d commit 2ccb2d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lumicks/pyoptics/trapping/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,20 @@ def force_on_bead(bead_center: Tuple[float, float, float], num_threads: Optional
Ex, Ey, Ez, Hx, Hy, Hz = external_fields_func(bead_center, True, True, True, num_threads)

Te11 = np.atleast_2d(_eps * 0.5 * (np.abs(Ex) ** 2 - np.abs(Ey) ** 2 - np.abs(Ez) ** 2))
Te22 = np.atleast_2d(_eps * 0.5 * (np.abs(Ey) ** 2 - np.abs(Ex) ** 2 - np.abs(Ez) ** 2))
Te33 = np.atleast_2d(_eps * 0.5 * (np.abs(Ez) ** 2 - np.abs(Ey) ** 2 - np.abs(Ex) ** 2))

Te12 = np.atleast_2d(_eps * np.real(Ex * np.conj(Ey)))
Te13 = np.atleast_2d(_eps * np.real(Ex * np.conj(Ez)))
Te22 = np.atleast_2d(_eps * 0.5 * (np.abs(Ey) ** 2 - np.abs(Ex) ** 2 - np.abs(Ez) ** 2))
Te23 = np.atleast_2d(_eps * np.real(Ey * np.conj(Ez)))
Te33 = np.atleast_2d(_eps * 0.5 * (np.abs(Ez) ** 2 - np.abs(Ey) ** 2 - np.abs(Ex) ** 2))

Th11 = np.atleast_2d(_mu * 0.5 * (np.abs(Hx) ** 2 - np.abs(Hy) ** 2 - np.abs(Hz) ** 2))
Th22 = np.atleast_2d(_mu * 0.5 * (np.abs(Hy) ** 2 - np.abs(Hx) ** 2 - np.abs(Hz) ** 2))
Th33 = np.atleast_2d(_mu * 0.5 * (np.abs(Hz) ** 2 - np.abs(Hy) ** 2 - np.abs(Hx) ** 2))

Th12 = np.atleast_2d(_mu * np.real(Hx * np.conj(Hy)))
Th13 = np.atleast_2d(_mu * np.real(Hx * np.conj(Hz)))
Th22 = np.atleast_2d(_mu * 0.5 * (np.abs(Hy) ** 2 - np.abs(Hx) ** 2 - np.abs(Hz) ** 2))
Th23 = np.atleast_2d(_mu * np.real(Hy * np.conj(Hz)))
Th33 = np.atleast_2d(_mu * 0.5 * (np.abs(Hz) ** 2 - np.abs(Hy) ** 2 - np.abs(Hx) ** 2))

T = np.empty((len(bead_center), x.size, 3, 3))
T[..., 0, 0] = Te11 + Th11
Expand Down

0 comments on commit 2ccb2d7

Please sign in to comment.