Updated to include section that removes linear portion of DOS and
evaluates the gradient.