Page 1 of 2
Segmentation fault when 'sto'
Posted: 14 Aug 2014, 15:16
by headdoggy64
Hello all,
I have noticed that if I define my parameters in the lattice file like this
% 0.1 sto Ldrift
% 1.0 sto Ltotal
% Ltotal Ldrift / sto Niter
Q: charge, total=15.e-9
D1: drift, L="Ldrift"
freespaceCellS: line=(D1, Kick)
freespace: line=(Q, "Niter"*freespaceCellS)
I am getting Segmentation fault. I guess the problem is in the last line where I use "Niter" as the variable with the number of iterations. Is there a proper way to go about this?
Thanks.
Re: Segmentation fault when 'sto'
Posted: 15 Aug 2014, 12:39
by michael_borland
The problem is that elegant doesn't accept that syntax for the beamline composition. You have to use a literal number instead of "Niter".
A workaround is to build your beamline like this
Code: Select all
rc: recirc
freespace: line=(Q, rc,freespaceCellS)
Then in the command file, use
Code: Select all
&rpn_expression expression = "<Niter> sto Niter" &end
...
&run_control
n_passes = <Niter>
&end
...
&track
&end
Then, invoke elegant using (for example)
Be sure to remove the definition of Niter from your lattice file.
--Michael
Re: Segmentation fault when 'sto'
Posted: 15 Aug 2014, 14:20
by headdoggy64
Hi Michael,
Thanks for your reply. Here is what I am getting after the solution you proposed:
Dumping output beam data...*** glibc detected *** elegant: corrupted double-linked list: 0x0886be80 ***
Terminated by SIGABRT
Program trace-back:
(empty)
and then it hangs.
Here is what I am trying to do:
1) I have a fixed element length (let say L=1.0 m) in the lattice.
2) I have step size (let say d=0.1m) which I want to vary and pass to Elegant from the outside.
3) The total number of sub-elements in which I break down the original element is calculated as N=L/d.
Where would be the better place to implement that? Lattice file doesn't seem to be a solution. I can always write a bash script which will generate the lattice file at each step, but I was wondering if this is possible to do within the Elegant.
Thank you.
Re: Segmentation fault when 'sto'
Posted: 15 Aug 2014, 14:33
by michael_borland
That's a very surprising error. If you can post your .ele and .lte files, I'd like to look at the problem.
Writing a bash script to create the lattice file and/or command file is a very good approach.
--Michael
Re: Segmentation fault when 'sto'
Posted: 15 Aug 2014, 15:44
by headdoggy64
Okay, I see. Here are my files.
Re: Segmentation fault when 'sto'
Posted: 15 Aug 2014, 20:37
by michael_borland
Give the attached a try, e.g.,
Code: Select all
elegant testSC.ele -macro=Niter=10
--Michael
Re: Segmentation fault when 'sto'
Posted: 27 Aug 2014, 09:38
by headdoggy64
Sorry for the late reply. It gives me the same error.
Re: Segmentation fault when 'sto'
Posted: 27 Aug 2014, 12:04
by michael_borland
Can you check that you are using only the files in the .zip file? I downloaded the zip file and tried the command given in my last message, and it works without any problems.
--Michael
Re: Segmentation fault when 'sto'
Posted: 27 Aug 2014, 14:16
by headdoggy64
I tested it with the files from archive - it worked okay.
Then I noticed that when I comment out:
Code: Select all
!rc: recirc
!freespace: line=(Q, rc,freespaceCellS)
it also works. I believe it's a problem how recirc operates along with my external script.
Re: Segmentation fault when 'sto'
Posted: 27 Aug 2014, 14:18
by michael_borland
The recirc element is strictly speaking unncessary here. It doesn't hurt to go through the CHARGE element again and again.
--Michael