@@ -228,14 +228,14 @@ aper_adj_quad(double angle, double x, double y, double* xquad, double* yquad)
228228}
229229
230230static void
231- aper_adj_halo_si (double ex , double ey , double betx , double bety , double bbeat ,
231+ aper_adj_halo_si (double ex , double ey , double betx , double bety , double bbeat_x , double bbeat_y ,
232232 double halox [], double haloy [], int halolength , double haloxsi [], double haloysi [])
233233{
234234 int j ;
235235
236236 for (j = 0 ; j <= halolength + 1 ; j ++ ) {
237- haloxsi [j ] = halox [j ] * bbeat * sqrt (ex * betx );
238- haloysi [j ] = haloy [j ] * bbeat * sqrt (ey * bety );
237+ haloxsi [j ] = halox [j ] * bbeat_x * sqrt (ex * betx );
238+ haloysi [j ] = haloy [j ] * bbeat_y * sqrt (ey * bety );
239239 }
240240}
241241
@@ -1307,7 +1307,7 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
13071307 double on_ap = 1 , on_elem = 0 ;
13081308 double ex , ey ;
13091309 double dqf , betaqfx , dp , dparx , dpary ;
1310- double cor , bbeat , nco , halo [4 ], interval , spec , notsimple ;
1310+ double cor , bbeat , nco , halo [4 ], interval , spec , notsimple , bbeat_x , bbeat_y ;
13111311 double s = 0 , x = 0 , y = 0 , px = 0 , py = 0 , betx = 0 , bety = 0 , dx = 0 , dy = 0 , ratio , n1 , length , pt_ele ; // nr not used
13121312 double xeff = 0 ,yeff = 0 ;
13131313 double n1x_m , n1y_m ;
@@ -1378,6 +1378,14 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
13781378
13791379 cmd_refnode = command_par_string ("refnode" , this_cmd -> clone );
13801380
1381+ if (bbeat == 0 ) {
1382+ bbeat_x = command_par_value ("bbeat_x" , this_cmd -> clone );
1383+ bbeat_y = command_par_value ("bbeat_y" , this_cmd -> clone );
1384+ }
1385+ else {
1386+ bbeat_x = bbeat ;
1387+ bbeat_y = bbeat ;
1388+ }
13811389 /* calculate delta angle */
13821390 dangle = twopi /(nco * 4 );
13831391
@@ -1432,7 +1440,7 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
14321440
14331441 // LD: shift further results by one step (?) and finish outside the table
14341442 // (*tw_cnt)++;
1435- aper_adj_halo_si (ex , ey , betx , bety , bbeat , halox , haloy , halolength , haloxsi , haloysi );
1443+ aper_adj_halo_si (ex , ey , betx , bety , bbeat_x , bbeat_y , halox , haloy , halolength , haloxsi , haloysi );
14361444
14371445 /* calculate initial normal+parasitic disp. */
14381446 /* modified 27feb08 BJ */
@@ -1523,7 +1531,7 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
15231531 parxd = dparx * sqrt (betx /betaqfx ) * dqf ;
15241532 paryd = dpary * sqrt (bety /betaqfx ) * dqf ;
15251533
1526- aper_adj_halo_si (ex , ey , betx , bety , bbeat , halox , haloy , halolength , haloxsi , haloysi );
1534+ aper_adj_halo_si (ex , ey , betx , bety , bbeat_x , bbeat_y , halox , haloy , halolength , haloxsi , haloysi );
15271535
15281536 /*do survey to have ready init for next node */
15291537 if (do_survey ) {
@@ -1609,7 +1617,7 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
16091617 jslice , s , betx , bety , dx , dy );
16101618
16111619 s_curr = s_start + s ;
1612- aper_adj_halo_si (ex , ey , betx , bety , bbeat , halox , haloy , halolength , haloxsi , haloysi );
1620+ aper_adj_halo_si (ex , ey , betx , bety , bbeat_x , bbeat_y , halox , haloy , halolength , haloxsi , haloysi );
16131621
16141622 /* calculate normal+parasitic disp.*/
16151623 /* modified 27feb08 BJ */
@@ -1652,10 +1660,10 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
16521660 dispdesx = dx * dp ; //Design dispersion
16531661 dispdesy = dy * dp ;
16541662
1655- dispparax = bbeat * (parxd * (fabs (lim_pt -> deltap_twiss /beta0 + pt_ele )+ dp ))
1656- + (bbeat - 1 )* fabs (dx * dp ); //Parasitic disperison
1657- dispparay = bbeat * (paryd * (fabs (lim_pt -> deltap_twiss /beta0 + pt_ele )+ dp ))
1658- + (bbeat - 1 )* fabs (dy * dp );
1663+ dispparax = bbeat_x * (parxd * (fabs (lim_pt -> deltap_twiss /beta0 + pt_ele )+ dp ))
1664+ + (bbeat_x - 1 )* fabs (dx * dp ); //Parasitic disperison
1665+ dispparay = bbeat_y * (paryd * (fabs (lim_pt -> deltap_twiss /beta0 + pt_ele )+ dp ))
1666+ + (bbeat_y - 1 )* fabs (dy * dp );
16591667
16601668 if (notsimple ){
16611669 nchecks = 8 ; //Extra checks
@@ -1729,8 +1737,8 @@ aperture(char *table, struct node* use_range[], struct table* tw_cp, int *tw_cnt
17291737
17301738 if (debug ) printf ("\n Found ratio: %f n1: %f \n" ,ratio ,n1 );
17311739
1732- n1x_m = n1 * bbeat * sqrt (betx * ex );
1733- n1y_m = n1 * bbeat * sqrt (bety * ey );
1740+ n1x_m = n1 * bbeat_x * sqrt (betx * ex );
1741+ n1y_m = n1 * bbeat_y * sqrt (bety * ey );
17341742
17351743 /* Change below, BJ 23oct2008 */
17361744 /* test block 'if (n1 < node_n1)' included in test block */
0 commit comments