cloudy
trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*atmdat_outer_shell determine outer shell, and statistical weights of that and higher ion, for any ion 00004 * written by Dima Verner */ 00005 #include "cddefines.h" 00006 #include "atmdat.h" 00007 00008 void atmdat_outer_shell(long int iz, /* atomic number from 1 to 30 */ 00009 long int in, /* number of electrons from 1 to iz */ 00010 long int *imax, /* number of the outer shell */ 00011 long int *ig0, /* statistical weight of (iz,in) ground state */ 00012 long int *ig1) /* statistical weight of (iz,in-1) ground state */ 00013 { 00014 long int kg; 00015 00016 static long iss[30]={1,1,2,2,3,3,3,3,3,3,4,4,5,5,5,5,5,5,6,6,6, 00017 6,6,6,6,6,6,6,7,7}; 00018 00019 static long igl[30]={2,1,2,1,2,1,4,5,4,1,2,1,2,1,4,5,4,1,4,5,4, 00020 1,6,9,10,9,6,1,2,1}; 00021 00022 static long iga[12]={2,1,4,5,4,7,6,9,10,9,2,1}; 00023 00024 DEBUG_ENTRY( "atmdat_outer_shell()" ); 00025 /*determine outer shell for some species */ 00026 /****************************************************************************** 00027 *** Input parameters: iz - atomic number from 1 to 30 (integer) 00028 *** in - number of electrons from 1 to iz (integer) 00029 *** Output parameters: imax - number of the outer shell 00030 *** ig0 - statistical weight of (iz,in) ground state 00031 *** ig1 - statistical weight of (iz,in-1) ground state 00032 ****************************************************************************** */ 00033 00034 if( iz < 1 || iz > 30 ) 00035 { 00036 fprintf( ioQQQ, " ***ERROR: wrong atomic number\n" ); 00037 return; 00038 } 00039 00040 if( in < 1 || in > iz ) 00041 { 00042 fprintf( ioQQQ, " ***ERROR: wrong number of electrons\n" ); 00043 return; 00044 } 00045 00046 /*** Number of the outer shell and statistical weight */ 00047 *imax = iss[in-1]; 00048 *ig0 = igl[in-1]; 00049 00050 /* in is 1 or greater - as verified above */ 00051 if( in == 1 ) 00052 { 00053 *ig1 = 1; 00054 } 00055 00056 else if( in > 1 ) 00057 { 00058 *ig1 = igl[in-2]; 00059 } 00060 00061 else 00062 { 00063 /* this is total insanity, cannot happen*/ 00064 fprintf( ioQQQ, " ***ERROR: in insaniy in atmdat_outer_shell\n" ); 00065 return; 00066 } 00067 00068 if( in > 18 && iz == in ) 00069 { 00070 *imax = 7; 00071 kg = iz - 18; 00072 *ig0 = iga[kg-1]; 00073 if( iz == 20 ) 00074 *ig1 = 2; 00075 if( iz == 21 ) 00076 *ig1 = 3; 00077 if( iz == 22 ) 00078 *ig1 = 4; 00079 if( iz == 25 ) 00080 *ig1 = 7; 00081 if( iz == 26 ) 00082 *ig1 = 10; 00083 if( iz == 30 ) 00084 *ig1 = 2; 00085 } 00086 00087 if( in > 18 && (iz - in) == 1 ) 00088 { 00089 if( iz == 20 ) 00090 { 00091 *imax = 7; 00092 *ig0 = 2; 00093 } 00094 00095 if( iz == 21 ) 00096 { 00097 *imax = 7; 00098 *ig0 = 3; 00099 } 00100 00101 if( iz == 22 ) 00102 { 00103 *imax = 7; 00104 *ig0 = 4; 00105 } 00106 00107 if( iz == 25 ) 00108 { 00109 *imax = 7; 00110 *ig0 = 7; 00111 } 00112 00113 if( iz == 26 ) 00114 { 00115 *imax = 7; 00116 *ig0 = 10; 00117 } 00118 00119 if( iz == 30 ) 00120 { 00121 *imax = 7; 00122 *ig0 = 2; 00123 } 00124 00125 } 00126 00127 return; 00128 }