Skip to content
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

MaxOrder is zero for magnets with zero strength #86

Closed
JonasKallestrup opened this issue Nov 12, 2018 · 2 comments
Closed

MaxOrder is zero for magnets with zero strength #86

JonasKallestrup opened this issue Nov 12, 2018 · 2 comments

Comments

@JonasKallestrup
Copy link
Contributor

Creating an element that is turned off (PolynomB = 0 for quad, sext, etc.), the MaxOrder is automatically set to 0, since max([1 find(abs(elem.PolynomB)>0,1,'last') find(abs(elem.PolynomA)>0,1,'last')])-1 = 0.

If one wants to turn on the element, it is then not enough to make the PolynomB array non-zero; one must also change MaxOrder to the desired value manually, which seems like an unnecessary extra step, which can easily be forgotten.

Instead, one could check the class of the element in atbaselem, and let MaxOrder = 1 for quads and 2 for sextupoles per default. I guess this may increase computation times somewhere (an element with MaxOrder = 1 is included in calculations, even though PolynomB(2) = 0), but if the number of turned-off elements is low, then it does not matter too much(?).

@ZeusMarti
Copy link
Contributor

Right, it happened to me once...

@lfarv
Copy link
Contributor

lfarv commented Dec 7, 2018

Solved by #93

@lfarv lfarv closed this as completed Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants