# Badly scaling closing SQRT symbol with large font sizes

I prefer the SQRT symbol with the closing downward tick, and have been using this answer to achieve the desired effect. However, when I hugely increase the font size and use fixcmex to achieve some nicely scaling symbols (required for a nice fix to matplotlib plotting) the SQRT downward tick no longer scales nicely.

# MWE

\documentclass{article}

\usepackage{lmodern,amsmath,amssymb,bm,physics,letltxmacro,fixcmex}

% Gives the nice SQRT symbol.
\makeatletter
\let\oldr@@t\r@@t
\def\r@@t#1#2{%
\setbox0=\hbox{$\oldr@@t#1{#2\,}$}\dimen0=\ht0
\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
{\box0\lower0.4pt\box2}}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{#2}}
\makeatother

\usepackage[papersize={12in,12in},body={10in,10in},margin={1in,1in}]{geometry}
\pagestyle{empty}

\begin{document}
\fontsize{50.000000}{62.500000}{\rmfamily % Comment out for normal
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$
} % Comment out for normal
\end{document}


PS - I would like to keep using the physics package.

As you can see in the macros definitions, the width of the added rule is omitted (assumed 0.4pt), and also the downward shift is fixed to 0.4pt which doesn't match large font sizes. You can use relative sizes (ex or em) as itn the following modification of the code:

\documentclass{article}

\usepackage{lmodern,amsmath,amssymb,bm,physics,letltxmacro,fixcmex}

% Gives the nice SQRT symbol.
\makeatletter
\let\oldr@@t\r@@t
\def\r@@t#1#2{%
\setbox0=\hbox{$\oldr@@t#1{#2\,}$}\dimen0=\ht0
\setbox2=\hbox{\vrule width 0.035em height\ht0 depth -\dimen0}%
{\box0\lower0.095ex\box2}}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{#2}}
\makeatother

\usepackage[papersize={12in,12in},body={10in,10in},margin={1in,1in}]{geometry}
\pagestyle{empty}

\begin{document}
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$

\fontsize{20}{24}{\rmfamily
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$
}

\fontsize{30}{36}{\rmfamily
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$
}

\fontsize{40}{48}{\rmfamily
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$
}

\fontsize{50}{60}{\rmfamily
$\sqrt{D_3} \,\textrm{RMSE}(X, Y)$
}
\end{document}


The result is: