/* Spectroscopic Toolkit version 1.94 by Pieter Suurmond, april 16, 2011. Copyright (c) 2000-2008 - Pieter Suurmond Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define kST_txt_base "gfall.dat" /* Path of textfile to read. */ #define kST_bin_base "gfall.pbin" /* Path of binary file to write. */ #define kKuruczLinesTotal (564942L) /* To check if whole database is read. */ #define kKuruczChecksum (3942512604UL) /* Sum of unsigned bytes in textfile. */ /*----------------------------------------------------------------------------*/ /* Reads the large textfile, outputs a binary version of the database. When argument msg is not NULL, diagnostic messages may be written. Returns 1 if the binary file is already there. Returns 0 if packing succeeded. Returns a negative error number on failures. Linelists with names of the form GF* have the following 160 column format: 1 80 +++++++++++^^^^^^^++++++^^^^^^^^^^^^+++++^++++++++++^^^^^^^^^^^^+++++^++++++++++ 800.7110 0.116 27.00 45924.947 3.5 (3F)5s e2F 33439.661 4.5 (3F)4p y2G wl(nm) log gf elem E(cm-1) J label E'(cm-1) J' label' code [char*28 level descriptor ][char*28 level descriptor ] 81 160 ^^^^^^++++++^^^^^^++++^^++^^^++++++^^^++++++^^^^^+++++^+^+^+^+++^^^^^+++++^^^^^^ 8.19 -5.38 -7.59K88 0 0 59-2.584 59 0.000 104 -77F6 -5 0 1140 1165 0 log log log ref NLTE iso log iso log hyper F F' glande iso Gamma Gamma Gamma level hyper f iso frac shift(mK) ^ glande'shift rad stark vdW numbers E E' ^abc (x1000) (mA) I*1^char*3 1 wavelength (nm) air above 200 nm F11.4 codes 2 log gf F7.3 3 element code = element number + charge/100. F6.2 4 first energy level in cm-1 F12.3 5 J for first level F5.1 blank for legibility 1X 6 label field for first level A10 7 second energy level in cm-1 F12.3 (negative energies are predicted or extrapolated} 8 J for second level F5.1 blank for legibility 1X 9 label field for second level A10 10 log of radiative damping constant, Gamma Rad F6.2 or F6.3 11 log of stark damping constant/electron number. Gamma Stark F6.2 or F6.3 12 log of van der Waals damping constant/neutral hydrogen number, Gamma van der Waals F6.2 or F6.3 13 reference that can be expanded in subdirectory LINES A4 14 non-LTE level index for first level I2 15 non-LTE level index for second level I2 16 isotope number I3 17 hyperfine component log fractional strength F6.3 18 isotope number (for diatomics there are two and no hyperfine) I3 19 log isotopic abundance fraction F6.3 20 hyperfine shift for first level in mK to be added to E I5 21 hyperfine shift for second level in mK to be added to E' I5 the symbol "F" for legibilty 1X 22 hyperfine F for the first level I1 23 note on character of hyperfine data for first level: z none, ? guessed A1 the symbol "-" for legibility 1X 24 hyperfine F' for the second level I1 25 note on character of hyperfine data for second level: z none, ? guessed A1 26 1-digit code, sometimes for line strength classes I1 27 3-character code such as AUT for autoionizing A3 28 lande g for first level times 1000 I5 29 lande g for second level times 1000 I5 30 isotope shift of wavelength in mA FORMAT(F11.4,F7.3,F6.2,F12.3,F5.2,1X,A10,F12.3,F5.2,1X,A10, 3F6.2,A4,2I2,I3,F6.3,I3,F6.3,2I5,1X,A1,A1,1X,A1,A1,i1,A3.2I5,I6) */ int pack_data(FILE* msg); /*----------------------------------------------------------------------------*/ /* Format of binary file "gfall.pbin" produced by the pack_data() function. */ typedef struct /* Same structure for both energy levels. */ { long double E; /* in cm^-1 (12 bytes?) */ float J; /* J (4 bytes?) */ char LABEL[12]; /* 10 chars + NULL-char (12 bytes?) */ } energyLevel; typedef struct /* Gamma_r,s,w and some other things not yet stored. */ { double WLVAC; /* in nm (air above 200). (8 bytes?) */ double LOGGF; /* log of gf. (8 bytes?) */ energyLevel LOW; /* see above (28 bytes?) */ energyLevel UPP; /* see above (28 bytes?) */ unsigned short ELEM; /* element + charge/100. (2 bytes?) */ char REF[6]; /* reference code (6 bytes?) */ } pieterPacked; /* 80 TOTAL? */ /*----------------------------------------------------------------------------*/ /* Call with to = stdout for console; a logfile or NULL. */ void printLineEssential(pieterPacked* line, FILE* to); /*----------------------------------------------------------------------------*/ /* To derive some more data out of the line-data read from the binary database. Thanks to Peter L. Smith, Claas Heise, Jim R. Esmond and Robert L. Kurucz. */ typedef struct /* Some more scientific data derived from the read-in structure. */ { double wlVacCorrected; /* [nm] Calculated (and slightly different */ double wlAirCorrected; /* [nm] from) WLVAC in gfall.pbin.h". */ long double waveNumbers; /* [cm^-1] Difference between energy levels. */ /* double photonEnergy; // [eV] Calculated from waveNumbers. */ long double frequency; /* [s^-1] Calculated from waveNumbers instead */ /* of from photonEnergy. */ double Avalue; /* [s^-1] Calculated from LOGGF and others. */ } derivedData; void moreLineData(pieterPacked* essential, derivedData* derived); /*----------------------------------------------------------------------------*/ /* Call with to = stdout for console; gLOGFILE for file. */ void printLineDerived(derivedData* line, FILE* to);