  ZnNi(CN)$_4$ is a 3D framework material consisting of two interpenetrating
PtS-type networks in which tetrahedral [ZnN$_4$] units are linked by
square-planar [NiC$_4$] units. Both the parent compounds, cubic Zn(CN)$_2$ and
layered Ni(CN)$_2$, are known to exhibit 3D and 2D negative thermal expansion
(NTE), respectively. Temperature-dependent inelastic neutron scattering
measurements were performed on a powdered sample of ZnNi(CN)$_4$ to probe
phonon dynamics. The measurements were underpinned by ab initio lattice
dynamical calculations. Good agreement was found between the measured and
calculated generalized phonon density-of-states, validating our theoretical
model and indicating that it is a good representation of the dynamics of the
structural units. The calculated linear thermal expansion coefficients are
$\alpha_a$=-21.2 $\times$ 10$^{-6}$ K$^{-1}$ and
$\alpha_c$=+14.6$\times$10$^{-6}$K$^{-1}$, leading to an overall volume
expansion coefficient $\alpha_V$ of -26.95$\times$10$^{-6}$K$^{-1}$, pointing
towards pronounced NTE behavior. Analysis of the derived mode-Gr\"uneisen
parameters shows that optic modes around 12 and 40 meV make a significant
contribution to NTE. These modes involve localized rotational motions of the
[NiC$_4$] and/or [ZnN$_4$] rigid units, echoing what has previously been
observed in Zn(CN)$_2$ and Ni(CN)$_2$. However, in ZnNi(CN)$_4$, modes below 10
meV have the most negative Gr\"uneisen parameters. Analysis of their
eigenvectors reveals that a large transverse motion of the Ni atom in the
direction perpendicular to its square-planar environment induces a distortion
of the units. This mode is a consequence of the Ni atom being constrained only
in 2D within a 3D framework. Hence, although rigid-unit modes account for some
of the NTE-driving phonons, the added d-o-f compared with Zn(CN)$_2$ results in
modes with twisting motions, capable of inducing greater NTE.
