While the gift is free, it cannot be earned, there is the condition that one must have the faith to accept the gift that has been offered.
Two prerequisites for that faith to be there:
1. A person has got to believe that God does indeed exist.
2. A person has to believe that God will reveal himself to the One who truly desires to find Him.
(Hebrews 11:6, my paraphrase)
An atheist cannot do that.