Hot fixes to C07.02

Format: The hot fix should give the file and line to be edited, or a link to the patch with the correction. If the bug affects any predictions this should be noted. The date that the hot fix was posted should be listed, along with an acknowledgment to the person who identified the problem.

Hot fixes to version C07.02.02

patch4 (Unix patch)

The code for testing convergence of an iteration was not safe against FP overflow, which could lead to spurious crashes. Place the patch file patch4 in the source directory and apply the patch, as described on the PatchFiles page to resolve this problem. Thanks to Linda Strubbe for reporting this problem. 2008 July 9.

Hot fixes to version C07.02.01

These have been included in the C07.02.02 service release.

The punch hydrogen ionization command can cause a floating point exception. The problem can be fixed by altering line 1694 of punch_do.cpp as follows:

        /* simple H+ */
        iso.gamnc[ipH_LIKE][ipHYDROGEN][ipH1s]*dense.xIonDense[ipHYDROGEN][0]/SDIV(dense.eden*dense.xIonDense[ipHYDROGEN][1]), // <-- altered line

Only the penultimate line is changed: add SDIV right after the division sign. Thanks to Kilian Braun for finding this problem and to Andrew Benson for fixing the bug in the fix. 2008 Apr 18.

The rate coefficient for the reaction H0 + He+ -> H+ + He0 was incorrectly entered as the reverse process. To fix edit the file atmdat_char_tran.cpp and change line 98 from this

			atmdat.HCharExcIonOf[ipHELIUM][0] += 7.47e-15*pow(phycon.te/1e4,2.06)*

to this

			atmdat.HCharExcRecTo[ipHELIUM][0] += 7.47e-15*pow(phycon.te/1e4,2.06)*

This change will affect the ionization balance of certain low-ionization clouds. Thanks to James Wadsley for finding the problem and to Phillip Stancil and Ryan Porter for identifying the source of the error. 2008 March 22.

The code could fail with internal insanity when the interpolate option is used to set the continuum shape in a series of calculations done in a grid. Edit the file parse_interp.cpp and change line 415 from this

    for( i=npairs; i < rfield.nupper; i++ )

to this

    for( i=npairs+1; i < rfield.nupper; i++ )

That is, the "+1" should be added to the lower limit of the loop. This fix only needs to be made if you have grid runs fail with the interpolate command. Thanks to Rob Wiersma for reporting the bug and to Ryan Porter for fixing it. 08 March 22.

The code could fail with internal insanity if the resolution of the continuum mesh, as defined in continuum_mesh.dat is made very fine. This is caused by round off error in the floating point numbers. If you need to use a very fine continuum mesh and encounter this problem you should make this fix. Edit routine cont_setintensity.cpp and change the code at line 201 to read as follows:

	rfield.anu[i] = (float)(amean2/amean);
	if( i )
		/* prevent roundoff from allowing i cell to lie below i-1
		 * cell when continuum mesh is very fine */
		rfield.anu[i] = MAX2( rfield.anu[i] , rfield.anu[i-1]*(1.f+FLT_EPSILON) );
		ASSERT( rfield.anu[i] > rfield.anu[i-1] );
	rfield.anu2[i] = (float)(amean3/amean);

The first and last line are not changed - the if block is the patch code. This fix is only necessary if a very high resolution continuum mesh is to be used. Thanks to Valentina Luridiana for reporting this problem. 2008 Jan 23.

The recombination intensity of O II 4651 was not included in the transferred lines and so would appear with zero intensity under some conditions. To fix edit routine prt_lines_lv1_li_ne.cpp and change lines around 913-916 to read as follows:

	/* recombination and specific pump for OII 4638.86-4696.35 (8 lines) */
	rec = GetLineRec(82, 4651 );
	PntForLine(4651.,"O  2",&ipnt);
	lindst(rec,4651,"O 2r",ipnt,'i',true );

This fix is only necessary if this line is needed. Thanks to Jorge Garcia-Rojas and Monica Rodriguez for pointing out this problem. 2007 Dec 09

If you include either the command grains vary or grains "some_file.opc" vary, or some variation thereof, the run would crash on a TotalInsanity. This is caused by a broken test if a variable was initialized. The hot fix is to edit parse_grain.cpp and simply delete the following test:

  367 :  		if( length == 0 )
  368 :  			TotalInsanity();

Problem reported by Enrique Pérez Montero. 2007 Dec 07

A bug in the calculation of stark broadening caused escape probabilities for lines from Rydberg levels to be underestimated. To correct, edit iso_create.cpp at line 367. The source should be changed to the following:

					jj = j;

That is, change "jj = jj" to "jj = j". This change will cause the following six botches in the test suite:

