diff --git a/tracy/tracy/src/t2ring.cc b/tracy/tracy/src/t2ring.cc index b88a96de9a3ef257116c062bf272bd0047aeb2af..9d038efb4dcf45c278e5b83e1de6f27700357f8a 100644 --- a/tracy/tracy/src/t2ring.cc +++ b/tracy/tracy/src/t2ring.cc @@ -477,10 +477,12 @@ void Cell_Twiss(long i0, long i1, ss_vect<tps> &Ascr, bool chroma, bool ring, 16/10/03 Modified convergence test: now done for both planes 01/09/10 Modify the convergence criteria on relative diff of the chroma value The previous test does not work well for non zero chromaticities + Test convergence changed if chroma closed to zero ****************************************************************************/ #define n 4 #define chromeps 1e-6 /* convergence condition for chromaticity computation */ #define LOG10 log(10.0) +#define ZEROCHRO 0.1 void Ring_Getchrom(double dP) { long int lastpos = 0; @@ -546,6 +548,10 @@ void Ring_Getchrom(double dP) { Norm_TEMP = sqrt(TEMP[0] * TEMP[0] + TEMP[1] * TEMP[1]); NORMchro = sqrt(globval.Chrom[0] * globval.Chrom[0] + globval.Chrom[1] * globval.Chrom[1]); + // if chroma closed to zero, norm is one for avoiding divergence of convergence test + if (NORMchro < ZEROCHRO){ + NORMchro = 1.0; + } // TEST CHROMA convergence if (trace) { @@ -572,6 +578,7 @@ void Ring_Getchrom(double dP) { #undef n #undef chromeps #undef LOG10 +#undef ZEROCHRO /****************************************************************************/