Skip to main content

A free, open-source python package for computing Fermi-Dirac integrals.

Project description

Fermi-Dirac Integrals (FDINT)

FDINT is a free, open-source python package that provides fast, double precision (64-bit floating point) approximations to the Fermi-Dirac integrals of integer and half integer order, based on the work by Prof. Fukushima [1].

The source code and documentation (coming soon) are graciously hosted by GitHub.

Installation

In order to use FDINT, you must having a working Python distribution installed. Python 3 support has not yet been tested, so Python 2.7 is suggested. In order to achieve the highest performance, a Fortran 90 compiler, such as gfortran, is required.

From PyPi

This is the easiest method. Install from PyPi by running the following command:

pip install fdint

From Github

First, you will need to install the following prerequisite packages:

Additional functionality is provided by the following optional packages:

Once these are installed, download the latest release .zip or .tar.gz source package from the github page, extract its contents, and run python setup.py install from within the extracted directory.

Testing

Once installed, you can test the package by running the following command:

python -m fdint.tests

If you have Matplotlib installed, you can also plot a sample of the available functions by running the following command:

python -m fdint

Tutorial

First, start up an interactive python shell from the command line:

$ python

Next, import everything from the fdint package:

>>> from fdint import *

If you see the following warning, then the Fortran library failed to compile and/or install:

WARNING: Unable to import fortran module. Falling back to the slower python
module.

The same functionality is provided by the fall-back python module, but the python module is considerably slower. Either way, now you can access the Fermi-Dirac integral, fdk, and the derivative, dfdk, convenience functions:

>>> fdk(k=0.5,phi=-10)
4.0233994366893939e-05
>>> fdk(0.5,-10)
4.0233994366893939e-05
>>> fdk(k=0.5,phi=5)
7.837976057293096
>>> fdk(k=0.5,phi=50)
235.81861512588432
>>> dfdk(k=0.5,phi=-10,d=1)
4.0233348580568672e-05
>>> dfdk(k=0.5,phi=5,d=1)
2.1916282173557855
>>> dfdk(k=0.5,phi=50,d=1)
7.0699026455055112
>>> dfdk(k=0.5,phi=50,d=2)
0.07074571454521902

If you request an order or derivative that is not implemented, a NotImplementedError is raised:

>>> fdk(22,0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fdint/fdint.py", line 68, in fdk
    raise NotImplementedError()
NotImplementedError
>>> dfdk(k=0.5,phi=50,d=10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fdint/fdint.py", line 99, in dfdk
    raise NotImplementedError()
NotImplementedError

If you prefer to call the low-level functions directly, you can access them from the _fd module:

>>> _fd.fd1h(-10)
4.0233994366893939e-05

Documentation

The documentation (coming soon) is graciously hosted by GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fdint-1.0.tar.gz (78.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fdint-1.0.macosx-10.9-x86_64.tar.gz (122.3 kB view details)

Uploaded Source

File details

Details for the file fdint-1.0.tar.gz.

File metadata

  • Download URL: fdint-1.0.tar.gz
  • Upload date:
  • Size: 78.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fdint-1.0.tar.gz
Algorithm Hash digest
SHA256 c10f8e28756eb17188053066c14aeb1a0c719ebb07ce107c83e466ee286c6b4b
MD5 9109e661919dd5184ce5db2de07eba27
BLAKE2b-256 16a1ae76d0e5af6ad03c787d3603a7b9a392ecc1e60bb24b346ca0207edd0b7d

See more details on using hashes here.

File details

Details for the file fdint-1.0.macosx-10.9-x86_64.tar.gz.

File metadata

File hashes

Hashes for fdint-1.0.macosx-10.9-x86_64.tar.gz
Algorithm Hash digest
SHA256 a5f2daf23cc0116de13e26539875fd0a8707e4e8e53d69f9e3287f380320fdb5
MD5 f8b9d32f2dd4a410b5e80fef04614cf0
BLAKE2b-256 ef8d0cf869bd2ad1e3fbd839a9cac6827434574ae387342cdb9f30ddc90147ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page