Although it would not be difficult to incorporate the sorting of 2-dimensional frequency distributions in the flux program itself, I think for the utmost in versatility it is preferable to do it outside flux.

The problem lends itself very well to the Unix concept of pipes where one program feeds its output to the next, without the need of an intermediate disk file.

The philosophy is as follows: flux outputs a complete set of values for every ion history. Then a second program selects 2 parameters from this, and a third program builds up a frequency distribution from these parameter value pairs.

In flux, as a logical extension, I made an option to obtain the start coordinates of a track. If this option, STARTCOORD, as well as the old EXITCOORD are selected. every ion history is characterized by 10 parameters, to wit: the initial coordinates, direction and energy x0,y0,px0,py0,T0, and, the final values of these parameters x,y,px,py,T.

Two small programs are supplied, to be used as filters.

Program "coordfilter" extracts 2 parameters from the available 10, and "fxyfilter" makes a frequency distribution from these. These 2 programs are in Fortran, and they seem to do their job. If you or one of your students come up with alternatives written in some scripting language, like "awk" or "perl", I would be very interested.

In addition I made a small script called "fluxgo" to launch flux in the manner described. Depending on the commandline arguments this produces either the full flux output, or 2 selected columns, or the 2-dimensional frequency distribution.

I suggest that for exploratory work with a limited number of ion histories, say 10000, one uses one of the first two options and stores an intermediate file of parameter values. For large numbers of ion histories the last option is appropiate. For 100000 ion histories followed over 3000 angstoms the whole process takes 70 minutes on a 233MHz Pentium running Linux, and the disk space needed for a 50 by 120 array of py versus y0 is less then 20 kbytes, without compression.

The output is suitable for feeding to plotxy (option ascii), and probably for other software.

Please experiment with this and let me know how you like it.

See also plotxy which has options COORD and XCOORD that may be used to produce an f(x,y) distribution from a flux7 output (log)file.


This programs filters 2 parameters from the output of program flux7, used with the keyword options STARTCOORD and/or EXITCOORD. Specify which 2 coordinates to filter, either as commandline arguments or by means of a 2-line file called coord.sel. The specifications are character strings from the set 'x','y','px','py','T','x0','y0','px0','py0','T0'


coordfilter py T < si211p5.log > si211p5.coord


This program takes as input pairs of data (x, y) From these it builds up a frequency distribution f(x,y) in an NX x NY array, and outputs this array. The bin widths and the x,y values for each bin are further specified by XMIN, XMAX, YMIN, YMAX, see subroutine buildxy. The values for NX, NY, XMIN, XMAX, YMIN, YMAX are specified, either as commandline arguments, or, by a 6-line file of the name 'fxy.sel'.


a shell script to launch flux7 in combination with the programs coordfilter, or coordfilter and fxyfilter. Optionally one may specify a flux7 version by specifying the option -p 'prog' on the command line, where 'prog' may be one of fluxzbl, fluxhf, or fluxmol. Apart from this option, exactly 1, 3, or 9 arguments required

n=1: fluxgo [ -p 'prog' ] 'basename'

where file 'basename'.inp is a regular flux7 input file

n=3: fluxgo [ -p 'prog' ] 'basename' 'xname' 'yname'

to filter out two coordinates.

n=9: fluxgo [ -p 'prog' ] 'basename' 'xname' 'yname' nx ny xmin xmax ymin ymax

to sort those coordinates as a distribution f(x,y)


  fluxgo -p fluxhf fluxtest0 py y0 50 120 -0.005 0.005 -1 5

file fluxtest0.inp may be found in directory TEST