Valmiki Ramayana Ayodhya Kanda Sarga 67 Shloka 32
Original Shlokaये हि सम्भिन्नमर्यादा नास्तिकाश्छिन्नसंशयाः। तेऽपि भावाय कल्पन्ते राजदण्डनिपीडिताः।।2.67.32।।
1 source checked for this shloka
सम्भिन्नमर्यादाः those disregarding the bounds of morality, छिन्नसंशयाः dispelling doubts, ये हि those, नास्तिकाः atheists, तेऽपि they also, राजदण्डनिपीडिताः when subjected to royal punishment, भावाय for virtuous path, कल्पन्ते adopt.
Atheists, who disregard the bounds of morality and live freely dispelling doubts will tend to follow virtuous path out of fear when subjected to royal punishment.