blr_f92.out: ChkAssert botch>>H  1  4861A     2.0677 =     1.7980  -0.150   0.050
blr_f92.out: ChkAssert botch>>H  1 1.875m     0.4067 =     0.3560  -0.142   0.050
blr_n11_p20.out: ChkAssert botch>>totl  4861A     7.4149 =     7.3590  -0.137   0.050
blr_rnfb.out: ChkAssert botch>>TOTL  4861A     3.3538 =     2.8000  -0.198   0.050  <<BIG BOTCH!!
blr_rnfb.out: ChkAssert botch>>H  1  6563A     7.6170 =     6.8900  -0.106   0.100[[BR]]
blr_rnfb.out: ChkAssert botch>>H  1 1.875m     0.5187 =     0.4040  -0.284   0.050  <<BIG BOTCH!!

2007 Oct 25

The set atomic data As oxygen 2 new did not select the Zeippen 1987 results. To correct, edit parse_set.cpp and change line 112 so that it reads as follows:

	dense.lgAsChoose[nelem][ion-1] = true;

That is, change [ion] to [ion-1]. Many thanks to R. Surendiranath for uncovering this error. 2007 Oct 15.

In FITS files produced for use in XSPEC, logarithmic interpolation was specified. This caused problems for negative values since the log of a negative number is undefined. Ideally, there would be a command-line option to specify the interpolation method, but for now we just switch the hard-wired specification to linear interpolation. The effect is, of course, negligible for a sufficiently resolved grid with positive parameter values. Line 75 of grid_xspec.cpp should be changed from this

grid.paramMethods[i] = 1;

to this

grid.paramMethods[i] = 0;

Thanks to Bryan Armentrout for pointing out this issue. 2007 Sep 4.

patch3 (Unix patch)

Only one punch opacity command can be used in a given input stream since all flavors of the punch opacity commands use the same variables. The fix involves several changes to the source and is included in R1286 of the C07.02 branch. It will be included in the next service release. Or place the patch file patch3 in the source directory and apply the patch, as described on the PatchFiles page. Thanks to Orly Gnat for reporting this problem. 2007 July 20.

patch2 (Unix patch)

Thomas Rauch has recently updated his hydrogen-only grid. The test in the auto test suite was still based on the previous version of the grid. Using the new grid with the existing test case will yield botched asserts. This is not a problem in the code, but simply reflects the fact that we were still testing the older grid. In order to fix the botched asserts, change the following asserts in the file

// >>chng 07 jul 16, from -2.3007 to -2.2862, update Rauch atmospheres
assert ionization Beryllium   element 5  -2.2862

// >>chng 07 jul 16, from -1.995 to -1.9836, update Rauch atmospheres
assert ionization Boron       element 5  -1.9836

// >>chng 07 jul 16, from -0.7413 to -0.7249, update Rauch atmospheres
assert ionization Phosphorus  element 5  -0.7249
// >>chng 07 jul 16, from -0.9565 to -0.9347, update Rauch atmospheres
assert ionization Phosphorus  element 6  -0.9347
// >>chng 07 jul 16, from -2.282 to -2.2680, update Rauch atmospheres
assert ionization Phosphorus  element 7  -2.2680

Alternatively you can apply the patch listed above using the Unix patch command. Download the file patch2 anywhere on your computer, then cd to the Cloudy tsuite/auto directory and issue the command patch < /path/to/patch2. You can remove the file patch2 after you finished. 07 Jul 16.

fixes to version C07.02.00

These have been included in the C07.02.01 service release.

The incident continua at 1215 and 4860 Angstroms were zero in the emergent line intensities. These appear in the emission-line print out with the labels "Inci" and the two wavelengths and can be used to print the line spectrum as equivalent widths rather than intensities (see the observed quantities section of Hazy 3). To fix, edit file prt_lines_continuum.cpp and add the following after line 227

	if( LineSave.ipass > 0 )
		LineSv[LineSave.nsum-1].sumlin[1] = LineSv[LineSave.nsum-1].sumlin[0];

Add the same code after the call to linadd that occurs four lines below this. After the change the code starting near line 227 will read as

	/* incident continuum nu*f_nu at H-beta, at illuminated face of cloud  */
	continuum.cn4861 /= (float)radius.dVeff;
	if( LineSave.ipass > 0 )
		LineSv[LineSave.nsum-1].sumlin[1] = LineSv[LineSave.nsum-1].sumlin[0];

	/* incident continuum nu*f_nu near Ly-alpha, at illuminated face of cloud */
	continuum.cn1216 /= (float)radius.dVeff;
	if( LineSave.ipass > 0 )
		LineSv[LineSave.nsum-1].sumlin[1] = LineSv[LineSave.nsum-1].sumlin[0];

	continuum.cn1216 *= (float)radius.dVeff;
	continuum.cn4861 *= (float)radius.dVeff;

This fix is in r1197 on the mainline and is merged into the c07.02 branch in r1198. Bug originally reported by Kirk Korista on 2007 June 14 on the discussion forum. Fix posted 2007 June 16.

