SSCHAcode / python-sscha

The python implementation of the Stochastic Self-Consistent Harmonic Approximation (SSCHA).
GNU General Public License v3.0
55 stars 21 forks source link

"RuntimeWarning: invalid value encountered in sqrt" in Ensemble.py:1670 #121

Closed diegomartinez2 closed 1 year ago

diegomartinez2 commented 1 year ago

Hi Lorenzo, I found this error message on my calculations: "sscha/Ensemble.py:1670: RuntimeWarning: invalid value encountered in sqrt err = np.sqrt( (f2 - force**2) / np.sum(self.rho) )"

This comes from the line 1670 of Ensemble.py: if get_error: f2 = np.einsum("i, iab ->ab", self.rho, (eforces)**2) / np.sum(self.rho) err = np.sqrt( (f2 - force**2) / np.sum(self.rho) ) return force, err How can be it possible? A negative rho?, f2 < force**2?

diegomartinez2 commented 1 year ago

OK the problem in my calculation is rho:

Ensemble.py:1568: RuntimeWarning: overflow encountered in square
  sum_rho2 = np.float64(np.sum(self.rho**2))