GithubHelp home page GithubHelp logo

takafumi-shiraogawa / simpleqc Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 65 KB

Simple code for quantum chemistry

License: MIT License

Python 95.90% Shell 0.57% Fortran 3.53%
hartree-fock quantum-chemistry mp2 cis ksdft dft

simpleqc's Introduction

SimpleQC

A simple code of electronic structure theories for developing new methodologies and educational purposes.

Feature

This code can be applied to generic molecules and basis sets thanks to the Psi4's atomic orbital (AO) integral modules. For the simplicity, we tried redundant coding.

In the current version, restricted and unrestricted Hartree-Fock theory calculations for arbitrary spin states and molecular charges can be performed. Ground-state total energy, electronic energy, nuclei-repulsion energy, molecular orbital (MO) energies and coefficients, analytical integrals for Hartree-Fock theory, density matrix (in AO basis), and Mulliken atomic charges are available.

For the post-Hartree-Fock methods, configuration interaction singles (CIS) theory for excited-state calculations and second-order Møller-Plesset perturbation theory (MP2) are also implemented. They can be only applied to spin singlet states.

The Kohn-Sham density functional theory (KS-DFT) calculations can be performed with the local density approximation (LDA) functional for the exchange(-correlation) potential and energy. The correlation part is neglected. Only the closed-shell systems can be calculated. The other functionals are not implemented.

As an example of effective models at quantum chemistry level of theory, the electronic Coulomb interaction energy between two molecules can be calculated based on the Hartree-Fock theory.

Requirements

Psi4: for AO integral and for generating numerical grids and weights
Basis_Set_Exchange: for processing molecular parameters and basis sets

Contributors

Takafumi Shiraogawa (@takafumi-shiraogawa)
Kai Oshiro (@Kai-Oshiro)

Inputs

sqc.conf: Configuration file of SimpleQC
*.xyz: XYZ file of a molecular geometry

simpleqc's People

Contributors

kai-oshiro avatar takafumi-shiraogawa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

simpleqc's Issues

Löwdin charge analysis

Löwdin charge analysis is described in Szabo (in English) p.152. Its implementation makes you fully understand the algorithm and code of Hartree-Fock theory.

Two approaches for the implementation are described below for the closed shell calculations (self._spin_multiplicity == 1). They can be implemented only by modifying hf_ksdft.py. Hereafter, AO and MO indicate atomic orbitals (or basis functions) and molecular orbitals. P is the density matrix in nonorthogonal AO basis (the dimension is (num_AO, num_AO) where num_AO is the number of atomic orbitals). S is the AO overlap matrix in nonorthogonal AO basis (the dimension is (num_AO, num_AO)). For the orthogonal and nonorthogonal AO basis, please check pp.142-145 in Szabo.
For the code development; (1) Make a new branch by, e.g., "git branch lowdin_charge" in master branch, (2) Do code development at the new branch, (3) Do git commit of the developed code, (4) Do git push, (5) Do pull request in the GitHub webpage.

  1. Redundant procedure based on Eq. (3.201) in Szabo p.152, but good for learning
  • Calculate S^(1/2). The procedure is identical to the one required in the calculation of S^(-1/2) (orthogonalizer in hf_ksdft.py) in SCF. This is done at lines 122-124, 131-137 of hf_ksdft.py. Please see Szabo p.143 (and pp.22-23 for the mathematical understanding).
  • Calculate (S^(1/2))P(S^(1/2)) in Eq. 3.201 in Szabo p.152. The code may be "np.einsum('ab,cd,ef->af', S^(1/2), density_matrix_in_ao_basis, S^(1/2))" or "np.matmul(np.matmul(S^(1/2), density_matrix_in_ao_basis), S^(1/2))".
  • To calculate the right-hand term of Eq. 3.201 in Szabo p.152, the diagonal elements of (S^(1/2))P(S^(1/2)) should be summed up into each atom. The affiliation of AOs for atoms is given in ao_atomic_affiliation (line 286 in hf_ksdft.py). If you realize the similarity between this term and the equation of the Mulliken charge (Eq. 3.196 in Szabo p.151), this task is easily done by a small modification of the function calc_mulliken_atomic_charges at line 285 of hf_ksdft.py.
  1. Efficient Procedure based on Eq. (3.198) in Szabo p.152
    According to the statement in Szabo p.152, the diagonal elements of the density matrix in the orthogonal basis (P') correspond to the Löwdin charges.
  • Save MO coefficients in the orthogonal AO basis before line 257 of hf_ksdft.py.
  • By using the obtained MO coefficients, the density matrix in the orthogonal basis can be calculated: the code can be density_matrix_in_orthogonal_ao_basis = driver.calc_density_matrix_in_ao_basis(self, mo_coefficients_in_orthogonal_ao_basis) following Eq. (3.144) in Szabo p.139.
  • We need to distinguish the diagonal elements of the obtained density_matrix_in_orthogonal_ao_basis in the (num_AO, num_AO) size into each atom, and then they should be summed up into each atom. Please refer to the third task in the above approach.

Please check the result by comparing with the Gaussian's result with IOp(6/80=1) keyword for the Löwdin charge analysis. Note that because of the symmetry N2 has 0 charges. H2O has finite charges and could be a good test system.

Please also challenge the Löwdin charge analysis for the unrestricted calculations (self._spin_multiplicity != 1).

Calculation of exchange-correlation potential and energy

Implementation of numerical integration for the exchange-correlation potential and energy is required to complete KS-DFT. Psi4's VBase will be helpful for this problem. I am working on a branch "ksdft". The implementation of LDA exchange functional is a good starting point, I think.

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.