Update force_constants.py

The code is much better problem-protected. Standard deviation cannot be computed if the number of elements is one, the variance can be negative and very small (numerical zero), and so on.