Scholar As-Safariny said: The reasons for which the people of the graves are tortured are divided into two categories: general and detailed:
As for the general, people are tortured for their ignorance with Allah, not obeying His Commands, and for committing sins. So, Allah does not torture a soul that knew and loved Him, obeyed His Commands, and avoided His Prohibitions, for the Torment of the grave and the torment of the Hereafter fall due to Allah's Wrath on His Servant. So, whoever disobeyed Allah and made Him angry in this world by committing His Prohibited matters without repenting to Him and died in this case shall have a share from the torment of the Barzakh (the period between death and resurrection) as much as the wrath of Allah which he brought against himself.
As for the detailed, the Messenger of Allah (peace be upon him) informed people about the two men who have been tortured in their graves: One of them was spreading tale bearing among people, whereas the other used not to cover himself from urination or was not purifying himself after urination. Then he mentioned the one who offers Salah without purification, the one who passes by the oppressed without providing him victory, the one who recites the Qur'an then does not recite it at night or act according to it in daytime, adulterers and adulteresses, people who usurp people's money, the people who do not offer the Fajr Salah, the people who withhold Zakah, the people who stir sedition among people, haughty and arrogant people, hypocrites, talebearers, and liars.
Atheists and disbelievers denied the torment and bliss of the grave depending on their minds and senses because they do not see something of that torment.
The answer to that is: The torment of the grave is part of the unseen matters which depend on authentic texts without interference from the mind or thought, and the conditions of the Hereafter are not measured by the conditions of the world, and inability to grasp this matter does not indicate its inexistence. Allah knows the best!
Please write: COMMENT in this box to verify that you are human