Adding logic to create stats.gpi file with record of conditions at S_max