Manu Smriti 11.66
11.66. Stealing grain, base metals, or cattle, intercourse with women who drink spirituous liquor, slaying women, Sudras, Vaisyas, or Kshatriyas, and atheism, (are all) minor offences, causing loss of caste (Upapataka).
So if someone becomes an atheist he will loss his cast.
But Samkhya school of thought is a atheist school. They believe in God.
If a person is following Samkhya school will he lose his cast. Or will he be committing minor.
The source of this verse is a question I found on this website.