How to run SPECTRUM on your computer

This part is divided into three sections:

A. Basic Information

B. SPECTRUM switches

C. Notes on running SPECTRUM

A. Basic Information

SPECTRUM is a stellar spectral synthesis program which has been ported to a number of platforms including UNIX and Linux.

In the case of UNIX and Linux machines (and the Cygwin environment under Windows), the source code of SPECTRUM must be downloaded and compiled.  From the ftp site, download the file spectrumXXX.tar.gz, where XXX is the current version number.  Use the gunzip utility to unzip this file,

gunzip spectrumXXX.tar.gz

and then extract the source code from the tar file using the command

tar -xf spectrumXXX.tar

You will find in the directory four makefiles - makefile.dec, makefile.gcc, makefile.sun and makefile.cyg.  If your machine has the GNU gcc compiler, compile SPECTRUM using the command

make -f  makefile.gcc

If your machine only has a native compiler, and not GNU gcc, then for DEC Alpha machines you may use makefile.dec, and on Sun/Solaris you may use makefile.sun.  In all three cases, the executable file will be named "spectrum".  If you are compiling SPECTRUM under the Cygwin environment under Windows, use makefile.cyg.  If you use makefile.gcc, you will get an error.  I have heard that users with Silicon Graphics machines can use the Sun/Solaris makefile.

One you get the executable for SPECTRUM, it should be moved to a location such as /usr/local/bin or /usr/bin, or some other equivalent location on your path.
You will probably need to be "root" in order to do this.  Then you can access the program simply by typing "spectrum" at the prompt.  It is necessary to do this in order to use the TCL graphics interface for SPECTRUM.  To run SPECTRUM, you will also need to ensure that the file stdatom.dat is in your working directory.

SPECTRUM comes with a number of  auxiliary programs  which are used to smooth the output spectrum, rotationally broaden it, etc.  These programs must be compiled separately from SPECTRUM, and each comes with its own makefile.  Again, for each program there are four flavors of makefile.  These executables as well should be moved to /usr/local/bin or some equivalent location.

