Mass defect in beta decay During calculation of the Q-value in beta decay, is the mass of the electrons of the reactants (and product) atom included during calculation of Q-value?
 A: In general it doesn't matter, because most beta-decay energies are in the mega-eV range, while most electron binding energies are in the eV range.  So if your question is "should I include the spectator electrons when I'm doing my homework," the answer is to do whatever is simplest with your favorite data source.  The rest of this answer is about cases where including or excluding spectator electrons does matter, and why.
The first hint that it might be better to include the spectator electrons will come around when you start looking for sources that give only nuclear masses, and reading into their reference sections to see where those data come from.  For stable or stable-ish nuclei, it's much easier to do precision mass measurements on neutral atoms or atoms in low-charge states.  My experience has been that the best-sourced reference materials report mass excesses for neutral atoms, rather than for ions (e.g).  Very short-lived nuclei many be produced completely stripped of electrons in accelerators; however, careful reading of the literature generally suggests that the masses of the short-lived nuclides are computed from the energies of their decays to stable nuclides, with an associated increase in uncertainties.
That is to say: the mass data for bare nuclei are lower-quality than the mass data for neutral atoms, because it's hard to make and store bare nuclei.
Furthermore, for precision work, you always want to make sure that your model describes the process that you're actually modeling, rather than some other, more convenient process.  For example, right now in your body, there are many many potassium atoms, most of which are $\rm K^+$ ions in solution.  Some of those are potassium-40, which is subject to competitions between the following three decays:
\begin{align}
\rm ^{40}K^+ 
&\to\rm {}^{40}Ca^{++} \ e^- \ \bar\nu_e & Q&=1\,310.89\rm\,keV & \Gamma &= 89.3\%
\tag1\\
&\to\rm {}^{40}Ar^{+} \ \nu_e  & Q &= 1\,504.40\rm\,keV & \Gamma &= 10.7\%
\tag2\\
&\to\rm {}^{40}Ar^\text{neutral} \ e^+ \ \nu_e & Q&=\ \ 482.40\rm\,keV & \Gamma &= 0.001\%
\tag3
\end{align}
Here the $\Gamma$ are the branching ratios, which add up to 100%; those and the $Q$-values are from the ENSDF.
I can say with confidence that in your body at this moment there exactly zero completely ionized potassium nuclei $\rm K^{19+}$, based on the assumption that you are at finite temperature.  So modeling the decay of bare nuclei instead of singly-charged ions$^1$ might miss some important features; let's see what they are and whether they are relevant to $Q$-values.
In the $\beta^-$ decay to calcium (1), there are eighteen "spectator" electrons that don't participate in the interaction at all. It's theoretically possible that the created electron could be captured by the new calcium nucleus,
$$
\rm^{40}K^+ \to{} ^{40}Ca^+\ \bar\nu_e
\tag{1a}
$$
However, that's only permitted if the emitted $\beta^-$ is emitted with an energy less than the second ionization energy for calcium, which is (source) about $12\rm\,eV$.  Such a decay would require the neutrino to carry away nearly all of the $1.3\rm\,MeV$ decay energy, and is safe to ignore for most processes.$^2$
To some extent the energies of the spectator electrons are different in the $\rm K^+$ ion than in the $\rm Ca^{++}$ ion; the reconfiguration of the spectator electrons in this case affects the shape of the beta-decay energy spectrum, but not its endpoint.$^3$
In the positron-emission decay to argon (3), you can make a similar argument that the spectator electrons aren't a big deal.
However, something interesting happens to the $Q$-value when you ask about the spectator electrons in the electron-capture decay (2).  In this case the "participant" electron$^4$ is one of the innermost electrons, rather than a barely-bound valence electron or an electron that is completely free.  The captured electron is an $s$-wave electron from one of the K, L, or M shells, and the daughter ion will emit x-rays as higher-energy bound electrons fall into the vacancy.  It so happens that the electron-capture decay (2) can proceed directly to the argon nuclear ground state, or through a nuclear excited state.  The possible paths are
\begin{align}
\rm^{40}K
&\to\rm {}^{40}Ar^* \ \nu_e\ \gamma_x
& Q&=\ \ 43.55\rm\,keV
& \Gamma &= 10.76\%
\tag{2a}\\
&\to\rm {}^{40}Ar \ \nu_e\  \gamma_x
& Q&= 1504.40\rm\,keV
& \Gamma &= 0.045\%
\tag{2b}
\end{align}
Most the energy difference is made up when the argon nucleus relaxes by emitting a gamma ray:
\begin{align}
\rm^{40}Ar^*
&\to\rm {}^{40}Ar \ \gamma
& Q &= 1461\rm\,keV
\tag4
\end{align}
So now we have to be more careful what we mean by the $Q$-value: does it still make sense to use the name $Q$-value when we talk about these intermediate reactions?  It certainly feels like it does, and people certainly do it.  But the difference between $L$- and $K$-shell x-rays in the reactions (2) is the difference between $\rm0.3\,keV$ and $\rm3.2\,keV$ (source).  In the branch (2a), that modification is 7% of the neutrino's decay energy.
I remind you, at the end of this long answer, that the first thing I wrote was that it usually doesn't matter whether you use nuclear masses or atomic masses when computing $Q$-values, as long as you're consistent about it.  But where it does matter, atomic masses are more reliable, and most real decays take place in neutral or nearly-neutral atoms.  We probably haven't even measured the bare nuclear masses for most heavy nuclei$^5$.  There's just no reason to invent such fictional data to compute $Q$-values.  Use what's in your data source; when you start questioning the quality of your data source, you'll start discovering that you prefer neutral-atom masses.

