Implemented rigidity calculation.