Hi Michael:
I am using optmizization to do matching in a transportation line. But at the &optimization_term section, the expression of the given function do not work well, saying:
unknown token: M2.betax
too few items on stack (divide).
I am currently using the release posted at Sep 13 2023 04:37:07. Here are the files.
Best
Weijie Fan
RPN expression error
Moderators: cyao, michael_borland
RPN expression error
- Attachments
-
- matchopt.ele
- (2.02 KiB) Downloaded 175 times
-
- transopt.lte
- (651 Bytes) Downloaded 177 times
-
- Posts: 1945
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: RPN expression error
Weijie,
You need to use "M2#1.betax" instead of "M2.betax". The reason is that elegant allows multiple instances of the marker M2 in the beamline, so you have to tell it which one to use (even when there is in fact only one).
Another problem is here:
where you've given two values for the term parameter. Only the second will be used. In this case, the term given will evaluate to a constant value of "2". If you just want a barrier function that limits betax to 20, remove the "2".
Also, I suggest you add
at the top of the .ele file. This will reduce the number of particles used for tracking-based matrix determination, which will make the run faster. Since you are only optimizing linear properties, this would be good enough.
--Michael
You need to use "M2#1.betax" instead of "M2.betax". The reason is that elegant allows multiple instances of the marker M2 in the beamline, so you have to tell it which one to use (even when there is in fact only one).
Another problem is here:
Code: Select all
&optimization_term
term = "20 betax betay - sqr + ", weight=1.0
term = " M2#1.betax 20 1e-6 selt 2", weight=1.0
&end
Also, I suggest you add
Code: Select all
&global_settings
tracking_matrix_points = 5
&end
--Michael