finally fixed the equildensity calculation and relaxation problem
improved relax densities, it now uses the mask