def _check_fix_Q(self, fixed_mu=False):
<EOL>self.Pi /= self.Pi.sum() <EOL>self.W += self.break_degen + self.break_degen.T<EOL>np.fill_diagonal(self.W, <NUM_LIT:0>)<EOL>Wdiag = -(self.Q).sum(axis=<NUM_LIT:0>)/self.Pi<EOL>np.fill_diagonal(self.W, Wdiag)<EOL>scale_factor = -np.sum(np.diagonal(self.Q)*self.Pi)<EOL>self.W /= scale_factor<EOL>if not fixed_mu:<EOL><INDENT>self.mu *= scale_factor<EOL><DEDENT>if (self.Q.sum(axis=<NUM_LIT:0>) < <NUM_LIT>).sum() <  self.alphabet.shape[<NUM_LIT:0>]: <EOL><INDENT>print ("<STR_LIT>", self.Q.sum(axis=<NUM_LIT:0>))<EOL>import ipdb; ipdb.set_trace()<EOL>raise ArithmeticError("<STR_LIT>")<EOL><DEDENT>
Check the main diagonal of Q and fix it in case it does not corresond
the definition of the rate matrix. Should be run every time when creating
custom GTR model.