How much pressure would be needed to contain a 1 gigaton nuclear bomb explosion within a sphere of one meter radius? How much pressure would be needed to contain the largest human exploitable nuclear bomb within a sphere of one radius? 
Also would it be possible to create a magnetic field that controlled some substrate material like a thick wall of sand so it ended up like an underground explosion?
 A: You might get an order of magnitude estimate as follows.
We make the rough assumption that everything ends up in its vessel as a monoatomic ideal gas - actually it will be a plasma, with a thermal energy per mole of $\frac{3}{2}\,R\,T_{final}$, where $T_{final}$ is the thermodynamic temperature of the plasma.
Neglecting heats of vaporisation (we assume that only a small amount of the energy released is taken up vapourising everything), we thus equate the energy released $\Delta\,H = 4\times 10^{18}{\rm J}$ to the total thermal energy of the plasma, so that, from the ideal gas equation:
$$ \Delta\,H=\frac{3}{2}\,\mu\,R\,T_{final} =\frac{3}{2} P\,V$$
and we know $V = 4\,\pi\,r^2$ with $r=1{\rm m}$, whence I get $P\sim2\times 10^{17}{\rm Pa}$, or about $10^{12}$ atmospheres!
The pressure at the centre of the Earth is six orders of magnitude smaller than this, so if we were to contain the explosion in a vessel at the centre of the Earth, the volume would fleetingly rise to of the order of six orders of magnitude bigger than our sphere, i.e. it would fleetingly open a hole up of about $1{\rm km}$ radius at the centre of the Earth. It would swiftly shrink again as the heat leaked off into the Earth. I don't know much about seismology, but I'm guessing that such a disturbance at the Earth's centre might even be quite a noticeable at the surface everywhere on Earth. If you work out the amplitude of the spherical wave at the ground arising from a disturbance with $1{\rm km}$ amplitude at $1{\rm km}$ from the centre of the Earth, its pretty minuscule, but sensitive instruments might detect it.
