Hello everyone. I’m observing the exception ‘divide by zero encountered in double_scalars’ while running the YangSolidSolution featurizer.

In the method compute_omega(…), the mixing enthalpy can add up to 0, therefore, this error is triggered while calculating (mean_Tm * entropy / enthalpy).

In order to avoid this exception, I simply changed the end of the method from:

return abs(mean_Tm * entropy / enthalpy)

``

to:

if enthalpy == 0:

return 0

else:

return abs(mean_Tm * entropy / enthalpy)

``

Here is a list of compounds that were causing the error (i.e. that have enthalpy --> 0)

Pm1 Ho3

Sm1 Tm3

Sm3 Y1

Sm3 Er1

Sm3 Ho1

La3 Dy1

Pr1 Tm3

Pr1 Lu3

Hf1 Zr1

Ce1 Y3

La1 Tb3

Dy3 Y1

Nd1 Tm3

Lu1 Th3

Ho3 Lu1

Pr1 Ho3

Zn1 Ga3

Pd1 Au3

Pr1 Sm3

Sm1 Lu3

Nd1 Y3

Nd1 Dy3

Tb1 Y3

Pr3 Er1

Nd3 Sm1

Pr1 Dy3

Cd2 Hg1

Sm1 Tm3

Sm1 Y3

Cd3 In1

Cd1 Hg2

Co1 Sn1

Zr1 Ti2

Co1 Sn2

Tl1 Cd1 Rh2

Many thanks,

Thanks for pointing this out!

I have made a change to the code to avoid the “divide by zero” warning: https://github.com/hackingmaterials/matminer/pull/407

Rather than returning “0” in the case of enthalpy == 0, I use a very small positive value of enthalpy to better emulate the limit of Omega as enthalpy approaches 0 (positive infinity).

Best,

Logan

PS. If you’d like to make these changes yourself, I would be happy to help you with the GitHub pull request system.

## ···

**From:** camilofs

**Sent:** Thursday, August 8, 2019 5:35 PM

**To:** matminer

**Subject:** YangSolidSolution featurizer raising ‘divide by zero encountered indouble_scalars’

Hello everyone. I’m observing the exception ‘divide by zero encountered in double_scalars’ while running the YangSolidSolution featurizer.

In the method compute_omega(…), the mixing enthalpy can add up to 0, therefore, this error is triggered while calculating (mean_Tm * entropy / enthalpy).

In order to avoid this exception, I simply changed the end of the method from:

return abs(mean_Tm * entropy / enthalpy)

to:

if enthalpy == 0:

return 0

else:

return abs(mean_Tm * entropy / enthalpy)

Here is a list of compounds that were causing the error (i.e. that have enthalpy --> 0)

Pm1 Ho3

Sm1 Tm3

Sm3 Y1

Sm3 Er1

Sm3 Ho1

La3 Dy1

Pr1 Tm3

Pr1 Lu3

Hf1 Zr1

Ce1 Y3

La1 Tb3

Dy3 Y1

Nd1 Tm3

Lu1 Th3

Ho3 Lu1

Pr1 Ho3

Zn1 Ga3

Pd1 Au3

Pr1 Sm3

Sm1 Lu3

Nd1 Y3

Nd1 Dy3

Tb1 Y3

Pr3 Er1

Nd3 Sm1

Pr1 Dy3

Cd2 Hg1

Sm1 Tm3

Sm1 Y3

Cd3 In1

Cd1 Hg2

Co1 Sn1

Zr1 Ti2

Co1 Sn2

Tl1 Cd1 Rh2

Many thanks,

–

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/2c876d9c-cc12-4b37-b230-d45659ba8b23%40googlegroups.com.

Hi Logan,

I agree with the modification. A minimum enthalpy of 1e-06 will produce a better result than returning 0.

Thank you for requesting the pull on GitHub. I’m new to GitHub, but I’ll be reading about it and try to request the next pull by myself.

Best,

## ···

Em seg, 12 de ago de 2019 às 13:16, Logan Ward [email protected] escreveu:

Thanks for pointing this out!

I have made a change to the code to avoid the “divide by zero” warning: https://github.com/hackingmaterials/matminer/pull/407

Rather than returning “0” in the case of enthalpy == 0, I use a very small positive value of enthalpy to better emulate the limit of Omega as enthalpy approaches 0 (positive infinity).

Best,

Logan

PS. If you’d like to make these changes yourself, I would be happy to help you with the GitHub pull request system.

**From:** camilofs

**Sent:** Thursday, August 8, 2019 5:35 PM

**To:** matminer

**Subject:** YangSolidSolution featurizer raising ‘divide by zero encountered indouble_scalars’

Hello everyone. I’m observing the exception ‘divide by zero encountered in double_scalars’ while running the YangSolidSolution featurizer.

In the method compute_omega(…), the mixing enthalpy can add up to 0, therefore, this error is triggered while calculating (mean_Tm * entropy / enthalpy).

In order to avoid this exception, I simply changed the end of the method from:

return abs(mean_Tm * entropy / enthalpy)

to:

if enthalpy == 0:

return 0

else:

return abs(mean_Tm * entropy / enthalpy)

Here is a list of compounds that were causing the error (i.e. that have enthalpy --> 0)

Pm1 Ho3

Sm1 Tm3

Sm3 Y1

Sm3 Er1

Sm3 Ho1

La3 Dy1

Pr1 Tm3

Pr1 Lu3

Hf1 Zr1

Ce1 Y3

La1 Tb3

Dy3 Y1

Nd1 Tm3

Lu1 Th3

Ho3 Lu1

Pr1 Ho3

Zn1 Ga3

Pd1 Au3

Pr1 Sm3

Sm1 Lu3

Nd1 Y3

Nd1 Dy3

Tb1 Y3

Pr3 Er1

Nd3 Sm1

Pr1 Dy3

Cd2 Hg1

Sm1 Tm3

Sm1 Y3

Cd3 In1

Cd1 Hg2

Co1 Sn1

Zr1 Ti2

Co1 Sn2

Tl1 Cd1 Rh2

Many thanks,

–

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/2c876d9c-cc12-4b37-b230-d45659ba8b23%40googlegroups.com.