km2sdds

Moderators: cyao, michael_borland

Post Reply
simona.bettoni
Posts: 42
Joined: 06 Jul 2011, 03:14

km2sdds

Post by simona.bettoni » 24 May 2022, 08:11

Dear all,
I am trying to use the function km2dds to compute the kick map from an undulator for the element UKICKMAP.

If I want to build the kick map by myself it is clear that I have to generate a file which has (x,y,kickX,kickY) columns, because kickX and kickY will be two scalars for each couple (x,y), and I will finish with a grid.

I would like to use the km2sdds, if possible. In this case it is not clear to me how to pass the inputs. I have a Radia model of an undulator, so I can have the 3D field map. At the moment it is in the format (the .log file is):
per = 36.
Br = 1.35
fa = 10
rass1 = 0
gap/slit = 4
k8 = 1
ka = kb = 0.5
kae2 = 0.63*ka= 0.41
Nkeeperlong= 18
y-pos = {-4, -2, -1, -0.5, -0.3, -0.1, 0, 0.1, 0.3, 0.5, 1, 2, 4}
z-pos = {-2, -1, -0.5, -0.3, -0.1, 0, 0.1, 0.3, 0.5, 1, 2}
File structure:
Coordinate system: Bx longitudinal, By horizontal, Bz vertical
pos Bx[y1,z1] By[y1,z1] Bz[y1,z1] Bx[y2,z1], By[y2,z1] ...

I can provide (s,x,y,Bx,By), but Bx and By in this case will be two arrays, so should I do something like:
s1 x1 y1 Bx(x1,y1,s1) By(x1,y1,s1)
s2 x1 y1 Bx(x1,y1,s2) By(x1,y1,s2)
...
sN x1 y1 Bx(x1,y1,sN) By(x1,y1,sN)

s1 x2 y1 Bx(x2,y1,s1) By(x2,y1,s1)
s2 x2 y1 Bx(x2,y1,s2) By(x2,y1,s2)
...
sN x2 y1 Bx(x2,y1,sN) By(x2,y1,sN)
?
Is there a way to say for each (x,y) take a couple of arrays, which will be Bx and By for example? Is there any example which I did not find to use km2dds?

I tried to give x,y,z,Bx,By as:
SDDS1ASTRA2ELEGANT2003
&column name=x, units=m, type=double, &end
&column name=y, units=m, type=double, &end
&column name=z, units=m, type=double, &end
&column name=By, units=T, type=double, &end
&column name=Bx, units=T, type=double, &end
&data mode=ascii, &end
! page number 1
1.00000e+00 2.00000e+00 3.00000e+00 4.00000e+00 5.00000e+00
6.00000e+00 7.00000e+00 8.00000e+00 9.00000e+00 5.00000e+00
2.00000e+00 3.00000e+00 4.00000e+00 8.00000e+00 7.00000e+00
...
but I get an error message when I try to run km2sdds:
can't read "value": no such variable
while executing
"set [lindex $itemList $index] $value"
("while" body line 9)
invoked from within
"while {![eof $fdi]} {
gets $fdi data
if [string match "\#*" $data] continue
if [string compare START $data]==0 {
set found 1
..."
(file "/opt/psi/MPI/elegant/2021.4.0-2_slurm/openmpi/4.0.5-1_slurm/gcc/10.3.0/oag/apps/bin/linux-x86_64/km2sdds" line 31)

Sorry for the maybe trivial question, but I did not find how to pass the data.

Best regards,
Simona.

SDastan
Posts: 34
Joined: 21 May 2018, 07:08

Re: km2sdds

Post by SDastan » 31 May 2022, 01:53

Dear Simona,

Make sure that you are using the Radia and the the Mathematica notebook “RadiaToTrack” which is originally developed by the ESRF. The output .dat file of the programe easily convert to SDDS and you can use it in Elegant.
See this page:
https://www.esrf.fr/Accelerators/Groups ... a/Examples
Sara

simona.bettoni
Posts: 42
Joined: 06 Jul 2011, 03:14

Re: km2sdds

Post by simona.bettoni » 19 Jul 2022, 06:47

Thanks a lot for your reply!
Kind regards,
Simona.

Post Reply