\begin{eqnarray}
b_{ij} & = & \chi_{ij} (1 + \beta_i^{n_i} \zeta^{n_i}_{ij})^{-1/2n_i} \\
\zeta_{ij} & = & \sum_{k \ne i,j} f_C (r_{ik}) \omega_{ik} g(\theta_{ijk}) \\
-g(\theta_{ijk}) & = & 1 + c_i^2/d_i^2 - c_i^2/[d_i^2 + (h_i - \cos \theta_{ijk})^2]
+g(\theta_{ijk}) & = & 1 + c_i^2/d_i^2 - c_i^2/[d_i^2 + (h_i - \cos \theta_{ijk})^2] \\
+b_{ij} & = & \chi_{ij} \Big( 1 + \beta_i^{n_i} \Big[ \sum_{k \ne i,j} f_C (r_{ik}) \omega_{ik} \big[ 1 + c_i^2/d_i^2 - c_i^2/[d_i^2 + (h_i - \cos \theta_{ijk})^2] \big] \Big] \Big)^{-1/2n_i}
\end{eqnarray}
where $\theta_{ijk}$ is the bond angle between bonds $ij$ and $ik$.
This is illustrated in Figure \ref{img:tersoff_angle}.
For the implementation it is helpful to seperate the two and three body terms.
\begin{eqnarray}
F_n^i & = & \sum_{j \neq i} \Big( f_R(r_{ij}) \partial_{x_n^i} f_C(r_{ij}) + f_C(r_{ij}) \partial_{x_n^i} f_R(r_{ij}) \Big) + \nonumber\\
-& + & \sum_{j \neq i} \Big( \partial_{x_n^i} f_C(r_{ij}) b_ij f_A(r_{ij}) + f_C(r_{ij}) \big[ b_{ij} \partial_{x_n^i} f_A(r_{ij}) + f_A(r_{ij}) \partial_{x_n^i} b_{ij} \big] \Big)
+& + & \sum_{j \neq i} \Big( \partial_{x_n^i} f_C(r_{ij}) b_{ij} f_A(r_{ij}) + f_C(r_{ij}) \big[ b_{ij} \partial_{x_n^i} f_A(r_{ij}) + f_A(r_{ij}) \partial_{x_n^i} b_{ij} \big] \Big)
\end{eqnarray}
The cutoff function $f_C$ derivated with repect to $x^i_n$ is
\begin{equation}
\partial_{x_n^i} f_R(r_{ij}) & = & - \lambda_{ij} \frac{x_n^i - x_n^j}{r_{ij}} A_{ij} \exp (-\lambda_{ij} r_{ij})\\
\partial_{x_n^i} f_A(r_{ij}) & = & \mu_{ij} \frac{x_n^i - x_n^j}{r_{ij}} B_{ij} \exp (-\mu_{ij} r_{ij}) \textrm{ .}
\end{eqnarray}
-The angle $\theta_{ijk}$ can be expressed by the atom distances with the law of cosines:
-\begin{eqnarray}
-\theta_{ijk} & = & \arccos \Big( (r_{ij}^2 + r_{ik}^2 - r_{jk}^2)/(2 r_{ij} r_{ik}) \Big) \\
-\partial_{x^i_n} \theta_{ijk} & = &
-\frac{-1}{\sqrt{1 - ((r_{ik}^2+r_{ij}^2-r_{jk}^2)/2r_{ik}r_{ij})^2}} \times \nonumber\\
- & & \times \Big( \frac{4 r_{ik}r_{ij} (2 x^i_n - x^k_n - x^j_n) + 2(x^j_n - x^i_n)\frac{r_{ik}}{r_{ij}} + 2(x^k_n - x^i_n)\frac{r_{ij}}{r_{ik}} }{4 r^2_{ik} r^2_{ij}}\Big) \label{eq:d_theta}
-\end{eqnarray}
-Using the expressions \eqref{eq:d_cutoff} and \eqref{eq:d_theta} the derivation of $b_{ij}$ with respect to $x^i_n$ can be written as:
+The cosine of the angle $\theta_{ijk}$ can be expressed by the atom distances with the law of cosines
+\begin{equation}
+\cos \theta_{ijk} = \Big( (r_{ij}^2 + r_{ik}^2 - r_{jk}^2)/(2 r_{ij} r_{ik}) \Big)
+\end{equation}
+or by the definition of the scalar product
+\begin{equation}
+\cos \theta_{ijk} = \frac{\vec{r}_{ij} \vec{r}_{ik}}{r_{ij} r_{ik}} \textrm{ .}
+\end{equation}
+The derivation of the angle $\theta_{ijk}$ with respect to $x^i_n$ is given by
+\begin{equation}
+\partial_{x^i_n} \cos \theta_{ijk} = \Big( r_{ik} r_{ij} - \vec{r}_{ij} \vec{r}_{ik} \frac{r_{ik}}{r_{ij}} \Big) (x_n^i - x_n^j) + \Big( r_{ik} r_{ij} - \vec{r}_{ij} \vec{r}_{ik} \frac{r_{ij}}{r_{ik}} \Big) (x_n^i - x_n^k)
+\label{eq:d_costheta}
+\end{equation}
+
+Using the expressions \eqref{eq:d_cutoff} and \eqref{eq:d_costheta} the derivation of $b_{ij}$ with respect to $x^i_n$ can be written as:
\begin{eqnarray}
\partial_{x^i_n} b_{ij} & = &
- \frac{1}{2n_i} \chi_{ij} \Bigg( 1 + \beta_i^{n_i} \Bigg[ \sum_{k \ne i,j} \bigg( f_C(r_{ik}) \omega_{ik} \Big( 1 + \frac{c_i^2}{d_i^2} - \frac{c_i^2}{d_i^2 + (h_i - \cos \theta_{ijk})^2} \Big) \bigg)^{n_i} \Bigg] \Bigg)^{-\frac{1}{2n_i} - 1} \times \nonumber\\
&& \times n_i \beta_i^{n_i} \sum_{k \ne i,j} \Bigg( \Bigg[ f_C(r_{ik}) \omega_{ik} \Big( 1 + \frac{c_i^2}{d_i^2} - \frac{c_i^2}{d_i^2 + (h_i - \cos \theta_{ijk})^2} \Big) \Bigg]^{n_i -1} \times \nonumber\\
-&& \times \Bigg[ \omega_{ik} \Big( 1 + \frac{c_i^2}{d_i^2} - \frac{c_i^2}{d_i^2 + (h_i - \cos \theta_{ijk})^2} \Big) \partial_{x^i_n} f_C(r_{ik}) + \nonumber\\
-&& + f_C(r_{ik}) \omega_{ik} \frac{c_i^2}{(d_i^2 + (h_i - \cos \theta_{ijk})^2)^2} \times \nonumber\\
-&& \times 2 \Big( h_i - \cos \theta_{ijk} \Big) \sin \theta_{ijk} \partial_{x^i_n} \theta_{ijk} \Bigg] \Bigg)
+&& \times \Bigg[ \omega_{ik} \Big( 1 + \frac{c_i^2}{d_i^2} - \frac{c_i^2}{d_i^2 + (h_i - \cos \theta_{ijk})^2} \Big) \partial_{x^i_n} f_C(r_{ik}) - \nonumber\\
+&& - f_C(r_{ik}) \omega_{ik} \frac{2 c_i^2 (h_i - \cos \theta_{ijk})}{(d_i^2 + (h_i - \cos \theta_{ijk})^2)^2} \partial_{x^i_n} \cos \theta_{ijk} \Bigg]
\end{eqnarray}