FIxed a number of errors

Fixed a number of errors and made it so that it would compile under
gfortran, which does not support array constructors of the form x =
[1:n].  These were replaced with array constructors of the form x =
(/(i,i=1,n)/).