I am trying to understand virtual sites in MD simulations, and I came across this configuration:
Here, coordinate $\mathbf{s}$ represents the virtual site, which is formed by three other atoms $\mathbf{i}$, $\mathbf{j}$, and $\mathbf{k}$. The distance between atom $\mathbf{i}$ and the virtual site $\mathbf{s}$ is $|\mathbf{d}|$. The position of atoms $\mathbf{i}$, $\mathbf{j}$, and $\mathbf{k}$ are $\mathbf{r}_i$, $\mathbf{r}_j$, and $\mathbf{r}_k$, respectively.
In this case, the virtual site ($\mathbf{r}_s$) is in the plane of the other three particles at a distance of $|\mathbf{d}|$ from $\mathbf{i}$ at an angle of $\theta$ from $\mathbf{r}_{ij}$. Atom $\mathbf{k}$ defines the plane and direction of the angle.
How should I get the position of $\mathbf{r}_s$ using the other three atom positions and an angle?
I know the equation for $\mathbf{r}_s$, but I couldn't understand how it is derived. Any help is appreciated.
$$
\mathbf{r}_s = \mathbf{r}_i
+ d \cos\theta\, \frac{\mathbf{r}_{ij}}{|\mathbf{r}_{ij}|}
+ d \sin\theta\, \frac{\mathbf{r}_{\perp}}{|\mathbf{r}_{\perp}|}\tag{1},
$$
in which
$$
\mathbf{r}_{\perp} = \mathbf{r}_{jk}
- \frac{\mathbf{r}_{ij} \cdot \mathbf{r}_{jk}}{\mathbf{r}_{ij} \cdot \mathbf{r}_{ij}}\, \mathbf{r}_{ij}. \tag{2}
$$