From uucp Fri May 31 17:55 MST 1991
>From joplin.biosci.arizona.edu!rupley  Fri May 31 17:35:04 1991 remote from arizona
Received: from optima.cs.arizona.edu by univers.cs.arizona.edu; Fri, 31 May 91 17:35:04 MST
Received: from joplin.biosci.arizona.edu by optima.cs.arizona.edu (4.1/15)
	id AA08276; Fri, 31 May 91 17:35:01 MST
Date: Fri, 31 May 91 16:18:15 MST
From: arizona!joplin.biosci.arizona.edu!rupley
Message-Id: <9105312318.AA20917@joplin.biosci.arizona.edu>
Received: by joplin.biosci.arizona.edu; Fri, 31 May 91 16:18:15 MST
To: whitbeck@sanjuan.wrc.unr.edu
Subject: react revised code
Cc: rupley!local
Status: R

| can you mail me the diff files?

I am afraid I revised your code so it suited my taste, to an extent
that diffs would not be useful.  However, the whole package is small,
if the solver is left out, about 50k.  So a shar file will be sent in a
separate message following this one.  If you do not get it immediately,
please let me know.  It will mean that your mailer rejects mail larger
than some number smaller than ca 50k, and I will repackage in smaller
units.

| On my computer at home the float-double problem does not occur but I have learned that the ANSI std for C clearly offers no protection in this regard so I'll make those changes straight-away.

Hmmm... either your machine has sizeof(float) == sizeof(double), or
something else is strange in its C compiler. Note that the float
problem does not appear except in the form of too long execution times
(too many lsoda() steps), i.e., the code runs and gives reasonable
output, but slowly.  You might try timing code with float vs code with
double declarations.

| There is some reason to my madness-
| 
| The binary outputfile originates from the codes early history
| in combustion chemistry- hundreds of chemical species, sensitivity parameters... All eat up disk space. This time around I though I would conserve space by writing metafiles-
| also speeds up input to post-run codes. The idea of using post-run codes for graphics etc. is to facilitate others in writing smaller/simpler scripts without having to get into
| the meat of the basic solver. This will make it easier for me to maintain the solver while allowing "tools" to accumulate with the package.
| 
| Using specific files rather than stdout for output follows in the tradition of TeX- helps keep the code from being bound to unix and there are those who really want to port the code to non-unix platforms.

I don't want to get into religion here... but...

(Please take the following paragraphs as strictly friendly discussion
and not as critical comments or some sort of definitive last word.)

I have no problem with code design for portability.  However, _one_ of
the options for a program that does calculations should, IMHO, be
reading from std input and writing to std output, both in a
machine-independent format.  Ascii is as machine-independent as one can
get, at this time.  Binary files are _very_ machine and compiler
dependent.  They require an extra level of tools for interpretation.
They are loved by commercial houses, who want to lock users into their
software.  Space and speed are no longer problems, at least for < 1meg
files.  Etc, etc... enough on binary files.

Regarding files in general, the more you use, for either input or
output, the harder the code is to maintain and the harder the system is
to use.   Let the user decide if he wants multiple files, and let her
write or request the tools needed.

Of course tools are needed.  Indeed, the core program should do the
least possible and let tools do whatever a user needs/wants.  Keep input
and output simple.

| setfiles() is just another of my attemps to modularize the code- easier for updates/maintenance. The code is not static-

IMHO, it makes life harder.  Part of the file handling is logically
divorced from file use. As I remember, you call setfiles() in main(),
store the filenames in globals, and reference the globals well down the
line.  Wouldn't it be simpler to build the names where they are used?
The build is a one-liner, so no need for a function call.  If the
suffix strings need to be easily altered but maintained between
programs, use a header file containing only defines for the suffix
strings.  But, IMHO, the best approach is to remove the dependence on
specific filenames for io, and stick to stdin--stdout. Or use a single
input file and single output file, which can be set as stdin--stdout,
or whatever the user desires.

Probably the relevant maxims here (always IMHO, of course) are:
	give the user maximum flexibility by imposing minimal restrictions;
	minimize interdependence at code level of central program (here, 
		react) and the surrounding tools (extract, etc);
	within a program, minimize the use of globals -- keep stuff
		together that goes together;
	keep header files headers (no definitions of variables);
	use defines for all constants, if possible system defines;
	and KISS, naturally.

The following is a truly minor point, but not trivial if you want users
to send you diffs. Coding styles do matter to some people, e.g.,
indenting with tabs (let the editor convert tabs to 2 or 4 or whatever
spaces), brace level, all upper case for defines only, variable names
long enough to be understandable without reference to comments, etc.  The
tendency, at least for me, is to pass code I cannot read easily through
indent or cb, to get a standard style, and through a stream editor to
convert short names to longer ones. While this is easy to do, it makes
diffs impossible and removes the barrier against making gratuitous
changes to suit personal taste.

| I intend to maintain the basic solver with repairs (with the help of users like you!) and enhancements. For instance the current version of the code does least-squares optimization using a simplex proceedure (not yet released). 
| 
| I would like to see the changes you've made- 
| If you are using the code for research and would like to try
| the least-squares version let me know and we'll figure out how to get it to you (ftp?). After, of course, I fix the float <-> double boner (I knew better- just that my brain is not always in gear).

I probably would not get to trying something like this until next
year...  but I never turn down code.  A shar file or set of shar files
if any source file is over 100k is usually simple for small sources ( < 1
meg).  Ftp is of course simplest -- but, I just tried anonymous ftp
login to wrc.unr.edu and wheeler... and both refused me.
joplin.biosci.arizona.edu does allow anonymous ftp.  If you want to
have a stab at ftp, and your host tables let you get to joplin, then
please upload files into the pub directory, which is right under the
anon ftp home directory. Or ask your sysadmin to set up for anon ftp --
something like the following line in the /etc/passwd file:

ftp:3040NFq91IJYg:34:100:Anonymous ftp session..:/home2/ftp:/bin/csh

| By the way does my mailer give you fits? I've had a complaint that my mail comes out as one long line.

It doesn't cause me problems, but I suspect your editor may not be
putting line breaks in at ca 70 characters.  You can tell from the
included material which lines from your message came through longer than
80 characters -- the "| " follows each newline (precedes each new line).

I don't know why your mailer doesn't accept "joplin.biosci.arizona.edu"
when accepts "cs.arizona.edu".

Regards,

John R.


