Giter VIP home page Giter VIP logo

bfit's Introduction

BFit

GPLv3 License Binder

BFit is a python program that is used to fit a convex sum of positive basis functions to any probability distribution.

Primarily intended for quantum chemistry community, where the basis functions are Gaussian functions and the fitted probability distribution is the electron density.

Features

The features of this software are:

  • Gaussian Basis sets:

    • Handle S-type and P-type Gaussian functions.
    • Handle Atomic Densities or Molecular Densities.
    • Handle any dimensions.
  • Fitting Measures:

    • Least-squares method,
    • Kullback-Leibler method.
  • Optimization Procedures

    • Optimize using "scipy.minimize" procedures.
    • Optimize Kullback-Leibler using self-consistent iterative method see paper.
  • Construct Slater atomic densities, including anions, cations and heavy elements, see data page.

Dependences

Installation

In your terminal run:

git clone https://github.com/QuantumElephant/fitting.git
python ./setup.py install

Run tests to see if it's installed properly:

pytest -v fitting

Example

There are four steps to using BFit.

1. Specify the Grid Object.

The grid is a uniform one-dimension grid with 100 points from 0. to 50.

from bfit.grid import UniformRadialGrid
grid = UniformRadialGrid(num_pts=100, min_radii=0., max_radii=50.)

See grid.py, for different assortment of grids.

2. Specify the Model Object.

Here, the model distribution is 5 S-type, normalized Gaussian functions with center at the origin.

from bfit.model import AtomicGaussianDensity
model = AtomicGaussianDensity(grid.points, num_s=5, num_p=0, normalize=True)

See model.py for more options of Gaussian models.

3. Specify error measure.

The algorithm is fitted based on the paper.

from bfit.fit import KLDivergenceSCF

# What you want fitted to should also be defined on `grid.points`.
density = np.array([...]) 
fit = KLDivergenceSCF(grid, density, model)

See fit.py for options of fitting algorithms.

4. Run it.

# Provide Initial Guesses
c0 = np.array([1., 1., 1., 1.])
e0 = np.array([0.001, 0.1, 1., 5., 100.])

# Optimize both coefficients and exponents.
result = fit.run(c0, e0, opt_coeffs=True, opt_expons=True, maxiter=1000)

print("Optimized coefficients are: ", result["x"][0])
print("Optimized exponents are: ", result["x"][1])
print("Final performance measures are: ", result["performance"][-1])
print("Was it successful? ", result["success"])

See the example directory for more examples.

Citation

Please cite the following. TODO: Update PAPER

Alireza Tehrani, Farnaz Heidar-Zadeh, James S.M. Anderson, Toon Verstraelen, Rogelio Cuevas-Saavedra, Ivan Vinogradov, Debajit Chakraborty, Paul W. Ayers. "BFit: Information-Theoretic Approach to Basis-Set Fitting of Electron Densities"

FAQ

Where did you get the slater coefficients from?

Please see Data Readme in the data folder.

bfit's People

Contributors

ali-tehrani avatar farnazh avatar farnazhz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.