zkit.physics
Automatic physics extraction from a TDSEZ input deck.
Parses the problem expressions (Potential, mass, laser fields, …) straight
from the .inp deck via zkit.simulation.Run, differentiates
symbolically with sympy to obtain the higher derivatives the Wigner/Moyal
analysis needs (V’, V’’, V’’’, V^(5), mass gradient), and exposes fast
lambdified callables.
Everything is derived from the deck – no physics is hard-coded in the caller.
Expressions are read with TDSE-Z’s rules (muParser syntax including nested
c ? a : b, every input scalar and Variables constant). Derivatives of V
come from symbolic differentiation of Potential, so they are always
consistent with it. The laser field is the expression TDSE-Z applies on each
polarised axis (LaserX/Y/Z, or Laser).
Example
>>> from zkit.simulation import Run
>>> run = Run("build", "ZnSe_d20_A0.005338")
>>> phys = run.physics
>>> phys.V(0.0, 0.0) # potential at the origin
>>> phys.Ex(1000.0) # laser field E_x at t=1000 a.u. (LaserX)
>>> phys.snapshot_time(10) # real time of wfs snapshot #10 (0-based)
- class zkit.physics.Physics(meta)
Bases:
objectPhysics of a TDSEZ run, extracted automatically from its input deck.
- V(x, y)
- mass(x, y)
- Vpx(x, y)
- Vpy(x, y)
- V3_x_slice(x)
d^3 V / dx^3 evaluated on the y=0 slice.
- V5_x_slice(x)
d^5 V / dx^5 evaluated on the y=0 slice.
- Ex(t)
Laser field E_x(t) (LaserX); it enters H as s E_x x, s = carrier_sign.
- Ey(t)
Laser field E_y(t).
- Ez(t)
Laser field E_z(t).
- field(axis, t)
Field E_a(t) on axis 0, 1, 2 (or “x”, “y”, “z”).
- field_expr(axis)
Field E_a(t) as a sympy expression in t (0 on an uncoupled axis).
- field_derivative(axis, t)
dE_a/dt, differentiated symbolically from the deck’s expression.
- Ax(t)
Laser field E_x(t) (LaserX); it enters H as s E_x x, s = carrier_sign.
- Ay(t)
Laser field E_y(t).
- snapshot_time(i)
Real time (a.u.) of wfs snapshot
i(0-based).t_i = i * OutputStrideWFS * TimeStep.
- Parameters:
i (int)
- Return type:
float
- property has_laser: bool
- zkit.physics.parse_expression(src, variables=('x', 'y', 't'), constants=None)
Parse a TDSE-Z (muParser) expression into a sympy expression.
constants(name -> value) are substituted, so the result depends only on the namedvariables; seezkit.deck.expression_constants().- Parameters:
src (str)