I hear conflicting opinions, and perhaps some true historians can set the record straight.
I've heard "yes they were going to surrender but they were nuked first." And I've heard "no they were not going to surrender and we had to nuke them as we had no other option and they wanted to keep expanding."
This is a very commonly asked question, and there is an extensive collection of posts related to the atomic bombs and the Japanese decision to accept the Potsdam Proclamation and the end of the war. To give a few highlights:
/u/ScipioAsina discusses the changes in the Japanese political landscape in the days between the dropping of the bomb on Hiroshima and the Japanese surrender here. I also recommend the comments by /u/restricteddata and /u/t-o-k-u-m-e-i later in this same thread.
/u/t-o-k-u-m-e-i discusses the question of whether the onus of deciding the end of the war lies with the atomic bomb or Soviet entry into the war here, with a particular reference to Tsuyoshi Hasegawa's work Racing the Enemy. A now deleted user also delves into the reaction to Hasegawa's work and its wider acceptance by historians here.
The short answer is that it remains a topic of considerable debate. Many of the records of the Japanese government and military were destroyed in the aftermath of the surrender, and personal testimonials must always be considered in the light of how that individual wished to portray themselves. Hasegawa makes a compelling and well researched argument that the Japanese saw the Soviet entry into the war, and the loss of an option to rely on Moscow to mediate a peace as the deciding issue to surrender. However, Edward J Drea, noted historian of the Imperial Japanese Army argues that the threat of the atomic bomb being employed against military forces, thus eliminating the potential for a great decisive battle for the Home Islands was the key tipping point. The discussion is absolutely on going, and there is no single answer.