We are running a solid-state physics simulation, including charge carriers with an electric field bias. We have written our own equation-of-motion class (
G4CMPEqEMField) as a subclass of
I’m having trouble reconciling the sparse guidance in the Toolkit Guide with the code in
G4EqMagElectricField::EvaluateRhsGivenB(), which we used as a guide for our own code. The documentation says
the derivative vector dydx is a vector with six components. The first three are the derivative of the position with respect to the curve length. Thus they should set equal to the normalised velocity, which is components 3, 4 and 5 of y.
(dydx, dydx, dydx) = (y, y, y)
But the code assumes that
y[3,4,5] is the actual momentum (in Geant4 energy units), and computes the output components above as
G4double pSquared = y*y + y*y + y*y ; G4double pModuleInverse = 1.0/std::sqrt(pSquared) ; dydx = y*pModuleInverse ; dydx = y*pModuleInverse ; dydx = y*pModuleInverse ;
dydx[0,1,2] does come out as a unit (direction) vector. The documentation also doesn’t mention the
Besides the documentation, I’m also having a physics problem. I would expect the field to change the particle’s kinetic energy by an amount equal to the voltage drop (field * path length). This is what happens with
G4EqMagElectricField, but not with our code. Instead, I seem to get systematically too much energy (by about 25% or so).
Unfortunately, the “stepper” code is sufficiently abstract that I really can’t tell how it is that the particle’s momentum and energy get changed by the output of
EvaluateRhsGivenB(). Is there somewhere (slides from a talk, maybe?) that would provide a physically motivated connection that I could follow?