It does matter.
We might have an intention to show others how "good we are", for some worldly reason .. we might not even be consciously aware of it.
That is the reason the intention behind why we do things is important.
Everything we think and do affects us spiritually.
It is very easy to claim that we do "good deeds" because we are "good"
Almighty God knows what is deep in our hearts.
If indeed, an atheist [ or believer ] does good with a pure intention, then their soul will be nourished by it.
..claiming "we have no soul", is likely to negate that, unfortunately.
Intention is of the utmost importance. A shepherd may feed and care for his flock but the intention in the end is to slaughter the sheep and be sold for profit.