latex write function with if
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
f(a,b) =
\begin{cases}
\text{open,} &\quad\text{if RMSD}_\text{s-open}\ge6, \text{RMSD}_\text{closed}\ge6\\
\text{closed,} &\quad\text{if RMSD}_\text{closed}\le2 \\
\text{semiopen,} &\quad\text{if RMSD}_\text{s-open}\le2\\
\text{transition,} &\quad\text{otherwise.} \\
\end{cases}
\]
\end{document}