The prevailing view on the Japanese surrender in this sub seems to be that the atomic bombings had an effect but a comparitively minor one compared to the Soviet DOW. This makes sense to me in a way, after 3 or so years of having their cities wiped out again and again its understandable that the Japanese government would be pretty numb to that sort of thing. What doesnt make sense to me is that they were already preparing for a joint US-UK invasion, possibly supported by more nukes, fully expecting people on both sides to die by the truckload, why would the addition of the Soviet Union rattle them so much?
There are two big reasons the Soviet invasion shocked the Japanese. The first is simply tactical. Although Japan proper was increasingly isolated from the mainland by American subs and especially mining operations, the Asian mainland contained significant Japanese forces. It also was a significant source of material, food and raw industrial resources. Japan expected be able to use some of these in repelling the US. The Soviet attack made these troops completely irrelevant for the defense of the home islands. The Japanese were going to fight two fights now, and the Soviets were clearly going to win the fight in China and Manchuria. It was then going to turn around and join in the attack on the Japanese islands. The Western Allies were going to have a roughly 3:2 advantage in personnel. And the Japanese hoped to make that up by arming the general population. The Soviet declaration of war changed that. It improved the total Allied to Japanese ratio to 2:1 or better. With a defensive advantage, the Japanese could hope to win in the first case. It really didn't have a similar hope in the second case.
The second reason that the Japanese were so shaken, was they viewed the Soviets as a potentially friendly neutral. Their hope for the end of the war was that they might be able to hold off long enough to negotiate a favorable surrender. They weren't trying to win any more, they were trying to secure better terms than "unconditional surrender." In particular they wanted to at least to retain their pre-1914 territory, preserve the emperor, avoid a direct occupation, oversee any change in government, and prevent any of their people from standing up for war crimes trials. Some of these were more negotiable than the others. Their primary hope was that Stalin would serve as an intermediary. They had even promised him Manchuria if he were to step in and help negotiate a peace.
So the declaration of war did those two things. It made the Japanese strategic situation vastly worse, and it killed any hope they had that the Soviets would intervene politically on their behalf. Fighting to a stalemate became much harder to envision. While a mediation was set back to square zero.
Add in the fact that the US was clamping down an increasing effective blockade, was perfecting the 1,000 bomber firebomb raid, and had just shown that they were capable of even more thoroughly destroying cities with a handful of planes. The Japanese were faced with a possibility that they might not get a final defensive battle to force the Allies to the negotiating table. The whole situation went from bad to dire, from the Japanese point of view.
3 or so years of having their cities wiped out again and again
Japan didn't start suffering severe damage to its cities until the final year of the war, and until LeMay started sending the B-29s at night and at low altitude, laden with a near-max load of incendiaries.