Immediately after death, each soul is judged by God. The soul is given infused knowledge pertaining to the moral evaluation of all the deliberate knowing acts of their lives. All the good and all the bad that the person did is then known to the person, with infallible certitude. The judgment of God, then, is in accord with that knowledge. And so the person cannot deny that they deserve Heaven, or Purgatory, or Hell. They know the truth of their own life.
Whosoever dies in a state of unrepented actual mortal sin will be sent to Hell. Whosoever dies in a state of grace will be sent to Heaven, perhaps after a stay in Purgatory of some length. Those persons die in a state of “original sin alone” who died unrepentant from the actual mortal sin of omission of never having found sanctifying grace in this life (through any of the three forms of baptism), despite ample opportunity. Prenatals, infants, and young children, who die at that age, did not have ample opportunity, so they do not die in a state of original sin alone. They are given a baptism of blood, prior to death, if they were not already baptized.
Why is it that persons who die unrepented from actual mortal sin cannot repent after death? It is a decision of the justice of God, not to offer them that grace. And free will cannot repent from grave sin without grace. It would be unjust to give souls a year, a hundred years, a million years, or more to repent, so that all souls go to Heaven. Everyone is treated fairly by God in this life, in the sense of being given ample providence and grace to reach eternal life. If the circumstances are so severe that the person seems to be denied that providence, then grace intervenes to provide what is lacking.
After death, God does not provide the grace of repentance for those who died unrepentant from actual mortal sin. They are justly condemned because an actual mortal sin is an act fully understood by the sinner to be gravely immoral, and committed with full freedom of choice.
In Purgatory, the souls do have the grace to repent. And this is just because they died in the state of grace. Repentance is consonant with that state. Sinners who die unrepentant from venial sins, or with temporal punishment due for venial or repented mortal sins, must satisfy the justice of God in Purgatory, so that all souls are treated fairly.
In Purgatory, the souls cannot sin any more. They are prevented from sinning by prevenient grace, just as the Blessed Virgin Mary was prevented from sinning, in this life, by the same grace. If they could sin, then they would deserve ever more punishment, and would never be able to leave for Heaven. If they could sin mortally, then they could fall from Purgatory to Hell. Both of those philosophical possibilities are contrary to justice. They died in the state of grace, so they obtain the promise of Christ and His Church to have eternal life.
In Hell, the souls have a merciful grace, which is that they can no longer sin. Again, this is a work of prevenient grace. If they could sin, then, being not in the state of grace, they would continually commit mortal sins, continually deserve ever more punishment, until the punishment of all souls in Hell would be unbearably extreme. Therefore, God prevents them from sinning at all. Neither the devils in Hell, nor the souls in Hell can sin at all. This is actually part of their punishment. Some of them would like to lash out at God and His faithful with utterances of hatred and blasphemy. But it is contrary to justice to allow billions of devils and souls in Hell to sin unceasingly against God. So they are unable. However, they are in a state of blasphemy, as they have utterly rejected God by unrepentant actual mortal sin.
More in my booklet: Heaven, Hell, Purgatory, and Limbo
Please take a look at this list of my books and booklets, and see if any topic interests you.