SPECTRUM uses the fully blanketed Kurucz stellar atmosphere models (a sampling of Kurucz's models  - for the sun and vega - sun.mod and vega.mod) are included in the distribution.  More extensive sets of Kurucz's models should be obtained from Kurucz himself, or calculated using his ATLAS9 program.  These models are distributed on CDROM.  You can also find Kurucz stellar atmosphere models on the web; a good source is Kurucz's website.  Traditionally, these models have been edited to remove the   extensive headers in these files (see the sample files sun.mod and vega.mod in the distribution).  The default header used by SPECTRUM is a single line, with the effective temperature, log(g), [M/H] and number of depths, as follows for the included model for vega, vega.mod

9400.0 3.90 -0.50 64

However, SPECTRUM can now use models with the original Kurucz header.  To do this, you must use the "t" switch (see notes on switches in part B below).

Note that SPECTRUM can actually handle models with up to 100 layers.  Please note that the model atmospheres in the Kurucz CD distributions were computed using a convective overshoot algorithm which is now known to be faulty.  New models with convective overshoot turned off can now be found on the web (see the above link).  If you are working with synthetic spectra with effective temperatures between 5500 - 7500K, it is best to use these models with overshoot turned off, or with a modified version of convective overshoot.

SPECTRUM comes with two auxiliary data files, luke.lst, which is a spectral line list (with energy levels,  oscillator strengths and empirical damping constants) for the interval 3000A to 6800A, and atom.dat, which includes data for the atoms and molecules presently supported by SPECTRUM.  See part III of this documentation for more detailed information on luke.lst and atom.dat.

To run SPECTRUM, carry out the instructions above to build the program.  As noted above, once you have successfully compiled SPECTRUM, copy the executable file for SPECTRUM (this file will be called "spectrum" with no extensions) to a directory in your path.  I usually place it in /usr/local/bin.   Once you have the executable program in your path, make certain that stdatom.dat is in your working directory.  Then, type "spectrum" at the  prompt, and the program will prompt you for the following information:

Enter name of stellar atmosphere data file >
Here you should enter the path plus name of the atmosphere model. Examples included in the distribution: sun.mod and vega.mod .

Enter name of line list file: Default = line.adj >   luke.lst
If you have compiled your own list (it must be in the same format as luke.lst - see technical details), simply enter its name with the full path here.

Enter name of output file >
Enter here the path plus name of your desired output file, which will contain the computed synthetic spectrum. For details of the format of this output file, see technical details.

Enter microturbulence (km/s) >

You should enter here the microturbulent velocity for which the stellar atmosphere model was calculated, or at least some value close to it.  Typical values for the microturbulent velocity for the distributed Kurucz models are 0, 1, 2, 4 and 8 km/s.  See technical details.

Enter beginning and ending wavelengths >
The beginning and ending wavelengths of the desired synthetic spectrum should be entered here in Angstroms. The file luke.lst covers the interval 3000.0 to 6800.0 Angstroms. Example: 3800.0,4600.0

Enter wavelength step >

SPECTRUM steps through the calculation of the synthetic spectrum at an interval given by the wavelength step. To reproduce the profiles of the lines accurately, this step size should be no larger than 0.02 Angstroms. For accurate reproduction of a high dispersion, high resolution spectrum, such as the Procyon atlas or the solar flux atlas, I recommend an interval of 0.01 or even 0.005A. If you are only going to use the synthetic spectrum to produce smoothed, low resolution (2 Angstrom resolution or lower) spectra, then you can get away with an interval of 0.05 Angstrom, and the line strengths in the smoothed spectrum will be hardly affected.

Once you have responded in a sensible way to all of the above prompts, SPECTRUM will begin its calculations, and you simply have to sit back and relax. SPECTRUM will first do some preliminary calculations - i.e. it first computes the partition functions (from polynomial approximations) for all species at all 64 levels and stores them in memory. It then solves the ionization balance equations (including the formation and dissociation of the relevant diatomic molecules) at all levels, and stores those numbers. It then calculates the reference opacities, and then finally begins stepping through the spectrum. As SPECTRUM steps through the spectrum it prints to the screen the current wavelength, plus two other numbers which refer to the number of spectral lines that it is actively computing at that wavelength. Of course, the actual spectrum is stored in the output file. This output file may be smoothed to any desired resolution with certain programs provided on the ftp site (see below).  You can turn off most of the screen output from SPECTRUM by using a switch (see below).

B. SPECTRUM Switches

The mode of operation of SPECTRUM can be changed with the use of "command-line switches". The default mode of SPECTRUM, which is invoked by simply typing "spectrum" at the prompt gives, as output, the disk-integrated normalized-intensity spectrum. The output file is an ASCII file with two columns. The first column is the wavelength in Angstroms, and the second column is the normalized intensity. This default behavior can be changed by the addition of switches:

Switch  b : Typing "spectrum b" at the prompt will cause SPECTRUM to output the synthetic spectrum in binary format. The advantage of this is that the output file will be much smaller (by a factor of about 5) than the default ASCII output file. You can access this file by using the program BSMOOTH2 included on the distribution disk. See Part IV of this documentation for more details.  Note: this option will give an unreadable file with the Windows binaries.  It is really suitable only for UNIX or Linux.  Once the binary file has been produced, its permissions must be changed using chmod to make it readable by BSMOOTH2 or BFLXSM2.  You can use the statement:

chmod a+rw xxxx.xxx       where xxxx.xxx is the name of the output binary file.

Switch  n : In the default mode, SPECTRUM prints to the screen certain information, such as the current wavelength and the number of spectral lines currently under computation. You may want to turn this screen output off. This can be accomplished by switch "n".  Using this switch enables SPECTRUM to run in the batch mode, and also increases the speed of SPECTRUM considerably.

Switch  f : This switch causes SPECTRUM to output the absolute flux instead of the disk integrated normalized intensity. See technical details.

Switch  m : Invokes the specific intensity mode. This allows you, for instance, to calculate the center-of-disk solar spectrum, or the emergent spectrum at any other point on the disk.   This switch causes SPECTRUM to output the normalized specific intensity (i.e. the continuum is normalized to 1.0).

Switch  M: Invokes the specific intensity mode.  This mode outputs the true specific intensity (i.e. it is not normalized!)

Switch  a : Prompts the user to supply the name of a custom atom.dat file. This is especially useful if the user is using a non-standard set of abundances.  Without this switch, SPECTRUM will read in the default file stdatom.dat.  This file must be in your working directory.

Switch  r: Will cause SPECTRUM to round the wavelength position of each line in the line-list file to the nearest computation point.  This switch causes a bit more accurate rendering of the line blanketing if you are using quite large wavelength steps (i.e. > 0.05A).  This switch is also recommended if you are calculating the absolute flux.

Switch  t: This switch will enable SPECTRUM to parse the full Kurucz header in the Kurucz stellar atmosphere models.  Note that SPECTRUM is now able to handle the new Castelli-Kurucz models which contain a number of additional columns.  This switch is active only for versions 2.63 and later.

Switch  P: Will cause SPECTRUM to produce a file, "density.out", with a list of number densities of important species at every level in the model atmosphere. Valid only for versions 2.65 and later.

Switch  i: Enables the isotope mode in SPECTRUM.  See technical details for more information on this mode.  Valid only for versions 2.65 and later.


All modes will prompt you for the same information, except the specific intensity modes will also ask you for a value of the parameter mu, which is defined as mu = cos(theta). For instance, for a center-of-disk spectrum, theta = 0, and thus mu = 1.   The isotope mode will prompt you for a file giving the relative abundances of the various supported isotopes.  An example file isotope.iso is provided in the distribution.  Switches can be combined in a logical way. For instance, if you want to make SPECTRUM place its output in a binary file, and you want it to compute the absolute flux, but you do not want any information (except for the initial prompts and a few initial messages) to be output to the screen, you may enter:

spectrum bfn

Notice that you should not have any spaces between the switches. But between "spectrum" and the switches there should be at least one space. That is to say "spectrumf" will give you an error message.   This way of designating switches is non-standard in UNIX, and comes from the fact that SPECTRUM was first written on a DOS machine.  This inconsistency will be corrected in the future (!).

C. Notes on running SPECTRUM

The time that SPECTRUM takes will depend on your machine and your math coprocessor. I used to run SPECTRUM on a 486 66Mhz Gateway machine. On that machine, SPECTRUM took about 15 minutes to compute 600A of spectrum between 3900 and 4500A with an interval of 0.02A. Years ago I ran SPECTRUM on a 386SX 16Mhz machine with a Cyrix math coprocessor (my former office machine). SPECTRUM required about 3 hrs on this machine to compute the same spectrum. Using  a very early version of SPECTRUM, my AT 286 10Mhz machine at home required about 9 hours!  My Pentium 4 desktop and laptop machines now run SPECTRUM at much higher speeds.  I now have a three-node Beowulf machine and have "parallelized" SPECTRUM in a rudimentary sort of way (if you want more information on this, email me), and of course it now runs like lightning.  Note, however, that the new line list file (luke.lst) has many more lines than earlier versions.  This means that SPECTRUM takes much longer than before to compute a spectrum, but the advantage is that the fluxes produced by SPECTRUM (starting with version 2.43) are now much more accurate, and agree quite well with fluxes from ATLAS9.  If you want to speed things up, you can strip out the weaker lines from luke.lst; this will hardly make any difference to the final appearance of the spectrum for temperatures greater than about 6500K.  However, this is not recommended.

SPECTRUM may be run under a batch file; I often set SPECTRUM running under batch control overnight and come back in the morning and collect a number of complete spectra. To do this, you must use what is called a "response" file. This response file is an ASCII file which contains the responses to all of the above prompted enquiries. For instance, if you want to run SPECTRUM using model vega.dat, with output to file vega.spc, from 3900 - 4500 A, a step size of 0.02, a microturbulence of 2.0, and no changes to the abundances, the response file would look like:

vega.dat
luke.lst
vega.spc
2.0
3900.0,4500.0
0.02
If this response file is spec1.rsp, and you have two other response files called spec2.rsp and spec3.rsp, then you can run the three models sequentially under batch control with the following batch file:
spectrum n < spec1.rsp
spectrum n < spec2.rsp
spectrum n < spec3.rsp
Set the batch file running, go for lunch, and then (if all goes well) you will have three spectra on your hard disk when you return.

Note: It is entirely possible to run multiple sessions of SPECTRUM at the same time.  Just make certain that the output files have different names!
 

D. Troubleshooting

There are very few problems related to running SPECTRUM on UNIX/Linux machines; most are due to the fact that people have forgotten to place the file atom.dat in the working directory (i.e. the directory in which you issue the command to execute SPECTRUM).

I have provided Windows binaries for SPECTRUM and a few auxiliary programs.  Some people have had problems with these programs because the output binary file from SPECTRUM does not have the correct permissions set.  Not being an expert in Windows, I have not been able to solve this problem.  The workaround is to output only ascii files from SPECTRUM.  The current binaries with this latest release (2.65) should be able to handle that situation.

Earlier versions of SPECTRUM had a few runtime problems on certain machines with certain compilers.  As far as I can tell, all of these bugs have been eliminated.  I have not noticed any runtime errors with the current version (2.65) after testing it extensively on a number of platforms.  If, however, you do encounter any problems, either in the compilation or during runtime, please contact me immediately.

Incidently, if you are interested in running SPECTRUM on a multiprocessor Beowulf type machine, please contact me.  I have developed a driver program which divides the spectrum up into N parts and pushes them over to the different nodes.

Contact me grayro@appstate.edu  if you have any problems.  I do not have much experience running SPECTRUM under the Cygwin environment under Windows, but it does seem to work well, but please remember, "Errors are guaranteed!"