PEST 5.0 - SIMEPR - Isotropic Simulation program



This program is intended for simple EPR simulations of isotropic EPR spectra.  
It will simulate either the CW or FT spectrum in the zeroth, first, or second 
harmonics and will optimize the values to match the simulated spectrum to an 
imported experimental spectrum.  Up to 10 species may be included in each 
simulation with varying concentrations and in each species up to 16 nuclear 
spin sites.

5.0.1	The data screen

These features are all the same as in the Ftepr.exe program.

5.0.2	Function keys

No function keys are active in this program.

5.0.3	Calculations

All calculations are first order isotropic for X-band configuration.  Therefore, 
the exact frequency and field position values are not important.  The field 
position is set by the g-shift parameter by specifying the distance in Gauss from 
center of the scan.  A simulation centered in the display has a zero g-shift.  A 
simulation sited 10 Gauss to the right of center has a positive 10G g-shift while 
one sited 10 Gauss to the left of center has a negative 10G g-shift

A Nitroxide option has been added that will compute a spectrum with quantum 
number dependent linewidths.  If you select this option, for each species you 
must enter a Nitroxide coupling and separate linewidths for each of the three 
spin 1 lines.  

This program also includes calculations of the modulation amplitude and time 
constant, which affect the measured linewidth.  More accurate linewidth and 
lineshape calculations should be possible by using this feature.  Note that the 
spectrum file modulation amplitude and time constant values are neither 
converted to nor from the simulation mod. amp and time constant values.  The 
two sets of values are independent.  The spectral file values displayed are text 
representations and may contain non-numeric characters while the simulation 
values are numeric.  Check the spectral file parameters with the Parameters 
option and edit the simulation parameters with the Edit_scan option.

Spectral simulations are generated by calculating Fourier coefficients.  If a CW 
(continuous wave) simulation is specified, then an inverse FFT is executed.  
Obviously, an FT simulation is faster than a CW simulation since no inverse 
FFT is needed.   However, one cannot look at even a simple FT spectrum and 
easily guess the spin and coupling constant values.   An FT spectrum must 
include both the Real and Imaginary components; however, because of the 
Nyquist frequency relationship, the total number of data points remains 
constant.  For EPR spectra of relatively few lines such as spin trap data, FT 
simulations are usually more difficult to examine.  For EPR spectra of 
numerous lines such as large molecule direct data,  FT simulations are usually 
less difficult to examine.  

This is our first program to allow you to optimize in either FT or CW space.  
FT simulations and optimizations are obviously much faster than CW 
optimizations.  The CW optimization seems to be equivalent to if not better 
than the single and composite Tune.exe routines on our HP computer  The FT 
optimization appears to allow a greater range of parameter adjustment.

This program to works equivalently for both single and multiple species 
simulations.  No additional work is required to optimize multiple species 
parameters.

5.0.4	Parameter storage

The simulation parameters for all 10 species are stored in a single file, 
\lab\eprdata\simdata.sdf , after each simulation and are recalled when the 
program is started; the file is binary and cannot be edited or printed.   If your 
simulation program is suddenly unusable then maybe your should delete this 
file and start over.  You may also save simulation parameters into individual 
files and recall them later, all from the Edit_Species menu..  These files all 
have the .sdf extension and are found in the \lab\eprdata directory.  This file 
format is subject to change so it should not be relied upon for long term storage 
of parameters.

5.1.0	The Simepr.exe menu

The main menu has the following choices:

Import		Load a data file.
Export		Write a data file.
Parameters	Display the current spectral parameters.
Edit_scan	Edit the current scan simulation parameters.
Edit_species	Edit the current species simulation parameters.
Calculate	Calculates the EPR simulation.
Display		Switches the display between Real & Imaginary and 
		Exp. & 	Simulation.
Zoom		Zoom the display to either all Real or all Imaginary.
X-Y-scale	Change the X and Y display scale parameters.
Residual	Subtracts the simulation from the experimental and 
		displays the result
Compare		Shows the current Sum of Squared Residuals and Correlation 
		Constant values.
Write		Outputs a formatted file of EPR simulation data.
Tune_prep	Write text files of sim. parameters and exp. data for 
		input to the Tune program.
