cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
atmdat_outer_shell.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2017 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*atmdat_outer_shell determine outer shell, and statistical weights of that and higher ion, for any ion
4  * written by Dima Verner */
5 #include "cddefines.h"
6 #include "atmdat.h"
7 
8 void atmdat_outer_shell(long int iz, /* atomic number from 1 to 30 */
9  long int in, /* number of electrons from 1 to iz */
10  long int *imax, /* number of the outer shell */
11  long int *ig0, /* statistical weight of (iz,in) ground state */
12  long int *ig1) /* statistical weight of (iz,in-1) ground state */
13 {
14  long int kg;
15 
16  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,
17  6,6,6,6,6,6,6,7,7};
18 
19  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,
20  1,6,9,10,9,6,1,2,1};
21 
22  static long iga[12]={2,1,4,5,4,7,6,9,10,9,2,1};
23 
24  DEBUG_ENTRY( "atmdat_outer_shell()" );
25  /*determine outer shell for some species */
26  /******************************************************************************
27  *** Input parameters: iz - atomic number from 1 to 30 (integer)
28  *** in - number of electrons from 1 to iz (integer)
29  *** Output parameters: imax - number of the outer shell
30  *** ig0 - statistical weight of (iz,in) ground state
31  *** ig1 - statistical weight of (iz,in-1) ground state
32  ****************************************************************************** */
33 
34  if( iz < 1 || iz > 30 )
35  {
36  fprintf( ioQQQ, " ***ERROR: wrong atomic number\n" );
37  return;
38  }
39 
40  if( in < 1 || in > iz )
41  {
42  fprintf( ioQQQ, " ***ERROR: wrong number of electrons\n" );
43  return;
44  }
45 
46  /*** Number of the outer shell and statistical weight */
47  *imax = iss[in-1];
48  *ig0 = igl[in-1];
49 
50  /* in is 1 or greater - as verified above */
51  if( in == 1 )
52  {
53  *ig1 = 1;
54  }
55 
56  else if( in > 1 )
57  {
58  *ig1 = igl[in-2];
59  }
60 
61  else
62  {
63  /* this is total insanity, cannot happen*/
64  fprintf( ioQQQ, " ***ERROR: in insaniy in atmdat_outer_shell\n" );
65  return;
66  }
67 
68  if( in > 18 && iz == in )
69  {
70  *imax = 7;
71  kg = iz - 18;
72  *ig0 = iga[kg-1];
73  if( iz == 20 )
74  *ig1 = 2;
75  if( iz == 21 )
76  *ig1 = 3;
77  if( iz == 22 )
78  *ig1 = 4;
79  if( iz == 25 )
80  *ig1 = 7;
81  if( iz == 26 )
82  *ig1 = 10;
83  if( iz == 30 )
84  *ig1 = 2;
85  }
86 
87  if( in > 18 && (iz - in) == 1 )
88  {
89  if( iz == 20 )
90  {
91  *imax = 7;
92  *ig0 = 2;
93  }
94 
95  if( iz == 21 )
96  {
97  *imax = 7;
98  *ig0 = 3;
99  }
100 
101  if( iz == 22 )
102  {
103  *imax = 7;
104  *ig0 = 4;
105  }
106 
107  if( iz == 25 )
108  {
109  *imax = 7;
110  *ig0 = 7;
111  }
112 
113  if( iz == 26 )
114  {
115  *imax = 7;
116  *ig0 = 10;
117  }
118 
119  if( iz == 30 )
120  {
121  *imax = 7;
122  *ig0 = 2;
123  }
124 
125  }
126 
127  return;
128 }
FILE * ioQQQ
Definition: cddefines.cpp:7
void atmdat_outer_shell(long int iz, long int in, long int *imax, long int *ig0, long int *ig1)
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217