As stated above (I-II, 85, 2,4) mortal sin takes away sanctifying grace, but does not wholly corrupt the good of nature (ST II-II Q10 A4).One example:
Unbelief does not so wholly destroy natural reason in unbelievers, but that some knowledge of the truth remains in them, whereby they are able to do deeds that are generically good (ibid., ad 3).Unquestionably non-Christians are able to discern truths that reason can attain, and consequently they can do good things. But this is not to say that they are able to do meritorious works such that they could merit salvation apart from Christ. Such works only are possible by the grace of God.
Since therefore, unbelief is a mortal sin, unbelievers are without grace indeed, yet some good of nature remains in them. Consequently it is evident that unbelievers cannot do those good works which proceed from grace, viz. meritorious works; yet they can, to a certain extent, do those good works for which the good of nature suffices.Just as we Christians are not perfectly consistent and sometimes sin when we do things that are not ordered towards our last end - the beatific vision - so also the unbeliever. He too is inconsistent, and does things which do not conform to his unbelief.
Hence it does not follow that they sin in everything they do; but whenever they do anything out of their unbelief, then they sin. For even as one who has the faith, can commit an actual sin, venial or even mortal, which he does not refer to the end of faith, so too, an unbeliever can do a good deed in a matter which he does not refer to the end of his unbelief.
And these considerations give us good reason for not thinking the worst of our fellow man, but for viewing him with charity. We do not need to suppose that others' motivations are only evil all the time. Sometimes they really do good, and we ought to give them the benefit of the doubt, just as we would like to receive the benefit of the doubt ourselves.