Asides:

*

*I suppose it's possible that some of the data in my references were compiled from potassium metal sources (where neutral atoms would be decaying) rather than from some kind of ionic salt; but the first ionization energy for potassium is only about $4\rm\,eV$, which we'll see in a moment is small compared to other electronic effects.


*If the $\rm e^-,\bar\nu_e$ energies were uniformly distributed, the capture reaction (1a) would be allowed in one decay out of $10^5$.  However in most beta decays the three decay products have roughly equal momentum magnitude, so such "endpoint decays" are suppressed.


*Well, not quite.  It takes a different amount of energy to remove one more electron from a $\rm K^+$ compared to removing "the same" electron from its analogue $\rm Ca^{++}$, and that energy difference gets bigger as you consider more strongly-charged ions. It's not immediately clear to me whether there should be a shift in the beta-decay endpoint energies due to these binding energy differences, but its scale should be the scale of the binding energy differences.  For $\rm K^+\to Ca^{++}$ compared to $\rm K\to Ca^+$, the possible change in $Q$-value is a few eV on a mega-eV decay.


*Someone will use a comment to point out that you wouldn't have electron decay at all without electrons around the nucleus. The point I'm making here is a little more subtle: the different possible participant electrons have different binding energies.


*For very heavy nuclei, the inner electrons are relativistic, so there are reasons to be interested in the spectrum of things like "hydrogenic uranium," $\rm U^{91+}$.  If there are high-precision bare-mass measurements for heavy nuclei, that's probably the context.
A: No, they're not. That's because beta decay processes are nuclear processes. Thus, you should only compute nuclear masses:
For example, $\beta^-: \qquad Q=M_n(Z,A)-M_n(Z+1,A)-m_e $
Where $M_n$ is the nuclear mass and $m_e$ is the electron's one.

However, it's true that you can do something else: if you add and remove one $Z m_E$ term:
$Q=M_n(Z,A)+ (Z m_e -Zm_e)-M_n(Z+1,A)-m_e $
Then you have
$Q=M_n(Z,A)+ Z m_e -M_n(Z+1,A)- (Z+1)m_e $
So you could say that
$$Q=M_{at}(Z,A) -M_{at}(Z+1,A)$$
But this means assuming that the atomic mass is $M_{at}=M_n+Z m_e$, which is only approximately true, because you are neglecting the electron binding energy.
Atomic masses are more easily masured in lab, so we often want to write them like this, but never forget that you're neglecting the binding energy.
So, in short, you can always rewrite your formula in terms of atomic masses, but be careful because the actual formula uses nuclear masses.
