  Using DFT-based molecular dynamics simulation of Cu$^+$ cations flipping and
In$^{3+}$ cations displacive dynamics, we clarify the dipole ordering of
CuInP$_2$S$_6$ ferrielectrics through the second order Jahn-Teller effect which
determines the double-well potential for copper cations as well as three-well
potential for indium cations inside the structural layers. The temperature
dependence of the spatial distribution of Cu$^+$ and In$^{3+}$ cations is also
described within the quantum anharmonic oscillators model. In$^{3+}$ cations
play a decisive role in the character of the polar ordering: at ambient or for
positive pressures, the first order transition occurs; with the rise of
negative compression, the ferrielectric transition evolves to the second order.
The peculiarities of spontaneous polarization switching are related to the
contributions of copper and indium cationic sublattices.
