CHIANTI—An Atomic Database for Emission Lines. IV. Extension to X-Ray Wavelengths