Optimize	Performs an optimization of the sim. parameters to match 
		exp. data.
Exit		Exits this program.

Each function is described in more detail below.

Import
Loads an exported data file.  Enter the clipboard page number ( 1-99 ) to load 
experimental data into the Simepr.exe program.  The import is loaded into the 
experimental data space.

Export
Saves data to a file.  You will be prompted for R or I if the display is Real and 
Imaginary, or prompted with E or S if the display is Experimental and 
Simulation.  After that, you will be prompted for the clipboard page number ( 
1-99 ).  

Parameters
Displays the current spectral parameters on screen.  These parameters are 
imported with the experimental spectrum.

Edit Scan
Enables editing of the simulation scan parameters:  These values default to the 
values of the Imported spectrum, if any.  

Field Center	The field center in Gauss, this value has no 
		effect on the simulation.
Scan Range	The scan range in Gauss.
Data points	The number of points calculated { 128, 256, 
		512, 1024, 2048, 4096 }
Harmonic	0, 1 or 2.  The spectral derivative of the 
		absorption spectrum.
Number..	Number of spectral species per simulation, 
		1 - 10.

CW(0) or FT(1) simulation	0= Continuous Wave simulation, 
				1= Fourier Transform simulation

FT combined data frequency	For FT simulations only, this is the 
		frequency (data point) value at which the Imaginary and Real 
		components were combined.  It must be less than or equal to 
		half the number of data points.  If the value is zero, the 
		Real and Imaginary data will remain separate.  The combined 
		experimental spectrum is created in the FFT.EXE program.  This 
		number must match for the experimental and simulated spectra.  
		This parameter is not used for CW simulations.

Modulation amplitude		Enter the experimentally used mod amp in 
		Gauss.  If zero is entered then the mod. amp will not be 
		used in the simulation.
TC= 1000*time_con/scan_time 	Enter the time constant to scan time ratio 
		in  ms/s.  For example, a 0.4s time constant and a 240s scan 
		produces a ratio of 400/240  = 1.67.  If zero is entered then 
		the time constant will not be used in the simulation.

Sim type 	(0=simple, 1= nitrox.)	Enter 0 for a simulation with a single 
		linewidth for each species, enter 1 for a simulation with Nitroxide 
		quantum dependent linewidths.

Edit Species	Enables editing of the spectral parameters for each species:   
		The current simulation parameters for a single species are 
		printed on screen.  Several options are available...

[Enter], E, e 	Edit the current species.  Once editing is started, use the 
		arrow keys to move among the parameters and enter new values.
[Esc], X, x,
[Backspace]	Exit the edit species session.
S, s		Save a file of species data
L, l		Load a file of species data
		You will be prompted to enter a 1 to 8 character filename, 
		the .sdf extension will be added.  The file is saved to and 
		loaded from the \lab\eprdata directory.  This allows you to 
		save and recall a set of simulation data.
[PageUp], 
[PageDn] ,
[Arrow keys]	Change the current species.  New parameters will be 
		displayed if number of species > 1.

Now, to enter the simulation parameters for an individual species:

Linewidth	Value of the constant spectral linewidth in Gauss.
Lineshape	Value of Lorentzian content of line.  100%= Lorentzian line, 
		0% = Gaussian..
Relative area.	The relative spectral concentrations used for multiple species 
		simulation.
G-shift 	The distance (in Gauss units) of a species from the center of 
		the display, positive or negative.  Centered position equals 
		zero g-shift.

Number...	...of sets.  Enter the number of distinct spin-coupling sets.  

For example:
	Set	Coupling(G)		Spin		Number
	1	13.24			0.5		1
	2	1.25			0.5		3
	corresponds to (set one) one nuclei of spin 1/2 with a 13.24 G coupling  
	and (set two) three nuclei of spin 1 each with 1.25 G coupling

If you selected a Nitroxide simulation, you have 4 more parameters to enter:

	Coupling:  		LW(-1):		LW(0):		LW(+1):
Nitrox	14.5			.46		.49		.56

A Nitroxide simulation does not use the constant Linewidth parameter since it 
has three linewidth parameters of its own.  To include a non-Nitroxide species 
in an otherwise Nitroxide type calculation, enter 0.0 for that species' Nitroxide 
coupling and enter the constant linewidth for each of the three linewidths.  

