What is "rigidity"? On the macroscopic scale, we might liken it to a spring's spring constant or more generally Hooke's law describing a relationship between, stress, strain and an object's Young's Modulus.
Objects are rigid if a stress, i.e. force or pressure, induces only small distortions to the relative position of constituent particles.
In the absence of stress, an object will exist in several possible matter states: solid, liquid, gas, and plasma. We only have rigidity in the case of solids, though the concept applies to some extent to the others at high pressures.
Objects are held together by the inter molecular forces of constituent molecules. Molecules are held together by ionic and covalent bonding if its constituent atoms. The atoms are held together by electrostatic force and the Pauli exclusion principle.
All these interactions lead to an equilibrium position for the particles involved.
In an equilibrium state, particles can be described using the solutions to a Quantum Harmonic Oscillators about their equilibrium point. This implies a spring constant resistance, Hooke's Law.
So objects are rigid, unlike say, liquids or solids, when the wave function of their constituent particles can be described using wave functions of the Harmonic Oscillator. This in turn results from the kinetic energies of the particles not offsetting the attractive electro static bonds.
So we should get a measure of rigidity by averaging the binding energies of the closest particles to a point of interaction, doubling it then dividing by the mean square distance of those interacting particles.
The energy of an electro magnetic field is $u=\frac{\epsilon_0}{2}E^2+\frac{1}{2\mu_0}B^2$
So a decent guess might be $k\approx\frac{2(-<u>+\frac{3}{2}nRT)}{<r^2>}$
The field isn't independent of the temperature, so $<u>=f(T)$. This might serve as a way of gauging a melting point.