Segmentation fault when 'sto'
Moderators: cyao, michael_borland
-
- Posts: 36
- Joined: 18 Jul 2014, 12:44
Segmentation fault when 'sto'
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.
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.
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Segmentation fault when 'sto'
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
Then in the command file, use
Then, invoke elegant using (for example)
Be sure to remove the definition of Niter from your lattice file.
--Michael
A workaround is to build your beamline like this
Code: Select all
rc: recirc
freespace: line=(Q, rc,freespaceCellS)
Code: Select all
&rpn_expression expression = "<Niter> sto Niter" &end
...
&run_control
n_passes = <Niter>
&end
...
&track
&end
Code: Select all
elegant input.ele -macro=Niter=10
--Michael
-
- Posts: 36
- Joined: 18 Jul 2014, 12:44
Re: Segmentation fault when 'sto'
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.
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.
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Segmentation fault when 'sto'
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
Writing a bash script to create the lattice file and/or command file is a very good approach.
--Michael
-
- Posts: 36
- Joined: 18 Jul 2014, 12:44
Re: Segmentation fault when 'sto'
Okay, I see. Here are my files.
- Attachments
-
- testSC.lte
- (325 Bytes) Downloaded 350 times
-
- testSC.ele
- (852 Bytes) Downloaded 357 times
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Segmentation fault when 'sto'
Give the attached a try, e.g.,
--Michael
Code: Select all
elegant testSC.ele -macro=Niter=10
- Attachments
-
- testSC.zip
- (1.29 KiB) Downloaded 470 times
-
- Posts: 36
- Joined: 18 Jul 2014, 12:44
Re: Segmentation fault when 'sto'
Sorry for the late reply. It gives me the same error.
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Segmentation fault when 'sto'
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
--Michael
-
- Posts: 36
- Joined: 18 Jul 2014, 12:44
Re: Segmentation fault when 'sto'
I tested it with the files from archive - it worked okay.
Then I noticed that when I comment out:
it also works. I believe it's a problem how recirc operates along with my external script.
Then I noticed that when I comment out:
Code: Select all
!rc: recirc
!freespace: line=(Q, rc,freespaceCellS)
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Segmentation fault when 'sto'
The recirc element is strictly speaking unncessary here. It doesn't hurt to go through the CHARGE element again and again.
--Michael
--Michael