Calculate
Calculates the simulation.  After the calculation, the display will be Real and 
Imaginary data.  A CW simulation always shows up as Real data with no 
intensity in the Imaginary data.    An FT calculation with combined Imaginary 
and Real data will show up in the Imaginary display.  The imported 
experimental display will not be shown immediately after the simulation until a 
compare is executed.

Display
Switches the display from Real and Imaginary data to Experimental and 
Simulation data and back again.

X-Y-scale
Use the arrow keys to change the X and Y display scale parameters.   Press 
ESC or Backspace to return to the menu.

Zoom
To show either the upper or lower display full screen.  If the Real and 
Imaginary data are displayed, you will be prompted for R, I, or [ESC].  If the 
Experimental and Simulation data are displayed, the display will overlay the 
two spectra in different colors.

Residual
Subtracts the simulation data from the experimental data and displays the 
results.

Compare
Calculate and display the Sum of Squared Residuals and the Spearman's Rank 
Correlation Constant between the current simulation and experimental spectral 
data.

Write
This option will output the current experimental filename and simulation 
parameters to a formatted text file suitable for printing named 
\lab\eprdata\simdata.epr.  Use the DOS command "type filename" or "more < 
filename" to print the contents of the file to the screen.  In MS-Windows, use 
the Reporter program to view and print the contents of the file.

Tune_prep
This option prepares data for input to the Tune.exe and Tunex.exe programs.  
The tune programs are character mode versions of the Optimization routine and 
are available for many different computers.  Follow the same process as you 
would with Optimize.  You will then be prompted twice for data:

1.	Choose the experimental file type to create.  Enter B for Binary or 
	A for ASCII spectrum data files.  Choose Binary for the PC versions 
	of tune and ASCII for non-PC versions of the tune program.  
2.	Enter a filename prefix (1-8 characters) for the tune input files.

Two files will then be created for input to the Tune program for fitting the 
experiment to the simulation.  

\lab\eprdata\name.tun	Tune input file with simulation and optimization 
			parameters, ASCII text file.
\lab\eprdata\name.exp	Experimental spectrum file, Binary or ASCII text.

Optimize
This feature will attempt to fit the simulation parameters to produce a 
simulation that best matches the experimental spectrum.   An entire manual 
section follows and is dedicated to Optimizations.  Follow this general 
procedure:

1.	Import the experimental data file
2.	Enter your simulation parameters
3.	Calculate a simulation
4.	Compare the simulation with the experimental.  If it is 'good enough' 
	( a subjective analysis ), then proceed.
5.	Choose Optimize from the menu and enter the optimization options.
6.	The optimization will begin.  Press F10 to stop the process.

5.2.0	Optimizations

This program uses an algorithm developed here at LMB to fit the simulation 
to the experiment.  The experimental spectrum must first be imported into 
the Simepr.exe program.  The routine loops over the parameters generating 
perturbations, simulations, and error calculations until no successive 
better simulations are found.  The current best simulation is displayed 
on screen with the experimental.  The iteration then stops and the final 
simulation is displayed.  Simulations are compared to the experiment by 
a Sum of Squared Residuals : SSR= S ( Expi - Simi )2 , i=1 .. n. 

A short series of inputs is necessary to begin the optimization.

Optimization inputs
The following inputs are necessary to start a simulation Optimization.  The 
default values are usually acceptable, permitting a large search space across the 
entire spectral range.

LMB1 fit parameters:
Conventional Hyperfine Analysis ?		[ Y / N ]	Y
perform a conventional hyperfine analysis by varying each coupling constant 
individually.  This is the usual way of fitting data.

Parametric Hyperfine Analysis ?			[ Y / N ]	Y
perform a parametric hyperfine analysis by varying all possible pairs of 
coupling constants with a constant sum.  That is, if a spin 1 hyperfine is 
perturbed by +1.0, then a spin 1/2 hyperfine is perturbed by -2.0 so that the 
total spectral length remains unchanged.  This option is significantly more time 
consuming and tedious.  This is a more exotic way of fitting data and should be 
tried when the Conventional Hyperfine Analysis is unsuccessful.

