forked from rdemaria/pysixtrack
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/end track marker+pyheadtail conversion #54
Open
martinschwinzerl
wants to merge
57
commits into
SixTrack:master
Choose a base branch
from
martinschwinzerl:feature/end_track_marker+pyheadtail_conversion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/end track marker+pyheadtail conversion #54
martinschwinzerl
wants to merge
57
commits into
SixTrack:master
from
martinschwinzerl:feature/end_track_marker+pyheadtail_conversion
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... to have the same layout in terms of number of particles as in SpaceChargeBunched
…le.. .. in view of the upgrade to arbitrary generalised Gaussian bunch profiles.
... SpaceChargeCoasting to new interface with number_of_particles and circumference.
...default options in loader_mad.py .
- add attribute for the interpolation method (0=linear, 1=cubic spline) - implement tracking to use the interpolation method - add fallback if no legal interpolation method is available -> this is consitent with the behaviour of SixTrackLib
…olation' into feature/sc-linedensity-interpolation
use q_parameter as parameter name, not q as in SixTrackLib
QGauss class no longer uses the `__call__` method to perform the actual evaluation, call `eval` instead
fixes typo / copy & paste error in `eval()` method
…nsity-interpolation Feature/sc linedensity interpolation
This element can be inserted before and after an EndTrackingMarker to take care of the conversion from/to PyHEADTAIL. The main purpose for including this in pysixtrack is to facilitate use of such an element in CObjects lattices / SixTrackLib. TODO: This is a stub, implementation of the required conversions stil missing
Currently, the conversion is done in an explicit manner via python (which is slow, see https://github.com/aoeftiger/PySixHead/blob/main/tracker.py#L85 ): def pyht_to_stl(self, beam):
stl_particles = self.trackjob.particles_buffer.get_object(0)
n = beam.macroparticlenumber
stl_particles.x[:n] = beam.x
stl_particles.px[:n] = beam.xp
stl_particles.y[:n] = beam.y
stl_particles.py[:n] = beam.yp
stl_particles.zeta[:n] = beam.z
stl_particles.delta[:n] = beam.dp
stl_particles.particle_id[:n] = beam.id
stl_particles.state[:n] = beam.state
stl_particles.at_turn[:n] = beam.at_turn
stl_particles.at_element[:n] = beam.at_element
stl_particles.s[:n] = beam.s
# further longitudinal coordinates of SixTrackLib
rpp = 1. / (beam.dp + 1)
stl_particles.rpp[:n] = rpp
restmass = beam.mass * c**2
restmass_sq = restmass**2
E0 = np.sqrt((beam.p0 * c)**2 + restmass_sq)
p = beam.p0 * (1 + beam.dp)
E = self.mathlib.sqrt((p * c) * (p * c) + restmass_sq)
psigma = (E - E0) / (beam.beta * beam.p0 * c)
stl_particles.psigma[:n] = psigma
gamma = E / restmass
beta = self.mathlib.sqrt(1 - 1. / (gamma * gamma))
rvv = beta / beam.beta
stl_particles.rvv[:n] = rvv
self.trackjob.push_particles() --> this functionality is what would be required, but I'm unsure how this could be integrated as the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Based on PR #50, this one adds an end-of-tracking marker element which would
track_line
from e.g. the MAD-X loaderAdditionally, it adds a stub element for integrating with
PyHEADTAIL
which also could be placed programmatically before and after the end-of-tracking marker and allow to call the conversion functions from/to PyHEADTAIL data model from a GPU kernel in SixTrackLib.In its current form, the PR is not intended to be merged but as a basis for reviewing code and a central point for discussions.