Energy and particle available to C integrators #368
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the equivalent for Matlab of #367 for python:
The energy and particle properties (rest energy and charge) are made available to all the C integrators. The list of global parameters is now:
Since the parameters are now available in both python and Matlab, they can be used from now on in the integrators.
But for the moment, only relativistic tracking is still available (only
RFCavityPass
is involved in that). The behaviour is:but the particle type is not yet transmitted to the C. So the integrators always see the properties of the 'relativistic' particle. The reason is the following: ring properties in Matlab are stored in theRingParam
element. If it is absent, gathering the properties takes long, so thatatpass
(ringpass
andlinepass
) would be too slow. A better solution is still to be found, possibly by providing the properties optionally , when the are necessary…Update:
A better solution is found for Matlab: if a
RingParam
element is found (this is very fast, 0.2 ms if found, 4 ms if not), its properties are sent toatpass.c
. Otherwise, nothings sent. For comparison, building the properties from the lattice takes 80 ms).Conclusion:
Nothing new appears with this PR, but it is an important and necessary step before working on non-relativistic tracking. Additionally, having the energy available will also remove the necessity of having "Energy" as an element attribute.
This branch (and #367) bring significant modifications of
atpass.c
, and start minimising the differences between the Matlab and python versions.Side remark: while working on C code, I saw that the detection of OpenMP presence which was still missing in Matlab. It is now operational: