Recent changes to Dedx ====================== Range calculation rewritten --------------------------- The range integration code has been completely rewritten. The new code is much more precise (by precise I mean that the errors inherent in the integration are much reduced, systematic errors in the calculation of de/dx are not affected). Energy loss calculations built in --------------------------------- Dedx can now calculate the energy loss through a fixed distance of material. Calculate de/dx and the range as normal. Then select option E and enter the thickness of the material. A new table will be output giving the energy before passage through the medium, the energy after and the energy loss. Automatic fit to energy loss calcuation available ------------------------------------------------- Dedx can also output FORTRAN or C code to calculate the energy loss for ions of arbitrary energy in the range over which the energy loss calculations have been performed. It breaks the energy loss curve it's just calculated into sections and fits each section with a linear, quadratic, cubic or quartic polynomial. The code automatically selects the right polynomial depending on the energy of the ion. Fits to the energy before entry or after exit of the medium are available. The routines expect the energy to be passed as a double precision number and return a double precision value of de. Compilation of energy loss code: Suppose you got dedx to output code to calculate the energy loss through 3.5 um of mylar. If you were ising it in a sort code you would fit to the energy after passage through the medium. If you put the FORTRAN code into mylar.f you would compile it with f77 -O4 -c mylar.f This would produce an object file called mylar.o. If the function was called mylar, you would declare it with: double precision mylar And if e was declared as double precision, one of the following lines may be what's needed. de=mylar(e) e=e+mylar(e) e=e+mylar(e)/cos(theta) For the C routines, the compilation line is: cc -xO4 -c mylar.c the declaration is: double mylar(double); and the calls may be: de = mylar(e); e += mylar(e); e += mylar(e)/cos(theta); To linke the code with a stand alone FORTRAN or C program just add mylar.o to the end of the command line: f77 -O4 myprog.f mylar.o cc -O4 myprog.c mylar.o To link with a Sunsort sort code, use: makesort mysort-f.srt mylar.o makesort mysort-c.srt -xC mylar.o Or alternatively, if the source code is placed in a sub-directory called calib-inputs below where your sort code is stored, then once you have compiled the routine, Sunsort will automatically link it in. All files ending in .o in the calib-inputs directory are automatically linked in to all sort codes compiled in the directory above. You can have as many dedx objects in a program as you like provided they all have unique names, just list all the .o files on the compilation command line. Non-standard compounds may be entered with a chemical formula ------------------------------------------------------------- If the chemical compound you want is not a standard, then instead of entering OT (other type) to get the old style of entering chemicals, you may enter FO (formula) to allow you to enter a chemical formula. In most cases, chemical formulae can be entered in the obvious way. A chemical may be repeated several times in the formula, and brackets may be placed round parts of the formula to allow scaling of the number of elements in that part. For example, all the following are acceptable ways of specifying the chemical ethanol: C2H6O C2H6O1 C2H5OH CH3CH2OH (CH3)2O Note that case is significant in these formulae so there are big differences between the following three formulae: CsI caesium iodide CSI a compound of carbon, sulphur and iodine CSi a compound of carbon and silicon By default the masses used will be natural isotopic ratios, if you want a particular isotope prefix the element with the isotope number. If this would be ambiguous, as it will be in most cases, use a space or comma to separate it from the previous element. So heavy water may be written as: 2H2O O 2H2 O,2H2 but not as: O2H2 which is hydrogen peroxide. Commonly used compounds stored in exernal database -------------------------------------------------- Commonly used compounds may now be stored in an external database. This means that it is easy to add, remove and change these compounds without recompiling the whole program. The program searches in 3 places for compounds and merges the results from all 3: firstly, it searches an system wide database, this is placed in a position determine in the Makefile; secondly, it searches the file .dedxrc in the users home directory; and thirdly, it searches the file compounds.dat in the current directory. The system wide file may be altered at site, though changes made there should be sent back to the maintainer of dedx to ensure that they get into the next version. Suggestions for new compounds may also be sent round by e-mail to other sites, or placed on the Daresbury FTP site. Users can put their own compounds in the 2 files they have access to to save typing. The files have the following format: An arbitrary number of lines starting with #. These can contain comments for the files. There then follows the list of compounds in the following format: 2 letter abbreviation Zero or more lines of comments to be displayed after the material is selected, each prefixed with a *. Full name Chemical formula Density (0 means ask the user) Flag which is true (T) if the compound is gaseous otherwise false (F) Note that the 2 letter abbreviations should be unique and should also not clash with element names. The comment lines starting with * are optional and may be used to give information about that compound to the user. The chemical formula is in the format described above. If a density is specified as 0 that means that the user is prompted for the density. In this case, the comments should probably be used to give the user a clue as to suitable values (see the data for polythene in the standard database). The gaseous flag must be the single letter T if the compound is gaseous, or F if it isn't. Interface to sunsort -------------------- Dedx can now interface to sunsort to provide on-the-fly calculation of energy losses.