Study of hardness and deformation of brittle materials with a density functional theory