Changeset 1196
- Timestamp:
- 06/15/07 19:09:54 (1 year ago)
- Files:
-
- branches/porter/source/assert_results.cpp (modified) (1 diff)
- branches/porter/source/cddefines.h (modified) (1 diff)
- branches/porter/source/conv_base.cpp (modified) (2 diffs)
- branches/porter/source/helike.cpp (modified) (10 diffs)
- branches/porter/source/helike.h (modified) (4 diffs)
- branches/porter/source/helike_create.cpp (modified) (22 diffs)
- branches/porter/source/helike_cs.cpp (modified) (8 diffs)
- branches/porter/source/helike_cs.h (modified) (3 diffs)
- branches/porter/source/helike_einsta.cpp (modified) (16 diffs)
- branches/porter/source/helike_level.cpp (deleted)
- branches/porter/source/helike_recom.cpp (modified) (7 diffs)
- branches/porter/source/hydrogenic.cpp (modified) (4 diffs)
- branches/porter/source/hydrogenic.h (modified) (1 diff)
- branches/porter/source/hydrolevel.cpp (modified) (5 diffs)
- branches/porter/source/hydrolevelpop.cpp (deleted)
- branches/porter/source/init_coreload.cpp (modified) (1 diff)
- branches/porter/source/ion_recomb_Badnell.cpp (modified) (4 diffs)
- branches/porter/source/iso.h (modified) (5 diffs)
- branches/porter/source/iso_create.cpp (modified) (23 diffs)
- branches/porter/source/iso_level.cpp (added)
- branches/porter/source/iso_radiative_recomb.cpp (modified) (1 diff)
- branches/porter/source/prt_lines.cpp (modified) (1 diff)
- branches/porter/source/prt_lines_helium.cpp (modified) (3 diffs)
- branches/porter/source/prt_zone.cpp (modified) (3 diffs)
- branches/porter/source/rt_tau_init.cpp (modified) (1 diff)
- branches/porter/source/rt_tau_reset.cpp (modified) (1 diff)
- branches/porter/source/sanity_check.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/porter/source/assert_results.cpp
r1185 r1196 2380 2380 StatesElem[ipHE_LIKE][ipHELIUM][ipHi].n, 2381 2381 StatesElem[ipHE_LIKE][ipHELIUM][ipHi].l, 2382 StatesElem[ipHE_LIKE][ipHELIUM][ipHi]. s,2382 StatesElem[ipHE_LIKE][ipHELIUM][ipHi].S, 2383 2383 StatesElem[ipHE_LIKE][ipHELIUM][ipLo].n, 2384 2384 StatesElem[ipHE_LIKE][ipHELIUM][ipLo].l, 2385 StatesElem[ipHE_LIKE][ipHELIUM][ipLo]. s);2385 StatesElem[ipHE_LIKE][ipHELIUM][ipLo].S ); 2386 2386 break; 2387 2387 } branches/porter/source/cddefines.h
r1191 r1196 1031 1031 double ConBoltz; 1032 1032 1033 long n, l, s, j; 1033 /* S is multiplicity. */ 1034 long n, l, S, j; 1034 1035 1035 1036 double lifetime; branches/porter/source/conv_base.cpp
r1136 r1196 423 423 /* do all hydrogenic species, and fully do hydrogen itself, including molecules */ 424 424 /*fprintf(ioQQQ,"DEBUG h2\t%.2f\t%.3e\t%.3e", fnzone,hmi.H2_total,hmi.Hmolec[ipMH2g]);*/ 425 Hydrogenic( );425 Hydrogenic( ipH_LIKE ); 426 426 /*fprintf(ioQQQ,"\t%.3e\n", hmi.Hmolec[ipMH2g]);*/ 427 427 … … 437 437 /* >>chng 02 mar 08 move helike to before helium */ 438 438 /* do all he-like species */ 439 HeLike( );439 HeLike( ipHE_LIKE ); 440 440 441 441 /*>>chng 04 may 09, add option to abort here, inspired by H2 pop failures branches/porter/source/helike.cpp
r1192 r1196 1 1 /* This file is part of Cloudy and is copyright (C)1978-2007 by Gary J. Ferland 2 2 * For conditions of distribution and use see copyright notice in license.txt */ 3 /*prt_He_like_DeparCoef print departure coefficients for helium-like species */ 4 /*prt_He_like_Pops print level populations for helium-like species */ 5 /*HeCreate create he-like series, called by ContCreatePointers */ 3 /*He-like main routine to call HeLevel and determine model he-like species atom level balance, 4 * called by ionize */ 6 5 /*AGN_He1_CS routine to punch table needed for AGN3 - collision strengths of HeI */ 7 /*defect - calculate quantum defect. */8 /*helike_energy - calculates energy of a given level. */9 10 6 #include "cddefines.h" 11 12 /* various useful print statements occur throughout this file - search on PRINTIT */13 /*14 15 Energy order within 2 3P16 17 The order of the levels within the 2 3P level of atomic helium is opposite18 from the order within astrophysically abundant ions. The indices below19 consistently point to the correct level, and the energies are correct,20 so the J levels within 2 3P are not in increasing energy order for helium itself.21 This is ok since the atomic data is correct, and the difference in energies is so small.22 23 */24 25 /*26 the following block of defines occurs in cddefines.h27 const int ipHe1s1S = 0;28 const int ipHe2s3S = 1;29 const int ipHe2s1S = 2;30 const int ipHe2p3P0 = 3;31 const int ipHe2p3P1 = 4;32 const int ipHe2p3P2 = 5;33 const int ipHe2p1P = 6;34 35 level 336 const int ipHe3s3S = 7;37 const int ipHe3s1S = 8;38 const int ipHe3p3P = 9;39 const int ipHe3d3D = 10;40 const int ipHe3d1D = 11;41 const int ipHe3p1P = 12;42 43 level 444 const int ipHe4s3S = 13;45 const int ipHe4s1S = 14;46 const int ipHe4p3P = 15;47 const int ipHe4d3D = 16;48 const int ipHe4d1D = 17;49 const int ipHe4f3F = 18;50 const int ipHe4f1F = 19;51 const int ipHe4p1P = 20;52 */53 54 /*const int ipRad = 0;55 const int ipCollis = 1;56 const int ipEnergy = 2;*/57 58 59 7 #include "dense.h" 60 8 #include "elementnames.h" … … 62 10 #include "helike_cs.h" 63 11 #include "helike_recom.h" 12 #include "hydrogenic.h" 64 13 #include "iso.h" 65 14 #include "phycon.h" … … 71 20 /*lint -e661 creation of out of bound pointer */ 72 21 73 /*static long ipLev,globalZ;*/74 75 /* Ionization potentials (in eV) for each ion in the iso-seq up to Z=30. These are76 * exactly what you get if you take Verner's numbers in atmdat_ph1(0,1,nelem,0)77 * and multiply by 0.9998787, exactly as is done elsewhere in Cloudy. */78 double EionEV[29] =79 {24.59077,75.630824,153.881326,259.368529,392.052444,552.033006,739.210311,80 953.784316,1195.854925,1464.822296,1761.786269,2085.746968,2437.704271,81 2816.658298,3223.608929,3658.556163,4120.500123,4610.440686,5128.377852,82 5674.311623,6248.241996,6851.168852,7481.092433,8140.012497,8827.929042,83 9543.842191,10288.751823,11058.658422,11868.560169};84 85 22 /*He-like main routine to call HeLevel and determine model he-like species atom level balance, 86 23 * called by ionize */ 87 void HeLike( void)24 void HeLike(long ipISO) 88 25 { 89 int lowsav , ihisav; 90 91 long int ipLo, ipHi, nelem, 92 ipISO=ipHE_LIKE; 26 long int ipLo, 27 ipHi, 28 nelem, 29 lowsav, 30 ihisav; 93 31 static bool lgFinitePop[LIMELM]; 94 32 static bool lgMustInit=true; … … 134 72 135 73 /* evaluate collisional rates */ 136 HeCollid( nelem ); 74 if( ipISO == ipH_LIKE ) 75 HydroCollid(nelem); 76 else if( ipISO == ipHE_LIKE ) 77 HeCollid( nelem ); 78 else 79 TotalInsanity(); 137 80 138 81 /* evaluate photoionization rates */ … … 147 90 148 91 /* solve for the level populations */ 149 HeLikeLevel( ipISO, nelem );92 iso_level( ipISO, nelem ); 150 93 151 94 /* say that we have set the populations */ … … 154 97 if( trace.lgTrace ) 155 98 { 156 fprintf( ioQQQ, " Helium-like Z=%2ld H2OVH1=",nelem);99 fprintf( ioQQQ, " iso=%2ld Z=%2ld H2OVH1=",ipISO,nelem); 157 100 fprintf( ioQQQ,PrintEfmt("%10.3e", iso.pop_ion_ov_neut[ipISO][nelem])); 158 101 fprintf( ioQQQ, " simple="); … … 430 373 } 431 374 432 /*prt_ He_like_DeparCoef print departure coefficients for he-like species */433 void prt_He_like_DeparCoef( long ipISO, long nelem)375 /*prt_iso_Pops print out iso sequence populations or departure coefficients */ 376 void iso_prt_pops( long ipISO, long nelem, long lgPrtDeparCoef ) 434 377 { 435 378 long int in, il, is, i, ipLo, nResolved, ipFirstCollapsed=LONG_MIN; 436 437 DEBUG_ENTRY( "prt_He_like_DeparCoef()" ); 438 439 for( is = 0; is<=1; ++is) 440 { 441 char chSpin[2][9]={"singlets","triplets"}; 442 443 ipFirstCollapsed= iso.numLevels_local[ipISO][nelem]-iso.nCollapsed_local[ipISO][nelem]; 444 nResolved = StatesElem[ipISO][nelem][ipFirstCollapsed-1].n; 445 ASSERT( nResolved == iso.n_HighestResolved_local[ipISO][nelem] ); 446 ASSERT(nResolved > 0 ); 447 448 /* give element number and spin */ 449 fprintf(ioQQQ," He-like %s %s departure\n", 450 elementnames.chElementSym[nelem], 451 chSpin[is]); 452 453 /* header with the l states */ 454 fprintf(ioQQQ," n\\l=> "); 455 for( i =0; i < nResolved; ++i) 456 { 457 fprintf(ioQQQ,"%2ld ",i); 458 } 459 fprintf(ioQQQ,"\n"); 460 461 /* loop over prin quant numbers, one per line, with l across */ 462 for( in = is+1; in <= nResolved; ++in) 463 { 464 fprintf(ioQQQ," %2ld ",in); 465 for( il = 0; il < in; ++il) 466 { 467 if( (in==2) && (il==1) && (is==1) ) 468 { 469 fprintf( ioQQQ,PrintEfmt("%9.2e", iso.DepartCoef[ipISO][nelem][ipHe2p3P0])); 470 fprintf( ioQQQ,PrintEfmt("%9.2e", iso.DepartCoef[ipISO][nelem][ipHe2p3P1])); 471 fprintf( ioQQQ,PrintEfmt("%9.2e", iso.DepartCoef[ipISO][nelem][ipHe2p3P2])); 472 } 473 else 474 { 475 ipLo = iso.QuantumNumbers2Index[ipISO][nelem][in][il][is]; 476 fprintf( ioQQQ,PrintEfmt("%9.2e", iso.DepartCoef[ipISO][nelem][ipLo])); 477 } 478 } 479 fprintf(ioQQQ,"\n"); 480 } 481 } 482 /* above loop was over spin, now do collapsed levels, no spin or ang momen */ 483 for( il = ipFirstCollapsed; il < iso.numLevels_local[ipISO][nelem]; ++il) 484 { 485 in = StatesElem[ipISO][nelem][il].n; 486 487 /* prin quan number of collapsed levels */ 488 fprintf(ioQQQ," %2ld ",in); 489 fprintf( ioQQQ,PrintEfmt("%9.2e", iso.DepartCoef[ipISO][nelem][il])); 490 fprintf(ioQQQ,"\n"); 491 } 492 493 DEBUG_EXIT( "prt_He_like_DeparCoef()" ); 494 return; 495 } 496 497 /*prt_He_like_Pops print out helium-like populations */ 498 void prt_He_like_Pops( long ipISO, long nelem ) 499 { 500 long int in, il, is, i, ipLo, nResolved, ipFirstCollapsed=LONG_MIN; 501 502 DEBUG_ENTRY( "prt_He_like_Pops()" ); 503 504 for( is = 0; is<=1; ++is) 505 { 506 char chSpin[2][9]={"singlets","triplets"}; 379 char chPrtType[2][12]={"populations","departure"}; 380 /* first dimension is multiplicity */ 381 char chSpin[3][9]= {"singlets", "doublets", "triplets"}; 382 383 #define ITEM_TO_PRINT(A_) ( lgPrtDeparCoef ? iso.DepartCoef[ipISO][nelem][A_] : StatesElem[ipISO][nelem][A_].Pop ) 384 385 DEBUG_ENTRY( "iso_prt_pops()" ); 386 387 ASSERT( ipISO < NISO ); 388 389 #ifndef NEWHYDRO 390 if( ipISO == ipH_LIKE ) 391 { 392 fprintf(ioQQQ,"\n\n NB H-like %s print-out is broken for old treatment. I'm terribly sorry, but I had to let it die.\n It'll be back soon and better than ever.\n\n", 393 chPrtType[ipH_LIKE] ); 394 DEBUG_EXIT( "iso_prt_pops()" ); 395 return; 396 } 397 #endif 398 399 for( is = 1; is<=3; ++is) 400 { 401 if( ipISO == ipH_LIKE && is != 2 ) 402 continue; 403 else if( ipISO == ipHE_LIKE && is != 1 && is != 3 ) 404 continue; 507 405 508 406 ipFirstCollapsed= iso.numLevels_local[ipISO][nelem]-iso.nCollapsed_local[ipISO][nelem]; … … 512 410 513 411 /* give element number and spin */ 514 fprintf(ioQQQ," He-like %s %s populations\n",412 fprintf(ioQQQ," He-like %s %s %s\n", 515 413 elementnames.chElementSym[nelem], 516 chSpin[is]); 414 chSpin[is-1], 415 chPrtType[lgPrtDeparCoef]); 517 416 518 417 /* header with the l states */ … … 525 424 526 425 /* loop over prin quant numbers, one per line, with l across */ 527 for( in = is+1; in <= nResolved; ++in) 528 { 426 for( in = 1; in <= nResolved; ++in) 427 { 428 if( is==3 && in==1 ) 429 continue; 430 529 431 fprintf(ioQQQ," %2ld ",in); 530 432 531 433 for( il = 0; il < in; ++il) 532 434 { 533 if( (in==2) && (il==1) && (is==1) )534 { 535 fprintf( ioQQQ,PrintEfmt("%9.2e", StatesElem[ipISO][nelem][ipHe2p3P0].Pop));536 fprintf( ioQQQ,PrintEfmt("%9.2e", StatesElem[ipISO][nelem][ipHe2p3P1].Pop));537 fprintf( ioQQQ,PrintEfmt("%9.2e", StatesElem[ipISO][nelem][ipHe2p3P2].Pop));435 if( ipISO==ipHE_LIKE && (in==2) && (il==1) && (is==3) ) 436 { 437 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P0) )); 438 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P1) )); 439 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P2) )); 538 440 } 539 441 else 540 442 { 541 443 ipLo = iso.QuantumNumbers2Index[ipISO][nelem][in][il][is]; 542 fprintf( ioQQQ,PrintEfmt("%9.2e", StatesElem[ipISO][nelem][ipLo].Pop));444 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipLo) )); 543 445 } 544 446 } … … 552 454 /* prin quan number of collapsed levels */ 553 455 fprintf(ioQQQ," %2ld ",in); 554 fprintf( ioQQQ,PrintEfmt("%9.2e", StatesElem[ipISO][nelem][il].Pop));456 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(il) )); 555 457 fprintf(ioQQQ,"\n"); 556 458 } 557 459 558 DEBUG_EXIT( " prt_He_like_Pops()" );460 DEBUG_EXIT( "iso_prt_pops()" ); 559 461 return; 560 462 } branches/porter/source/helike.h
r1192 r1196 22 22 #define CASEABMAGIC (51214) 23 23 24 /** He-like main routine to call HeLikeLevel and determine 25 * model he-like species atom level balance */ 26 void HeLike(void); 24 /**He-like main routine to call iso_level and determine 25 * model he-like species atom level balance 26 \param ipISO 27 */ 28 void HeLike(long ipISO); 27 29 28 /**He LikeLevel level populations30 /**HeCreate create he-like series 29 31 \param ipISO 30 \param nelem31 32 */ 32 void HeLikeLevel( long int ipISO, long int nelem);33 34 /** create he-like series */35 33 void HeCreate( long ipISO ); 36 34 37 /** read in helium collision data files */35 /**HeCollidSetup read in helium collision data files */ 38 36 void HeCollidSetup( void ); 39 37 40 /** get helike level energy in cm-138 /**helike_energy get helike level energy in cm-1 41 39 \param nelem 42 40 \param ipLev … … 44 42 double helike_energy(long nelem, long ipLev ); 45 43 46 /** get helike quantum defect44 /**helike_quantum_defect get quantum defect for helium-like level 47 45 \param nelem 48 46 \param ipLev … … 50 48 double helike_quantum_defect( long int nelem, long int ipLev ); 51 49 52 /** get helike transition probability in s-150 /**helike_transprob get transition probability for helium-like transition [s-1] 53 51 \param nelem 54 52 \param ipHi … … 57 55 float helike_transprob( long nelem, long ipHi, long ipLo ); 58 56 59 /** routine to print departure coefficients for he-like species 60 \param nelem 61 */ 62 void prt_He_like_DeparCoef(long int ipISO, long int nelem ); 63 64 /** routine to print level pops for he-like species 65 \param nelem 66 */ 67 void prt_He_like_Pops(long int ipISO, long int nelem ); 68 69 /** routine to punch table needed for AGN3 - collision strengths of HeI 57 /**AGN_He1_CS routine to punch table needed for AGN3 - collision strengths of HeI 70 58 \param *ioPun 71 59 */ 72 60 void AGN_He1_CS( FILE *ioPun ); 73 61 74 /** this becomes the most number of levels in any member of the he-like iso sequence */ 75 EXTERN long int max_num_levels, max_n; 62 /** this becomes the largest n ever explicitly considered in the he-like iso sequence 63 * resolved or collapsed is irrelevant. */ 64 EXTERN long int max_n; 76 65 branches/porter/source/helike_create.cpp
r1191 r1196 1 1 /* This file is part of Cloudy and is copyright (C)1978-2007 by Gary J. Ferland 2 2 * For conditions of distribution and use see copyright notice in license.txt */ 3 #include "cddefines.h" 3 #include "cddefines.h" 4 #include "atmdat.h" 4 5 #include "physconst.h" 5 6 #include "lines_service.h" … … 17 18 #include "helike_einsta.h" 18 19 20 /* 21 Energy order within 2 3P 22 23 The order of the levels within the 2 3P level of atomic helium is opposite 24 from the order within astrophysically abundant ions. The indices below 25 consistently point to the correct level, and the energies are correct, 26 so the J levels within 2 3P are not in increasing energy order for helium itself. 27 This is ok since the atomic data is correct, and the difference in energies is so small. 28 */ 29 30 /* 31 the following block of defines occurs in cddefines.h 32 const int ipHe1s1S = 0; 33 const int ipHe2s3S = 1; 34 const int ipHe2s1S = 2; 35 const int ipHe2p3P0 = 3; 36 const int ipHe2p3P1 = 4; 37 const int ipHe2p3P2 = 5; 38 const int ipHe2p1P = 6; 39 40 level 3 41 const int ipHe3s3S = 7; 42 const int ipHe3s1S = 8; 43 const int ipHe3p3P = 9; 44 const int ipHe3d3D = 10; 45 const int ipHe3d1D = 11; 46 const int ipHe3p1P = 12; 47 48 level 4 49 const int ipHe4s3S = 13; 50 const int ipHe4s1S = 14; 51 const int ipHe4p3P = 15; 52 const int ipHe4d3D = 16; 53 const int ipHe4d1D = 17; 54 const int ipHe4f3F = 18; 55 const int ipHe4f1F = 19; 56 const int ipHe4p1P = 20; 57 */ 58 19 59 /* the designation of the levels, chLevel[n][string] */ 20 60 static char **chLevel; 21 61 22 /* Ionization potentials (in wavenumber) for each ion in the iso-seq up to Z=30. */23 /* These are exactly what you get if you take EionRYD below and multiply by RYD_INF. */62 /* Ionization potentials (in wavenumber) for each ion in the iso-seq up to Z=30. 63 * These are exactly what you get if you take EionRYD below and multiply by RYD_INF. */ 24 64 static double EionWN[LIMELM] = 25 65 /* the first, or H-like, element is not defined for he-like species */ 26 {-DBL_MAX,27 198310.6679 ,610003.839889137,1241136.72201499,2091948.45665631,3162116.52584231,28 4452446.95015668,5962133.81875305,7692790.05069734,9645221.44709864,11814589.7994457,29 14209766.0528639,16822685.5022862,19661412.9625169,22717883.6187518,26000162.0663204,30 29508248.5246975,33234078.1790787,37185715.7345311,41363161.0813172,45766414.4389118,31 50395475.4781030,55258409.0136949,60339085.8550283,65653635.1927626,71202056.8074231,32 76976286.4328920,82984388.3352872,89194104.5722390,95726403.3055320};66 {-DBL_MAX, 67 198310.6679 ,610003.839889137,1241136.72201499,2091948.45665631,3162116.52584231, 68 4452446.95015668,5962133.81875305,7692790.05069734,9645221.44709864,11814589.7994457, 69 14209766.0528639,16822685.5022862,19661412.9625169,22717883.6187518,26000162.0663204, 70 29508248.5246975,33234078.1790787,37185715.7345311,41363161.0813172,45766414.4389118, 71 50395475.4781030,55258409.0136949,60339085.8550283,65653635.1927626,71202056.8074231, 72 76976286.4328920,82984388.3352872,89194104.5722390,95726403.3055320}; 33 73 34 /* Ionization potentials (in Rydbergs) for each ion in the iso-seq up to Z=30. */35 /* These are exactly what you get if you take EionEV below and divide by EVRYD. */74 /* Ionization potentials (in Rydbergs) for each ion in the iso-seq up to Z=30. 75 * These are exactly what you get if you take EionEV below and divide by EVRYD. */ 36 76 static double EionRYD[LIMELM] = 37 77 /* the first, or H-like, element is not defined for he-like species */ … … 42 82 549.850208,598.279945,648.840883,701.459535,756.209388,812.796486,872.323172}; 43 83 84 /* Ionization potentials (in eV) for each ion in the iso-seq up to Z=30. These are 85 * exactly what you get if you take Verner's numbers in atmdat_ph1(0,1,nelem,0) 86 * and multiply by 0.9998787, exactly as is done elsewhere in Cloudy. */ 87 double EionEV[LIMELM] = 88 /* the first, or H-like, element is not defined for he-like species */ 89 {-DBL_MAX, 90 24.59077,75.630824,153.881326,259.368529,392.052444,552.033006,739.210311, 91 953.784316,1195.854925,1464.822296,1761.786269,2085.746968,2437.704271, 92 2816.658298,3223.608929,3658.556163,4120.500123,4610.440686,5128.377852, 93 5674.311623,6248.241996,6851.168852,7481.092433,8140.012497,8827.929042, 94 9543.842191,10288.751823,11058.658422,11868.560169}; 44 95 45 96 /* experimental energies, in wavenumbers, for atomic helium */ … … 297 348 long int n = StatesElem[ipHE_LIKE][nelem][ipLo].n; 298 349 long int lqn = StatesElem[ipHE_LIKE][nelem][ipLo].l; 299 long int s = StatesElem[ipHE_LIKE][nelem][ipLo].s; 350 long int S = StatesElem[ipHE_LIKE][nelem][ipLo].S; 351 long int s; 352 353 if( S==1 ) 354 s = 0; 355 else if( S==3 ) 356 s = 1; 357 else if( S < 0 ) 358 { 359 ASSERT( n > iso.n_HighestResolved_max[ipHE_LIKE][nelem] ); 360 s = S; 361 } 362 else 363 TotalInsanity(); 300 364 301 365 DEBUG_ENTRY( "helike_quantum_defect()" ); … … 410 474 { 411 475 Eff_n = N_(ipLev) - helike_quantum_defect( nelem, ipLev ); 412 ASSERT( ( L_(ipLev)==1 && S_(ipLev)==0 ) || ( N_(ipLev) - Eff_n >= 0. ) ); 476 /* quantum defect can only be negative for singlet P */ 477 ASSERT( ( L_(ipLev)==1 && S_(ipLev)==1 ) || ( N_(ipLev) - Eff_n >= 0. ) ); 413 478 414 479 /* energies (in wavenumbers) that correspond to quantum defect */ … … 430 495 double **SumAPerN, **RobbinsC; 431 496 432 long int i, j, ipLo, ipHi, ipFirstCollapsed,nelem;497 long int i, j, ipLo, ipHi, nelem; 433 498 434 499 static int nCalled = 0; 435 500 436 char chSpin[2]={'1','3'};437 501 char chL[6]={'S','P','D','F','G','H'}; 438 502 … … 454 518 } 455 519 456 /* first find the largest number of levels in any element in the iso sequence */457 max_num_levels = 0;520 /** find the largest n ever explicitly considered in the he-like iso sequence 521 * resolved or collapsed is irrelevant. */ 458 522 max_n = 0; 459 523 for( nelem=ipISO; nelem < LIMELM; nelem++ ) … … 462 526 if( nelem == ipISO || dense.lgElmtOn[nelem] ) 463 527 { 464 max_num_levels = MAX2( max_num_levels, iso.numLevels_max[ipISO][nelem] );465 528 max_n = MAX2( max_n, iso.n_HighestResolved_max[ipISO][nelem] + iso.nCollapsed_max[ipISO][nelem] ); 466 529 } … … 509 572 } 510 573 511 /* this is the number of resolved levels, so first collapsed level is [ipFirstCollapsed] */512 ipFirstCollapsed = iso.numLevels_max[ipISO][nelem]-iso.nCollapsed_max[ipISO][nelem];513 514 574 /* Initialize some ground state stuff, easier here than in loops. */ 515 575 RobbinsC[ipHe1s1S][ipHe1s1S] = 1.; 516 StatesElem[ipISO][nelem][ipHe1s1S].lifetime = 0.;517 576 iso.CascadeProb[ipISO][nelem][ipHe1s1S][ipHe1s1S] = 1.; 518 577 if( iso.lgRandErrGen[ipISO] ) … … 522 581 } 523 582 524 StatesElem[ipHE_LIKE][nelem][ipHe1s1S].g = 1.f; 525 526 /** \todo 2 remove the next two loops. */ 527 /* Already done in iso_create, here we just assert sanity. */ 528 529 /************************************************/ 530 /********** Transition probabilities ***********/ 531 /************************************************/ 532 for( ipHi=ipHe2s3S; ipHi<iso.numLevels_max[ipISO][nelem]; ipHi++ ) 533 { 534 for( ipLo=ipHe1s1S; ipLo<ipHi; ipLo++ ) 535 { 536 double Aul; 537 /* set the transition probability */ 538 Aul = helike_transprob(nelem, ipHi, ipLo); 539 ASSERT(Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul == Aul); 540 SumAPerN[nelem][N_(ipHi)] += Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul; 541 } 542 } 543 544 /************************************************/ 545 /********** Lifetimes of levels **************/ 546 /************************************************/ 547 for( ipHi=ipHe2s3S; ipHi<iso.numLevels_max[ipISO][nelem]; ipHi++ ) 548 { 549 double dummyLifetime = SMALLFLOAT; 550 551 for( ipLo=ipHe1s1S; ipLo<ipHi; ipLo++ ) 552 { 553 /* This is not actually the lifetime...must invert when all A's added. */ 554 /* No stat. weight is needed because this is the lifetime of an individual level, 555 * Collapsed or resolved is irrelevant. */ 556 dummyLifetime += Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul; 557 } 558 559 /* convert sum of As into proper lifetime in seconds */ 560 dummyLifetime = 1./dummyLifetime; 561 ASSERT( StatesElem[ipISO][nelem][ipHi].lifetime == dummyLifetime ); 562 } 563 564 /************************************************/ 565 /********** stuff gf, opacity, etc. **********/ 566 /************************************************/ 583 /***************************************************************************/ 584 /****** Cascade probabilities, Branching ratios, and associated errors *****/ 585 /***************************************************************************/ 567 586 for( ipHi=ipHe2s3S; ipHi<iso.numLevels_max[ipISO][nelem]; ipHi++ ) 568 587 { … … 570 589 RobbinsC[ipHi][ipHi] = 1.; 571 590 iso.CascadeProb[ipISO][nelem][ipHi][ipHi] = 1.; 591 iso.BranchRatio[ipISO][nelem][ipHi][ipHe1s1S] = 0.; 592 572 593 if( iso.lgRandErrGen[ipISO] ) 573 594 { … … 575 596 iso.SigmaCascadeProb[ipISO][nelem][ipHi][ipHi] = 0.; 576 597 } 577 598 578 599 for( ipLo=ipHe1s1S; ipLo<ipHi; ipLo++ ) 579 600 { 580 601 RobbinsC[ipHi][ipLo] = 0.; 581 602 iso.CascadeProb[ipISO][nelem][ipHi][ipLo] = 0.; 603 iso.BranchRatio[ipISO][nelem][ipHi][ipLo] = 604 Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul * 605 StatesElem[ipISO][nelem][ipHi].lifetime; 606 /* >>chng 06 mar 08, had been <= 1.0000001, increased to 607 * when Aul converted to float */ 608 /* \todo 2 find out what's wrong here. */ 609 ASSERT( iso.BranchRatio[ipISO][nelem][ipHi][ipLo] <= 1.007 ); 610 611 SumAPerN[nelem][N_(ipHi)] += Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul; 582 612 583 613 /* there are some negative energy transitions, where the order … … 587 617 Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul <= iso.SmallA ); 588 618 589 #if 0 590 /* very forbidden transitions may have negative energies */ 591 if( Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul <= iso.SmallA || 592 Transitions[ipISO][nelem][ipHi][ipLo].EnergyWN <= 0.) 619 if( iso.lgRandErrGen[ipISO] ) 593 620 { 594 /* this branch - bogus line */ 595 /* transition energy in various units:*/ 596 597 /* take abs value since some have order switched */ 598 /* make following an air wavelength */ 599 Transitions[ipISO][nelem][ipHi][ipLo].WLAng = 1e6f; 600 601 Transitions[ipISO][nelem][ipHi][ipLo].Emis.gf = 1e-20f; 602 603 /* derive the abs coef, call to function is Emis.gf, wl (A), g_low */ 604 Transitions[ipISO][nelem][ipHi][ipLo].Emis.opacity = 0.; 621 ASSERT( iso.Error[ipISO][nelem][ipHi][ipLo][IPRAD] >= 0. ); 622 /* Uncertainties in A's are added in quadrature, square root is taken below. */ 623 iso.SigmaAtot[ipISO][nelem][ipHi] += 624 pow( iso.Error[ipISO][nelem][ipHi][ipLo][IPRAD] * 625 (double)Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul, 2. ); 605 626 } 606 else 627 } 628 629 if( iso.lgRandErrGen[ipISO] ) 630 { 631 /* Uncertainties in A's are added in quadrature above, square root taken here. */ 632 iso.SigmaAtot[ipISO][nelem][ipHi] = sqrt( iso.SigmaAtot[ipISO][nelem][ipHi] ); 633 } 634 635 /* cascade probabilities */ 636 for( ipLo=ipHe1s1S; ipLo<ipHi; ipLo++ ) 637 { 638 double SigmaA, SigmaCul = 0.; 639 /*ASSERT( ipLo < ipHi );*/ 640 for( i=ipLo /* + 1*/; i<ipHi; i++ ) 607 641 { 608 /* take abs value since some have order switched */ 609 /* make following an air wavelength */ 610 Transitions[ipISO][nelem][ipHi][ipLo].WLAng = 611 (float)fabs(1.0e8/ 612 Transitions[ipISO][nelem][ipHi][ipLo].EnergyWN/ 613 RefIndex( Transitions[ipISO][nelem][ipHi][ipLo].EnergyWN )); 642 RobbinsC[ipHi][ipLo] += iso.BranchRatio[ipISO][nelem][ipHi][i] * RobbinsC[i][ipLo]; 643 if( iso.lgRandErrGen[ipISO] ) 644 { 645 /* Uncertainties in A's and cascade probabilities */ 646 SigmaA = iso.Error[ipISO][nelem][ipHi][i][IPRAD] * 647 Transitions[ipHE_LIKE][nelem][ipHi][i].Emis.Aul; 648 SigmaCul += 649 pow(SigmaA*RobbinsC[i][ipLo]*StatesElem[ipISO][nelem][ipHi].lifetime, 2.) + 650 pow(iso.SigmaAtot[ipISO][nelem][ipHi]*iso.BranchRatio[ipISO][nelem][ipHi][i]*RobbinsC[i][ipLo]*StatesElem[ipISO][nelem][ipHi].lifetime, 2.) + 651 pow(iso.SigmaCascadeProb[ipISO][nelem][i][ipLo]*iso.BranchRatio[ipISO][nelem][ipHi][i], 2.); 652 } 614 653 615 Transitions[ipISO][nelem][ipHi][ipLo].Emis.gf =616 (float)(GetGF(Transitions[ipISO][nelem][ipHi][ipLo].Emis.Aul,617 Transitions[ipISO][nelem][ipHi][ipLo].EnergyWN,618 Transitions[ipISO][nelem][ipHi][ipLo].Hi.g));619 ASSERT(Transitions[ipISO][nelem][ipHi][ipLo].Emis.gf > 0.);620 621 /* derive the abs coef, call to function is Emis.gf, wl (A), g_low */622 Transitions[ipISO][nelem][ipHi][ipLo].Emis.opacity =623 (float)(abscf(Transitions[ipISO][nelem][ipHi][ipLo].Emis.gf,624 Transitions[ipISO][nelem][ipHi][ipLo].EnergyWN,625 Transitions[ipISO][nelem][ipHi][ipLo].Lo.g));626 Transitions[ipISO][nelem][ipHi][ipLo].Emis.opacity =627 MAX2(0.f, Transitions[ipISO][nelem][ipHi][ipLo].Emis.opacity );628 654 } 629 #endif 655 iso.CascadeProb[ipISO][nelem][ipHi][ipLo] = RobbinsC[ipHi][ipLo]; 656 if( iso.lgRandErrGen[ipISO] ) 630 657 { 631 /* option to print particulars of some line when called 632  
