adding test in scratchpad testResidualMemoryError() to catch a weird memory bug (manifests failure as an increase in energy error with refinement)