Step type: 					[ 0, 1, 2 ]  0
The optimization refines the parameter values by decreasing the perturbation 
size between levels
	0= binary, perturbation =  	(2^i)*0.5*resolution
	1= quadratic, perturbation=	(i^2) *2*resolution
	2= linear, perturbation=	i*2*resolution
where i is the step (level) number and resolution= ( scan_range / data_points),  
the accuracy of the experiment.  For the non field parameters, the resolution of 
lineshape and relative intensity is defined as 1.0.  The binary (0) method should 
be used.  If it is unsuccessful, you may at your own risk try the other methods.

Number of Levels				n
This value controls the starting perturbation size and the time of the 
optimization.  For binary steps, the max. value is 7; for quadratic and linear 
steps the max. value is 256.  The program will decrement the level number 
from this value to one in in units of one.   With binary steps, a value of 7 
permits quite large initial perturbations; if the simulation is already close to 
acceptable, you should use a smaller value such as 3 to save time and eliminate 
very wrong answers,

SIMPLEX fit parameters:
Number of restarts				[ 1 - 10 ] 
The number of times to restart the simplex algorithm after an apparent error 
surface minimum has been found.

Iterations/restart				[ i < 5000 ]
The maximum number of algorithm iterations permitted within a single restart.  
This parameter prevents infinite wandering.

Fractional tolerance				[ 0.0 - 1.0 ]
(ftol)  This parameter defines the criteria for ending the algorithm, when the 
difference between the n (=Number of parameters+1) error values satisfies: ( 
max. - min. ) / (max. + min. ) < ftol.  A typical value is 0.1.

Common fit parameters:
Select Parameters to Optimize ?			[ Y / N ]	Y
allow the user to select whether or not each individual parameter is to be varied 
or kept constant.  If so, then after this input screen will follow an edit session 
for flagging each parameter as vary or keep constant.

CW fit range :		from   _____	to    _____.
With a CW simulation, you may choose to fit only a sub-region of the magnetic 
field, thus excluding unwanted features of the spectrum.   Enter the starting and 
ending data point values of the region needed. 


Selecting Parameters to Optimize
If you have chosen to "select parameters to optimize", then you will now be 
prompted with an edit session for flagging each parameter as vary or keep 
constant.  The edit session is analogous to the Edit_Species session except that 
you must enter not the parameter value but rather a Y or N for each parameter; 
Y= vary the value, N= keep the value constant.

Final input
After you have competed the Optimization inputs, a test simulation is 
calculated and compared to the experimental by calculating the Sum of Squared 
Residuals, SSR.  You will the be prompted with something like this:

Trial SSR= 1.543E+6, Continue the optimization ?			
	Enter Y or N > ____.

Enter Y to continue the process, N to return to the Simepr.exe menu.  


Observing the process
The Optimization proceeds by decrementing the level when no further 
perturbations produce a simulation with a lower SSR.  Each simulation is 
matched to the experimental in overall intensity before the SSR calculation.  
The screen display will update the simulation data once a species is completed 
within each step.  A panel on the left of the screen will continuously show the 
starting SSR, the current SSR, the total number of simulations calculated, the 
current Level, the current Species number, and the current Parameter number.  

Optimization output
Once finished, the program will display the final simulated spectrum and 
prompt the user with a completion message.  This message will include the run 
time and the Spearman's rank correlation coefficient (r).  Also, a file will be 
output as \lab\eprdata\simdata.epr which will include the experimental 
filename, the job time and rate, r, and the final simulation parameters.  This 
file may be viewed and printed using the Reporter.exe program for Windows or 
with the DOS command more < \lab\eprdata\simdata.epr . In addition, the final 
values may be viewed within the simepr.exe program by selecting the 
edit_species option.


5.3.0	The Tune program for simulation optimizations

Tune is character mode version of the optimization program.
This program havs been compiled and executed on IBM/AT, DEC VAX, and 
on UNIX machines using the standard cc compiler.  Tune.exe allows execution 
of an optimization to work in the background in a multitasking environment 
and can easily be ported to faster computers.  

 More Tune Information 


Translation to HTML in progress. DRD. Jan 1996.