Subject : couldn't calculate the optics in a DO-LOOP
Article No : 12
Date : 2005/07/15(Fri) 05:44:09
Contributor : Yun Luo <
メールアドレス >
Hello, all, In the following script, I want to calculate the optics with different skew quadrupole strength settings. Therefore, I used a Do-loop. I found " cell; cal;" don't refresh the optics parameters in my Do-Loop. However, I found the skew quadrupole strengths have been changed by "setelement" in each iteration. Someone please help to look at it, thanks. yun --------------------------------------------------------------------------------- READ "./blue_pp_inj.sad"; MASS=938279600; MOMENTUM=100000000000; # gama=106.575722; FSHIFT=0; FFS USE=RING; !----tracking parameters, YOU DECIDE THE FOLLOWING INPUTS cell; cal; CELL; FIT; NX 28.72; NY 29.73; FREE QF, QD; GO; SAVE; cell; cal; !-----coupling situation changing ftwiss=OpenWrite["Twiss_output"]; Do[ { f1strength= -0.0002+0.00002*k; f2strength= 0.000; f3strength= 0.0000; SetElement["SQSK8" ,, "K1"-> f1strength]; SetElement["SQSK2" ,, "K1"->-1.0*f1strength]; SetElement["SQSK10" ,, "K1"-> f2strength]; SetElement["SQSK4" ,, "K1"->-1.0*f2strength]; SetElement["SQSK6" ,, "K1"-> f3strength]; SetElement["SQSK12" ,, "K1"->-1.0*f3strength]; Print[LINE[{"K1","ROTATE"}, "SQSK8"] ]; Print[LINE[{"K1","ROTATE"}, "SQSK10"] ]; Print[LINE[{"K1","ROTATE"}, "SQSK6"] ]; cell; cal; Do[ { If [ LINE["NAME",j]== "PLLBPM", ...... ...... Print["------------------------> k= ",k]; Write[ftwiss, f1strength," ",qx," ",qy," ",r1," ",r2," ",ratio," ",tanang1," ",tanang2]; ]; },{j,1, LINE["POSITION", "$$$" ] } ]; },{k,0,20} ]; fclose[ftwiss]; Abort;