00001 
00002 
00003 
00004 #include "cddefines.h"
00005 #include "radius.h"
00006 #include "colden.h"
00007 #include "h2.h"
00008 #include "mole.h"
00009 #include "atomfeii.h"
00010 #include "molcol.h"
00011 
00012 void molcol(
00013         const char *chLabel,
00014         
00015         FILE *ioMEAN )
00016 {
00017         long int i;
00018 
00019         DEBUG_ENTRY( "molcol()" );
00020 
00021         
00022         FeII_Colden( chLabel);
00023         h2.H2_Colden( chLabel);
00024 
00025         if( strcmp(chLabel,"ZERO") == 0 )
00026         {
00027                 
00028                 for( i=0; i < mole_global.num_calc; i++ )
00029                 {
00030                         mole.species[i].column = 0.;
00031                 }
00032         }
00033 
00034         else if( strcmp(chLabel,"ADD ") == 0 )
00035         {
00036                 
00037                 for( i=0; i < mole_global.num_calc; i++ )
00038                 {
00039                         mole.species[i].column += (realnum)(mole.species[i].den*radius.drad_x_fillfac);
00040                 }
00041         }
00042 
00043         else if( strcmp(chLabel,"PRIN") == 0 )
00044         {
00045                 bool lgFirstPrint = true;
00046                 
00047                 int j=0;
00048                 chem_atom *heavyAtom = null_atom, *lastHeavyAtom = null_atom;
00049                 for( i=0; i < mole_global.num_calc; i++ )
00050                 {
00051                         if(mole.species[i].location == NULL && ( !mole_global.list[i]->isMonatomic() || !mole_global.list[i]->lgGas_Phase ) )
00052                         {
00053                                 lastHeavyAtom = heavyAtom;
00054                                 heavyAtom = mole_global.list[i]->heavyAtom();
00055                                 if(j == 8 || heavyAtom != lastHeavyAtom)
00056                                 {
00057                                         fprintf( ioMEAN, "\n" );
00058                                         if (heavyAtom != lastHeavyAtom)
00059                                         {
00060                                                 fprintf ( ioMEAN, "==== %-*.*s compounds ====",
00061                                                                 CHARS_ISOTOPE_SYM, CHARS_ISOTOPE_SYM, heavyAtom->label().c_str() );
00062                                                 if( lgFirstPrint )
00063                                                 {
00064                                                         fprintf ( ioMEAN, "           Log10 column densities [cm^-2}");
00065                                                         lgFirstPrint = false;
00066                                                 }
00067                                                 fprintf(ioMEAN, "\n");
00068                                         }
00069                                         j = 0;
00070                                 }
00071                                 fprintf( ioMEAN, "   %-*.*s:", CHARS_SPECIES, CHARS_SPECIES, mole_global.list[i]->label.c_str() );
00072                                 fprintf( ioMEAN, "%7.3f",log10(MAX2(SMALLFLOAT,mole.species[i].column )));
00073                                 j++; 
00074                         }
00075                 }
00076                 if (j != 0)
00077                         fprintf( ioMEAN, "\n" );
00078         }
00079 
00080         else
00081         {
00082                 fprintf( ioMEAN, " molcol does not understand the label %4.4s\n", 
00083                   chLabel );
00084                 cdEXIT(EXIT_FAILURE);
00085         }
00086         return;
00087 
00088 }