Can nuclear bombs intended for mass destruction also be used to deflect asteroids? As far as I know, there are two possible uses of nuclear bombs: for mass destruction and for deflecting asteroids. Can those two things be achieved with the same bombs? Or must they be designed in different ways? Also, can nuclear bombs which are intended for mass destruction, be used to deflect an asteroid without making any adjustments?
 A: The answer is yes, nuclear bombs can be used to deflect asteroids, but its a matter of how to do it.
Asteroids come in different sizes, masses and different compositions. Psyche 16, no threat to Earth, is a huge competent rock with a bulk density of 3.977 g/cm3, whereas Bennu is a smaller, but still very large asteroid with a bulk density of 1.190 g/cm3. For comparison, water has a density of 1 g/cm3 and the average density of the Earth is 5.513 g/cm3 and the average density of Mars is 3.934 g/cm3.
Pysche 16 is a solid chuck of rock, whereas Bennu is effectively a flying pile of rubble. In deflecting such asteroids they need to be treated differently.
If they were shattered by an explosion they could coalesce afterwards into a number of smaller asteroids because the isolated fragments would tend to attract each other under gravity.
Nuclear bombs produce two things: vast amounts of heat and radiation  - sub atomic particles, particularly neutrons.
On Earth, what does the most damage following a nuclear explosive is the shock wave produced in the atmosphere. It's why nuclear bombs are exploded above the ground, so the shock wave can reflect against the ground and double up with the shock wave already in the air. The atmosphere is the carrying medium for the destructive forces of nuclear explosions. In space, there is no such effect. In space one has to rely on either the heat of the explosion or the radiation produced.
To deflect an asteroid, the nuclear device needs to be detonated near the asteroid, not on it, and the radiation is what pushed the asteroid off its usual path. The trouble with this approach is the energy transfer rate is small. To increase the transfer rate the neutrons produced by the explosion need to be focused to have more neutrons directed towards the asteroid.
A: Not that I'm an expert on the topic, but I doubt there is a way to "design it differently."  It simply creates a huge explosion.
What you might do is add some kind of nozzle to direct the energy in a more linear or one sided fashion.  This could be directed at the asteroid; or perhaps better yet, the nuke would land on the asteroid and then direct its force away as a form of propulsion.
For this purpose, it might be more effective to land a craft with a nuclear reactor propulsion system on the asteroid, which would then power a smaller but steady thrust over a much longer duration. Deflecting the body's trajectory when it is still far away would be much easier and probably more effective than "destroying" it.  What matters is momentum transfer. If you explode the asteroid into small pieces, that cluster of pieces will still be on a collision course with the Earth.
