You can use that equation to calculate Q-factor,
But, I want to understand how you got BER=0; this result is experimental!
if Not,you may increase iteration, using Monte Carlo Methods, so, BER will be different from 0, and then you can calculate Q-Factor!