Certain models that include the large model of the H2 molecule will have trouble finding an initial solution if a mix of electrons, protons, hydrogen atoms, and molecules are all present. This occurs in cosmic ray heated / ionized conditions. The problem is caused by the near perfect cancellation between very large heating and cooling terms due to collisions within X. The solution is to delay including X collisional heating / cooling until after search phase has found the rough initial temperature. The fix is to add the following to the end of routine H2_Cooling in file mole_h2.cpp. At line 3751 add these two lines:

	if( conv.lgSearch )
		hmi.HeatH2Dexc_BigH2 = 0.;

The fix is included in r1176 on the mainline and is merged into the C07.02 branch in r1177. This will be included in the C07.02.01 release. 2007 June 08

In prt_columns.cpp, there was an implicit assumption that there could not be a stage with an insignificant column between two stages with significant columns. So the insignificant column was used as a sentinel that the rest of the columns did not need to be printed. The assumption is not valid. The easy fix is to comment out line 73, so that it looks like this:

/* lgHIT = true; */

In the next version, we will also print -30.0 instead of 0.0 for small columns.

In ion_recomb_Badnell.cpp, two while loops occasionally caused an array bounds to be exceeded. The following lines two lines are added just below "--nn_counter[z_value][n_value];" at lines 492 and 530:

if( nn_counter[z_value][n_value] < 0 )


The fix causes no botches in the test suite.

Photoexcitation of upper levels of split ground terms by the UV radiation field is included using the "level2 lines", a large set of optically allowed transitions that D. Verner brought in from the Opacity Project. This level2 line pumping will not be included if the "no level2 lines" command is entered, since these lines are not computed. The code will no longer print column densities of excited levels if the level2 lines are disabled.

The set atomic data command now has the option sulphur DR to change the treatment of S dielectronic recombination. This change was merged into the C07.02.01 release. The guesses which are used when no DR data are available are now the mean of the logs of the DR rates. This is better due to the large dispersion in rate coefficients. Accurate DR rates do not now exist for low stages of ionization of S at photoionization temperatures. The relative [S III] / [S II] ratio is an important diagnostic indicator of conditions in many nebulae. This ratio depends on the DR rates chosen. This command changes the DR rates assumed for the lowest four ionization stages of S. The default, which can also be set with the keyword _mix, is to use the larger of the Badnell (1991; ApJ, 379, 356 ) or guessed rates. The keyword pure says to use only the Badnell rates. The keyword scale says to use scaled oxygen DR rates. In this case one to four scale factors, one for each ionization stage, will be parsed off the command line. If fewer than four numbers occur then the last number entered will be used for the missing scale factors. The DR rate for ions of S will be equal to the DR rate for the same ionization stage of O multiplied by its scale factor.

The punch continuum and punch xspec mtable commmands did not include line absorption. The 07.02.01 bugfix rollup will contain a fix to this. 07 May 01. Thanks to Jon Miller for finding this problem.

The low-l proton impact excitations in the helium isoelectronic sequence were greatly overestimated. The 07.02.01 bugfix rollup will contain a fix to this. 07 May 01. This was discovered thanks to the careful review by Manuel Bautista of the Porter & Ferland (2007) manuscript (

The print coolants command printed a corrupted string due to a string overwrite. As a result some of the line labels were written together. The 07.02.01 bugfix rollup will contain a fix to this. 07 April 20. Thanks to Valentina Luridana for finding this problem.

The table command does not remove the filename that occurs in the table line, table read, and table star commands, before parsing the command. This means that the filename can fool the parser. The 07.02.01 bugfix rollup will contain a fix to this. 07 April 20. Thanks for Susmita Chakravorty for finding this problem.

patch1 (Unix patch)

There is a bug that causes the values for <Tden>, <dens>, <MolWgt>, Mean Jeans l(cm), and M(sun) to be wrong in the Cloudy output. To fix the problem, two files need to be altered. First, edit the file zero.cpp on lines 1326 through 1328 as follows:

1326 :  	colden.TotMassColl = 0.;
1327 :  	colden.tmas = 0.;
1328 :  	colden.wmas = 0.;

Second, edit the file iter_startend.cpp on lines 366 through 368 as follows:

366 :  	colden.TotMassColl = 0.;
367 :  	colden.tmas = 0.;
368 :  	colden.wmas = 0.;

Alternatively you can apply the patch listed above using the Unix patch command. Download the file patch1 anywhere on your computer, then cd to the Cloudy source directory and issue the command patch < /path/to/patch1. You can remove the file patch1 after you finished. 07 Mar 26.

Return to HotFixes main page

Return to the StepByStep instructions

Return to main wiki page

Last modified 2 years ago Last modified on 2018-03-05T12:41:03Z