Gas Embedded Compressional Z-Pinch in H2 and D2