Segmentation fault when 'sto'

Moderators: cyao, michael_borland

headdoggy64
Posts: 36
Joined: 18 Jul 2014, 12:44

Segmentation fault when 'sto'

Post by headdoggy64 » 14 Aug 2014, 15:16

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.

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

Re: Segmentation fault when 'sto'

Post by michael_borland » 15 Aug 2014, 12:39

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)

Code: Select all

elegant input.ele -macro=Niter=10
Be sure to remove the definition of Niter from your lattice file.

--Michael

headdoggy64
Posts: 36
Joined: 18 Jul 2014, 12:44

Re: Segmentation fault when 'sto'

Post by headdoggy64 » 15 Aug 2014, 14:20

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.

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

Re: Segmentation fault when 'sto'

Post by michael_borland » 15 Aug 2014, 14:33

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

headdoggy64
Posts: 36
Joined: 18 Jul 2014, 12:44

Re: Segmentation fault when 'sto'

Post by headdoggy64 » 15 Aug 2014, 15:44

Okay, I see. Here are my files.
Attachments
testSC.lte
(325 Bytes) Downloaded 349 times
testSC.ele
(852 Bytes) Downloaded 356 times

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

Re: Segmentation fault when 'sto'

Post by michael_borland » 15 Aug 2014, 20:37

Give the attached a try, e.g.,

Code: Select all

elegant testSC.ele -macro=Niter=10
--Michael
Attachments
testSC.zip
(1.29 KiB) Downloaded 470 times

headdoggy64
Posts: 36
Joined: 18 Jul 2014, 12:44

Re: Segmentation fault when 'sto'

Post by headdoggy64 » 27 Aug 2014, 09:38

Sorry for the late reply. It gives me the same error.

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

Re: Segmentation fault when 'sto'

Post by michael_borland » 27 Aug 2014, 12:04

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

headdoggy64
Posts: 36
Joined: 18 Jul 2014, 12:44

Re: Segmentation fault when 'sto'

Post by headdoggy64 » 27 Aug 2014, 14:16

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.

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

Re: Segmentation fault when 'sto'

Post by michael_borland » 27 Aug 2014, 14:18

The recirc element is strictly speaking unncessary here. It doesn't hurt to go through the CHARGE element again and again.

--Michael

Post Reply