#!/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.e8	E + S -> ES
1.e2	ES -> E + S
1.e0	ES -> E + P
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
E	1.e-4	1.e-15	1.e-10
S	1.e-4	1.e-15	1.e-10
ES	0	1.e-15	1.e-10
P	0	1.e-15	1.e-10
EOF

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

#and graph it
cat ${root}.r | prep | ttygraph
#mk_xfiles filename=${root} ${root}.r
#xgobi ${root} &
