4949#include < massmodel.H>
5050#include < interp.H>
5151
52- # define OFFSET 1.0e-3
53- # define OFFTOL 1.2
52+ const double OFFSET= 1.0e-3 ;
53+ const double OFFTOL= 1.2 ;
5454
5555extern double gint_0 (double a, double b, std::function<double (double )> f, int NGauss);
5656extern double gint_2 (double a, double b, std::function<double (double )> f, int NGauss);
5757
58- # define TSTEP 1.0e-8
59- # define NGauss 96
58+ const double TSTEP= 1.0e-8 ;
59+ const int NGauss= 96 ;
6060
6161static int DIVERGE=0 ;
6262
@@ -109,6 +109,10 @@ void SphericalModelTable::setup_df(int NUM, double RA)
109109 rhoQy.resize (num);
110110 rhoQy2.resize (num);
111111
112+ rhoQx. setZero ();
113+ rhoQy. setZero ();
114+ rhoQy2.setZero ();
115+
112116 for (int i=0 ; i<num; i++) {
113117 x = density.x [i];
114118 rhoQx[i] = pot.y [i];
@@ -138,14 +142,20 @@ void SphericalModelTable::setup_df(int NUM, double RA)
138142 dfc.Q .resize (NUM);
139143 dfc.fQ .resize (NUM);
140144 dfc.ffQ .resize (NUM);
145+
146+ dfc.Q .setZero ();
147+ dfc.fQ .setZero ();
148+ dfc.ffQ .setZero ();
149+
141150 dfc.num = NUM;
142151 dfc.ra2 = ra2;
143152
144153 Qmax = get_pot (pot.x [pot.num -1 ]);
145154 Qmin = get_pot (pot.x [0 ]);
146155 dQ = (Qmax - Qmin)/(double )(dfc.num -1 );
147156
148- foffset = -std::numeric_limits<double >::max ();
157+ // foffset = -std::numeric_limits<double>::max();
158+ foffset = -1.0e42 ;
149159 dfc.Q [dfc.num -1 ] = Qmax;
150160 dfc.ffQ [dfc.num -1 ] = 0.0 ;
151161 fac = 1.0 /(sqrt (8.0 )*M_PI*M_PI);
@@ -184,6 +194,13 @@ void SphericalModelTable::setup_df(int NUM, double RA)
184194 df.ffQ .resize (NUM);
185195 df.fQ2 .resize (NUM);
186196 df.ffQ2 .resize (NUM);
197+
198+ df.Q .setZero ();
199+ df.fQ .setZero ();
200+ df.ffQ .setZero ();
201+ df.fQ2 .setZero ();
202+ df.ffQ2 .setZero ();
203+
187204 df.num = NUM;
188205 df.ra2 = ra2;
189206
@@ -194,7 +211,8 @@ void SphericalModelTable::setup_df(int NUM, double RA)
194211 df.Q [df.num -1 ] = Qmax;
195212 df.ffQ [df.num -1 ] = 0.0 ;
196213 fac = 1.0 /(sqrt (8.0 )*M_PI*M_PI);
197- foffset = -std::numeric_limits<double >::max ();
214+ // foffset = -std::numeric_limits<double>::max();
215+ foffset = -1.0e42 ;
198216 for (int i=df.num -2 ; i>=0 ; i--) {
199217 df.Q [i] = df.Q [i+1 ] - dQ;
200218 Q = df.Q [i];
@@ -233,7 +251,7 @@ void SphericalModelTable::setup_df(int NUM, double RA)
233251
234252 dist_defined = true ;
235253
236- debug_fdist ();
254+ // debug_fdist();
237255}
238256
239257
@@ -294,7 +312,7 @@ double SphericalModelTable::distf(double E, double L)
294312
295313 if (!dist_defined) bomb (" distribution function not defined" );
296314
297- double d, g;
315+ double d= 0.0 , g= 0.0 ;
298316
299317 if (chebyN) {
300318
@@ -341,7 +359,7 @@ double SphericalModelTable::dfde(double E, double L)
341359
342360 if (!dist_defined) bomb (" distribution function not defined" );
343361
344- double d, g, h, d1;
362+ double d= 0 , g= 0 , h= 0 , d1= 0 ;
345363
346364 if (chebyN) {
347365
@@ -399,7 +417,7 @@ double SphericalModelTable::dfdl(double E, double L)
399417
400418 if (!dist_defined) bomb (" distribution function not defined" );
401419
402- double d, g, h, d1;
420+ double d= 0 , g= 0 , h= 0 , d1= 0 ;
403421
404422 if (chebyN) {
405423
@@ -451,7 +469,7 @@ double SphericalModelTable::d2fde2(double E, double L)
451469{
452470 if (!dist_defined) bomb (" distribution function not defined" );
453471
454- double d, g, h, k, d2;
472+ double d= 0 , g= 0 , h= 0 , k= 0 , d2= 0 ;
455473
456474 if (chebyN) {
457475
0 commit comments