added totaldensity factor in equildensity routine