| 1 | <p align="center"> |
| 2 | <a href="https://travis-ci.org/dgasmith/gau2grid"> |
| 3 | <img src="https://travis-ci.org/dgasmith/gau2grid.svg?branch=master" alt="Travis CI"/> |
| 4 | </a> |
| 5 | |
| 6 | <a href="https://ci.appveyor.com/project/MolSSI/gau2grid"> |
| 7 | <img src="https://ci.appveyor.com/api/projects/status/d3l5nid8a2dww8dc?svg=true" alt="Appveyor"/> |
| 8 | </a> |
| 9 | |
| 10 | <a href="https://codecov.io/gh/dgasmith/gau2grid"> |
| 11 | <img src="https://codecov.io/gh/dgasmith/gau2grid/branch/master/graph/badge.svg" alt="Codecov" /> |
| 12 | </a> |
| 13 | |
| 14 | <a href="https://anaconda.org/psi4/gau2grid"> |
| 15 | <img src="https://anaconda.org/psi4/gau2grid/badges/version.svg" /> |
| 16 | </a> |
| 17 | |
| 18 | <a href='https://gau2grid.readthedocs.io/en/latest/?badge=latest'> |
| 19 | <img src='https://readthedocs.org/projects/gau2grid/badge/?version=latest' alt='Documentation Status' /> |
| 20 | </a> |
| 21 | </p> |
| 22 | |
| 23 | # gau2grid |
| 24 | A collocation code for computing gaussians on a grid of the form: |
| 25 | ``` |
| 26 | out_Lp = x^l y^m z^n \sum_i coeff_i e^(exponent_i * (|center - p|)^2) |
| 27 | ``` |
| 28 | Where the returned matrix dimension are the angular momentum (L) by number of requested points (p). |
| 29 | |
| 30 | ```python |
| 31 | import gau2grid |
| 32 | import numpy as np |
| 33 | |
| 34 | # Build coordinates along the Z axis |
| 35 | >>> xyz = np.zeros((3, 5)) |
| 36 | >>> xyz[2] = np.arange(5) |
| 37 | |
| 38 | # Compute a 's' gaussian with a scaling and exponent of one at the origin |
| 39 | >>> ret = gau2grid.collocation(xyz, 0, [1], [1], [0, 0, 0]) |
| 40 | >>> print(ret["PHI"]) |
| 41 | [[ 1.00000e+00 3.67879e-01 1.83156e-02 1.23409e-04 1.12535e-07]] |
| 42 | |
| 43 | # Compute a 'p' gaussian with a scaling and exponent of one at the origin |
| 44 | >>> ret = gau2grid.collocation(xyz, 1, [1], [1], [0, 0, 0], spherical=False) |
| 45 | >>> print(ret["PHI"]) |
| 46 | [[ 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00] |
| 47 | [ 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00] |
| 48 | [ 0.00000e+00 3.67879e-01 3.66312e-02 3.70229e-04 4.50140e-07]] |
| 49 | |
| 50 | # Note that the X and Y components are zero as they are orthogonal to our Z vector. |
| 51 | ``` |
| 52 | |
| 53 | The returned matrix can be in either cartesian or regular solid harmonics. There are currently |
| 54 | three algorithms in which to compute these collocation matrices: |
| 55 | - Optimize C: A autogenerated C library that optimizes for cache, |
| 56 | vectorization, and sparsity. Fastest, requires compilation, found at |
| 57 | `gau2grid.collocation`. |
| 58 | - Optimized/Generated NumPy: A exploratory tool to |
| 59 | examine the sparsity in the gaussians. No compilation required, found at |
| 60 | `gau2grid.np_gen.collocation`. |
| 61 | - NumPy Reference: A simple NumPy-based loop |
| 62 | code. No compilation required, found at `gau2grid.ref.collocation`. |
| 63 | |
| 64 | See the [documentation](https://gau2grid.readthedocs.io/en/latest/?badge=latest) for more information! |
| 65 | |
| 66 | ## Building Gau2Grid |
| 67 | The C library is built with CMake and has C no required dependancies other than |
| 68 | the standard library. A CMake and build example can found below: |
| 69 | |
| 70 | ```bash |
| 71 | cmake -H. -Bobjdir |
| 72 | cd objdir; make -j2 |
| 73 | ``` |
| 74 | |
| 75 | Several common CMake options are as follow: |
| 76 | - `-DPYTHON_EXECUTABLE` - Path to the desired Python executable |
| 77 | - `-DMAX_AM` - Maximum angular momentum to compile to, default 6 |
| 78 | - `-DCMAKE_INSTALL_PREFIX` - Installation directory |
| 79 | |
| 80 | ## Python installation |
| 81 | The gau2grid program (without the optimized C library) can be installed using |
| 82 | the canonical `setup.py` script, |
| 83 | ``` |
| 84 | python setup.py install |
| 85 | ``` |
| 86 | |
| 87 | # Authors |
| 88 | This code was inspired by a number of folks and quite a few provided excellent advice. |
| 89 | |
| 90 | - Daniel G. A. Smith - Code author |
| 91 | - Rob M. Parrish - Author of the Psi4 section which contains the original equations |
| 92 | - Lori A. Burns - CMake, building, and library linking |
| 93 | - Andy C. Simmonett - RSH coefficients |
| 94 | - Ben Pritchard - Generator and vectorization recommendations |
| 95 |