There is a secondary view that it was done to an eye of using the bomb as a threat to Stalin, but all research of the decision makers does not reveal this to be the case. In fact, the research shows over and over that the Americans where desperate to get the Russians into the pacific theater. The view that the use of the atomic bomb was a effort to threaten Stalin and keep the Russians from the war was popularized by Tsuyoshi Hasegawa's book in 2005, but that book has been pretty much discredited in historical communities.
A example analysis is here: https://www.bu.edu/historic/hs/kort.html
It's also not that the United States opinion diverges from much of the world. Outside of Japan, most countries have a similar percentage of people who view that it was justified or not. (79% of Japanese thing it was unjustified versus 44% of Americans).