MineralsCloud / qha

A Python package for calculating thermodynamic properties under quasi-harmonic approximation, using data from ab-initio calculations
https://mineralscloud.github.io/qha/
GNU General Public License v3.0
27 stars 13 forks source link

Dependency on `bigfloat` package #47

Closed chazeon closed 5 years ago

chazeon commented 6 years ago

The package bigfloat is the high precision arithmetic used by the Helmholtz free energy part of the calculator to do exponential and logarithm calculation. It is not actively maintained and supports Python 3.5 and 3.6 to date. This outdated package could limit the possibility for our code to be port to Python 3.7 or later versions. As Python 3.7 has its official release, as is mentioned in #46, this could be an issue. So I'm thinking of finding alternatives.

Another package gmpy is more actively developed and maintained, and is marked as a superseder in the Unofficial Windows Binaries for Python Extension Packages page, could be the option.

Yet do we actually need the precision, as is indicated in the code, 500 for our calculator? Just for log and exp? Maybe numpy's float64 is just good enough for the job. Even our unit conversion code could not maintain such high a precision as that.

We should test the outcome of using more convenient ways; and we could maybe give options for drivers and list them as “extra” dependencies for the package, like the Beautiful Soup 4 package does?

singularitti commented 6 years ago

Yet do we actually need the precision, as is indicated in the code, 500 for our calculator? Just for log and exp? Maybe numpy's float64 is just good enough for the job. Even our unit conversion code could not maintain such high a precision as that.

Probably we have to use more precision, since we are calculating partition functions, which are usually astronomical figures. You can see the calculated free energies, which are usually large, then a np.exp will make it explode or vanish (for negative energy). float64 is not satisfactory.

singularitti commented 5 years ago

Merged.