#!/bin/sh

#MAKE CHANGES - lines beginning so indicate where parameter values 
#	can be changed

if [ $# -eq 0 ] 
then
	root="scr"
else
	root="$1"
fi

# create root.m file
cat <<EOF | grep -v "^#" >${root}.m
#rate constant		reactants -> products
#MAKE CHANGES - in the rate constants and mechanism
1.	e1 -> p
.1	e2 -> p
0.	e1 -> e2
0.	e2 -> e1
EOF

# create root.p file
cat <<EOF | grep -v "^#" >${root}.p
#iopt
1
#itol	istate	jt	itask
4	1	2	1
#ml	mu	ixpr	mxstep	mxhnil	mxordn	mxords
#iwork1	iwork2	iwork5	iwork6	iwork7	iwork8	iwork9
0	0	0	500	0	0	0
#tcrit	h0	hmax	hmin
#rwork1	rwork5	rwork6	rwork7
0.	0.	0.	0.
#start_time  end_time  {time_step|0}  deflt_tolerance  [first_time  time_factor]
#MAKE CHANGES - in the time range and time step or time factor
#	be careful; note that the format is different for time step vs factor
#model for time step incrementation
#0.0	0.0001	.000003	1.0e-10
#model for time factor incrementation
#0	1.0e6	0	1.0e-10	1.e-9	1.2589254117
0	1.0e6	0	1.0e-10	1.e-9	1.2589254117
#species	initial concn		absol. tolerance	relat. tolerance
#MAKE CHANGES - in the initial concentrations
e1	1.	1.e-15	1.e-10
e2	1.	1.e-15	1.e-10
EOF
#p	0	1.e-15	1.e-10

#run it 
react ${root} >${root}.r 

#and graph it
cat ${root}.r | prep | ttygraph
