Sign of summation in second order RDTs wrt sextupoles

Moderators: cyao, michael_borland

Post Reply
blanco-garcia
Posts: 78
Joined: 29 Oct 2021, 10:41

Sign of summation in second order RDTs wrt sextupoles

Post by blanco-garcia » 07 Oct 2024, 05:23

Dear all,
I have a doubt about the summation used in the calculation of the second order rdts with respect to sextupoles.

I see that in the elegant file 'twiss.cc' line 4997 the sign of the sum is written as

Code: Select all

termSign = SIGN(ed[iE].s - ed[jE].s);
which is negative for j>i, being j downstream wrt to i.

This termSign is the opposite to the Equation (46) by Chun-Xi Wang "Explicit formulas for 2nd-order driving terms due to sextupoles and chromatic effects of quadrupoles". ANL/APS/LS-330. March 10, 2012.

Is this difference a sign convention in Elegant ? or is there any other reason ?

Best regards,
o

michael_borland
Posts: 2059
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Sign of summation in second order RDTs wrt sextupoles

Post by michael_borland » 17 Oct 2024, 11:22

I see what you mean. I had previously checked elegant against OPA and found good agreement, but need to look into this more.

--Michael

michael_borland
Posts: 2059
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Sign of summation in second order RDTs wrt sextupoles

Post by michael_borland » 17 Oct 2024, 16:20

I compared the output from elegant to OPA again. If I change the sign of that term, the agreement is poor. Since I consider OPA to be the gold standard on these calculations, I think perhaps Chun-xi's note has an error.

Do you have other reasons that lead you to think elegant's calculations are wrong?

--Michael

blanco-garcia
Posts: 78
Joined: 29 Oct 2021, 10:41

Re: Sign of summation in second order RDTs wrt sextupoles

Post by blanco-garcia » 18 Oct 2024, 02:54

Dear Michail,
thank you for checking the results. I don't have right now any other reason to think it is wrong.

Before starting this post I derived on my own the term in Eq. (8) and I got the same result that Chun-xi wrote on his paper, and on the way I confirmed the order of the sum is consistent. I will try to attach some of my notes in case they are of any interest.

By today I have confirmed that Eqs(8) to (24) are correct and all consistent with Bengtsson's article. This time I used a simpler derivation using Lie algebra from Chun-xi's first citation. It is the Eq.(54) in C.-x. Wang and A. Chao, “Notes on Lie algebraic analysis of achromats,” SLAC note AP-100 (1995).

I have not yet gone any further. I understand that these terms could be used to derive the tune shift with amplitude, but it will take me some time to get to that result while checking that all I use is consistent. Before taking that road I wanted to know if there was something obvious I was missing in how Elegant works.

Best regards,
o

blanco-garcia
Posts: 78
Joined: 29 Oct 2021, 10:41

Re: Sign of summation in second order RDTs wrt sextupoles

Post by blanco-garcia » 18 Oct 2024, 03:09

Here are the notes I mentioned in the previous post.

o
Attachments
RDT2ndordersummsignElegant.pdf
Notes on the 2nd order RDTs derivation
(230.6 KiB) Downloaded 3521 times

blanco-garcia
Posts: 78
Joined: 29 Oct 2021, 10:41

Re: Sign of summation in second order RDTs wrt sextupoles

Post by blanco-garcia » 07 Jul 2026, 10:29

After reading back again Bengtsson I just saw that Bengtsson prefers to derive the equations in a left handed coordinate system, which explains the sign difference between the article equations and the Elegant code.

The code is correct. I leave here below and extract from Bengtsson's article.
Attachments
Bengtssons_left_handed_coordinate_system.png

michael_borland
Posts: 2059
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Sign of summation in second order RDTs wrt sextupoles

Post by michael_borland » 07 Jul 2026, 10:36

Thanks for letting me know. A left-handed coordinate system is really odd.

--Michael

blanco-garcia
Posts: 78
Joined: 29 Oct 2021, 10:41

Re: Sign of summation in second order RDTs wrt sextupoles

Post by blanco-garcia » 13 Aug 2026, 08:21

The main difference is the direction in which the beam is circulating.

I believe Elegant uses a system where s = x cross y, with cross meaning the vector cross product.

Bengtsson uses in his article y = x cross s, which is the result of the Fresnet-Serret coordinate system.

This difference in the definition of the orthonormal base defines the direction in which a magnet is focusing for positive particles, which explains the minus sign in front of the first order RDTs implementation and the expression written by Bengtsson.

As for the second order RDTs, the direction in which the beam circulates changes the order in the summation of the poisson brackets, i.e. the sextupole pair (i,j) becomes (j,i) in the other coordinate system, and also gives a factor minus 1 which explains the sign difference with respect to Chun Xi equation.

Post Reply