A new method for the calculation of atomic and local hardness