A Catholic needs a dispensation to marry an atheist. With proper dispensation the marriage would be valid. For the marriage to be sacramental both parties must be baptized. A good resource for someone considering a marriage such as this is
The Pastoral Solutions Institute.
Here is the applicable Canon Law:
Can. 1071 §1. Except in a case of necessity, a person is not to assist without the permission of the local ordinary at:
4/ a marriage of a person who has notoriously rejected the Catholic faith;
§2. The local ordinary is not to grant permission to assist at the marriage of a person who has notoriously rejected the Catholic faith unless the norms mentioned in can. 1125 have been observed with necessary adaptation.
Can. 1086 §1. A marriage between two persons, one of whom has been baptized in the Catholic Church or received into it and has not defected from it by a formal act and the other of whom is not baptized, is invalid.
§2. A person is not to be dispensed from this impediment unless the conditions mentioned in can.1125 and 1126 have been fulfilled.
Can. 1125 The local ordinary can grant a permission of this kind if there is a just and reasonable cause. He is not to grant it unless the following conditions have been fulfilled:
1/ the Catholic party is to declare that he or she is prepared to remove dangers of defecting from the faith and is to make a sincere promise to do all in his or her power so that all offspring are baptized and brought up in the Catholic Church;
2/ the other party is to be informed at an appropriate time about the promises which the Catholic party is to make, in such a way that it is certain that he or she is truly aware of the promise and obligation of the Catholic party;
3/ both parties are to be instructed about the purposes and essential properties of marriage which neither of the contracting parties is to exclude.
Can. 1126 It is for the conference of bishops to establish the method in which these declarations and promises, which are always required, must be made and to define the manner in which they are to be established in the external forum and the non-Catholic party informed about them.