MAD-X
MAD-X copied to clipboard
Check for incosistent use of betas in track
Differently from twiss, track does not support the delta_s parameter:
https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/8695bd422dc403a01aa185e9fea16603bbd5b3e1/src/trrun.f90#L3348
where deltae is pt from the start command
https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/8695bd422dc403a01aa185e9fea16603bbd5b3e1/src/mad_track.c#L295
while deltap is taken from the delta parameter in track:
https://github.com/MethodicalAcceleratorDesign/MAD-X/blob/8695bd422dc403a01aa185e9fea16603bbd5b3e1/src/trrun.f90#L93
deltap = get_value('probe ','deltap ')
betas = get_value('probe ','beta ')
gammas = get_value('probe ','gamma ')
dtbyds = get_value('probe ','dtbyds ')
arad = get_value('probe ','arad ')
radiate = get_value('probe ','radiate ') .ne. zero
thin_cf = get_option('thin_cf ').ne.zero
bet0 = get_value('beam ','beta ')
bet0i = one / bet0
beti = one / betas
deltas = get_variable('track_deltap ')
In this example the tracking with deltap=0 and deltap!=0 should give the same results, but they don't
length=2.1;
ss: sequence, l=length;
b: drift, at=length / 2, l=length;
endsequence;
beam, particle=proton, pc=0.1, sequence=ss, radiate=FALSE;
use, sequence=ss;
dpp=0.1;one=1;
bet0i=1/beam->beta;
track, onepass, onetable,deltap=dpp;
start, pt=0.1;
run, turns=1;
endtrack;
track, onepass, onetable,deltap=0;
start, pt=0.1+sqrt((one+dpp)^2+bet0i^2-one)-bet0i;
run, turns=1;
endtrack;
track, onepass, onetable,deltap=dpp;
start, px=0.1;
run, turns=1;
endtrack;
track, onepass, onetable,deltap=0;
start, px=0.1,pt=0.0+sqrt((one+dpp)^2+bet0i^2-one)-bet0i;
run, turns=1;
endtrack;