Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ea6c15a
Fix using ruff fixable linters
Ali-Tehrani Jan 10, 2024
c36d26f
Ignore rule in ruff
Ali-Tehrani Jan 10, 2024
7b6ae70
Fix remaining ruff errors
Ali-Tehrani Jan 10, 2024
c33c30c
Update pyproject so that github actions work now
Ali-Tehrani Jan 10, 2024
f3cbed6
Comment out the test that fails, ref. the issue
Ali-Tehrani Jan 11, 2024
301dd5f
Add permissions to github action for pytest-cov
Ali-Tehrani Jan 11, 2024
5dcfe5e
Fix test that wasn't asserting
Ali-Tehrani Jan 11, 2024
67c0a14
Remove coverage comment and just do coverage
Ali-Tehrani Jan 11, 2024
3e5df48
Merge branch 'master' into fix_linters
Ali-Tehrani Jan 11, 2024
f926d06
Update pre-commit so it doesn't run on websites
Ali-Tehrani Jan 11, 2024
313b71a
Update precommit to only work on gbasis and tests
Ali-Tehrani Jan 11, 2024
2be59ca
Add my own pytest-cov
Ali-Tehrani Jan 11, 2024
0db7ba0
Fix previous bad merge
Ali-Tehrani Jan 11, 2024
619a56c
Fix test error with not using factorial2
Ali-Tehrani Jan 11, 2024
3476723
Update editorconfig to remove the comment
Ali-Tehrani Jan 11, 2024
9303716
Fix black issues
Ali-Tehrani Jan 11, 2024
f73c446
Precommit only work on python files
Ali-Tehrani Jan 11, 2024
666c868
Remove trailing white-space for pre-commit
Ali-Tehrani Jan 11, 2024
1af396b
Merge branch 'master' into fix_linters
Ali-Tehrani Jan 11, 2024
93cf65c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 11, 2024
7b8269e
Add python=3.8 to teh test
Ali-Tehrani Jan 11, 2024
a36c523
Fix ruff linter complaints
Ali-Tehrani Jan 11, 2024
adf1d37
Merge branch 'master' into fix_linters
Ali-Tehrani Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EditorConfig is awesome: https://EditorConfig.org
# EditorConfig: https://EditorConfig.org

root = true

Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ on:
pull_request:

jobs:
tests:
pytest:
name: "Python ${{ matrix.py }} on OS ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
env:
COVERAGE_SINGLE: 80
COVERAGE_TOTAL: 90

strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
py: ["3.7", "3.9", "3.10", "3.11"]
py: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: "actions/checkout@v3"
Expand All @@ -36,18 +39,6 @@ jobs:
# Need editable mode in order to include the test files
pip install -e .

- name: Run pytest
uses: pavelzw/pytest-action@v2
with:
verbose: true
emoji: true
job-summary: true
click-to-expand: true
custom-arguments: "--junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=gbasis"
report-title: 'Test Report'

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
- name: Run Pytest
run: |
pytest --cov=./gbasis/ --cov-fail-under=90 --cov-report term .
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
files: "gbasis/|tests/"
exclude: "website/"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
3 changes: 2 additions & 1 deletion gbasis/base_four_symm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import abc
import itertools as it

import numpy as np

from gbasis.base import BaseGaussianRelatedArray
from gbasis.spherical import generate_transformation
import numpy as np


# pylint: disable=W0235
Expand Down
3 changes: 2 additions & 1 deletion gbasis/base_one.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Base class for arrays that depend on one contracted Gaussian."""
import abc

import numpy as np

from gbasis.base import BaseGaussianRelatedArray
from gbasis.spherical import generate_transformation
import numpy as np


# pylint: disable=W0235
Expand Down
3 changes: 2 additions & 1 deletion gbasis/base_two_asymm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Base class for arrays that depend on two contracted Gaussians."""
import abc

import numpy as np

from gbasis.base import BaseGaussianRelatedArray
from gbasis.spherical import generate_transformation
import numpy as np


# pylint: disable=W0235
Expand Down
3 changes: 2 additions & 1 deletion gbasis/base_two_symm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Base class for arrays that depend on two contracted Gaussians."""
import abc

import numpy as np

from gbasis.base import BaseGaussianRelatedArray
from gbasis.spherical import generate_transformation
import numpy as np


# pylint: disable=W0235
Expand Down
5 changes: 3 additions & 2 deletions gbasis/contractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import numpy as np
from gbasis.utils import factorial2

from gbasis.utils import factorial2


class GeneralizedContractionShell:
r"""Data class for generalized contractions.
Expand Down Expand Up @@ -496,8 +498,7 @@ def angmom_components_sph(self):

"""
return tuple(
["s{}".format(m) for m in range(self.angmom, 0, -1)]
+ ["c{}".format(m) for m in range(self.angmom + 1)]
[f"s{m}" for m in range(self.angmom, 0, -1)] + [f"c{m}" for m in range(self.angmom + 1)]
)

@property
Expand Down
11 changes: 8 additions & 3 deletions gbasis/evals/density.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Density Evaluation."""
from gbasis.evals.eval import evaluate_basis
from gbasis.evals.eval_deriv import evaluate_deriv_basis
import numpy as np
from scipy.special import comb

from gbasis.evals.eval import evaluate_basis
from gbasis.evals.eval_deriv import evaluate_deriv_basis


def evaluate_density_using_evaluated_orbs(one_density_matrix, orb_eval):
"""Return the evaluation of the density given the evaluated orbitals.
Expand Down Expand Up @@ -696,6 +697,10 @@ def evaluate_general_kinetic_energy_density(
)
if alpha != 0:
general_kinetic_energy_density += alpha * evaluate_density_laplacian(
one_density_matrix, basis, points, transform=transform, deriv_type=deriv_type
one_density_matrix,
basis,
points,
transform=transform,
deriv_type=deriv_type,
)
return general_kinetic_energy_density
3 changes: 2 additions & 1 deletion gbasis/evals/electrostatic_potential.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Module for computing electrostatic potential integrals."""
from gbasis.integrals.point_charge import point_charge_integral
import numpy as np

from gbasis.integrals.point_charge import point_charge_integral


def electrostatic_potential(
basis,
Expand Down
3 changes: 2 additions & 1 deletion gbasis/evals/eval.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Functions for evaluating Gaussian contractions."""
import numpy as np

from gbasis.base_one import BaseOneIndex
from gbasis.contractions import GeneralizedContractionShell
from gbasis.evals._deriv import _eval_deriv_contractions
import numpy as np


class Eval(BaseOneIndex):
Expand Down
9 changes: 6 additions & 3 deletions gbasis/evals/eval_deriv.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""Functions for evaluating Gaussian primitives."""
import numpy as np

from gbasis.base_one import BaseOneIndex
from gbasis.contractions import GeneralizedContractionShell
from gbasis.evals._deriv import _eval_deriv_contractions
from gbasis.evals._deriv import _eval_first_second_order_deriv_contractions
import numpy as np
from gbasis.evals._deriv import (
_eval_deriv_contractions,
_eval_first_second_order_deriv_contractions,
)


class EvalDeriv(BaseOneIndex):
Expand Down
6 changes: 4 additions & 2 deletions gbasis/evals/stress_tensor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Module for computing properties related to the stress tensor."""
import numpy as np

from gbasis.evals.density import (
evaluate_density_laplacian,
evaluate_deriv_density,
evaluate_deriv_reduced_density_matrix,
)
import numpy as np


# TODO: need to be tested against reference
Expand Down Expand Up @@ -149,7 +150,8 @@ def evaluate_ehrenfest_force(one_density_matrix, basis, points, alpha=1, beta=0,
- (1 - 2\alpha)
\sum_i
\left.
\frac{\partial^3}{\partial r_i \partial r_j \partial r'_i} \gamma(\mathbf{r}, \mathbf{r})
\frac{\partial^3}{\partial r_i \partial r_j \partial r'_i} \gamma(\mathbf{r},
\mathbf{r})
\right|_{\mathbf{r} = \mathbf{r}' = \mathbf{r}_n}\\
&+ \frac{1}{2} \beta
\left.
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/_diff_operator_int.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Integrals over differential operator involving contracted Cartesian Gaussians."""
import numpy as np

from gbasis.integrals._moment_int import (
_cleanup_intermediate_integrals,
_compute_multipole_moment_integrals_intermediate,
)
import numpy as np


# FIXME: returns nan when exponent is zero
Expand Down
1 change: 1 addition & 0 deletions gbasis/integrals/_one_elec_int.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""One-electron integrals involving Contracted Cartesian Gaussians."""
import numpy as np

from gbasis.utils import factorial2


Expand Down
1 change: 1 addition & 0 deletions gbasis/integrals/_two_elec_int.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Two-electron integrals involving Contracted Cartesian Gaussians."""
import numpy as np

from gbasis.utils import factorial2

# pylint: disable=C0103,R0914,R0915
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/angular_momentum.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Module for evaluating the integral over the angular momentum operator."""
import numpy as np

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._diff_operator_int import (
_compute_differential_operator_integrals_intermediate,
)
from gbasis.integrals._moment_int import _compute_multipole_moment_integrals_intermediate
import numpy as np


# TODO: need to test against reference
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/electron_repulsion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Electron-electron repulsion integral."""
import numpy as np

from gbasis.base_four_symm import BaseFourIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._two_elec_int import (
_compute_two_elec_integrals,
_compute_two_elec_integrals_angmom_zero,
)
from gbasis.integrals.point_charge import PointChargeIntegral
import numpy as np


class ElectronRepulsionIntegral(BaseFourIndexSymmetric):
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/kinetic_energy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Module for evaluating the kinetic energy integral."""
import numpy as np

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._diff_operator_int import _compute_differential_operator_integrals
import numpy as np


class KineticEnergyIntegral(BaseTwoIndexSymmetric):
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/moment.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Module for computing the moments of a basis set."""
import numpy as np

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._moment_int import _compute_multipole_moment_integrals
import numpy as np


class Moment(BaseTwoIndexSymmetric):
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/momentum.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Module for evaluating the integral over the momentum operator."""
import numpy as np

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._diff_operator_int import _compute_differential_operator_integrals
import numpy as np


# TODO: need to test against reference
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/nuclear_electron_attraction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Module for computing the nuclear electron attraction."""
from gbasis.integrals.point_charge import point_charge_integral
import numpy as np

from gbasis.integrals.point_charge import point_charge_integral


def nuclear_electron_attraction_integral(basis, nuclear_coords, nuclear_charges, transform=None):
"""Return the nuclear electron attraction integrals of the basis set in the Cartesian form.
Expand Down
3 changes: 2 additions & 1 deletion gbasis/integrals/overlap.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Functions for computing overlap of a basis set."""
import numpy as np

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._moment_int import _compute_multipole_moment_integrals
import numpy as np


class Overlap(BaseTwoIndexSymmetric):
Expand Down
9 changes: 6 additions & 3 deletions gbasis/integrals/point_charge.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Module for computing point charge integrals."""
import numpy as np
from scipy.special import hyp1f1 # pylint: disable=E0611

from gbasis.base_two_symm import BaseTwoIndexSymmetric
from gbasis.contractions import GeneralizedContractionShell
from gbasis.integrals._one_elec_int import _compute_one_elec_integrals
import numpy as np
from scipy.special import hyp1f1 # pylint: disable=E0611


class PointChargeIntegral(BaseTwoIndexSymmetric):
Expand Down Expand Up @@ -37,7 +38,9 @@ class PointChargeIntegral(BaseTwoIndexSymmetric):
Boys function used to evaluate the one-electron integral.
`M` is the number of orders that will be evaluated.
`K_a` and `K_b` are the number of primitives on the left and right side, respectively.
construct_array_contraction(self, contractions_one, contractions_two, points_coords, points_charge)
construct_array_contraction(self, contractions_one, contractions_two, points_coords,
**points_charge)**

Return the point charge integrals for the given `GeneralizedContractionShell` instances.
`M_1` is the number of segmented contractions with the same exponents (and angular
momentum) associated with the first index.
Expand Down
15 changes: 8 additions & 7 deletions gbasis/parsers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Parsers for reading basis set files."""
import re

from gbasis.contractions import GeneralizedContractionShell
import numpy as np

from gbasis.contractions import GeneralizedContractionShell


def parse_nwchem(nwchem_basis_file):
"""Parse nwchem basis set file.
Expand All @@ -26,7 +27,7 @@ def parse_nwchem(nwchem_basis_file):

"""
# pylint: disable=R0914
with open(nwchem_basis_file, "r") as basis_fh:
with open(nwchem_basis_file) as basis_fh:
nwchem_basis = basis_fh.read()

data = re.split(r"\n\s*(\w[\w]?)[ ]+(\w+)\s*\n", nwchem_basis)
Expand Down Expand Up @@ -176,12 +177,12 @@ def make_contractions(basis_dict, atoms, coords, coord_types, tol=1e-20, overlap
Atoms at which the contractions are centered.
coords : np.ndarray(N, 3)
Coordinates of each atom.
coord_types : {"cartesian"/"c", list/tuple of "cartesian"/"c" or "spherical"/"p", "spherical"/"p"}
coord_types: {"cartesian"/"c", list/tuple of "cartesian"/"c", "spherical"/"p", "spherical"/"p"}
Types of the coordinate system for the contractions.
If "cartesian" or "c", then all of the contractions are treated as Cartesian contractions.
If "spherical" or "p", then all of the contractions are treated as spherical contractions.
If list/tuple, then each entry must be a "cartesian" (or "c") or "spherical" (or "p") to specify the
coordinate type of each `GeneralizedContractionShell` instance.
If list/tuple, then each entry must be a "cartesian" (or "c") or "spherical" (or "p") to
specify the coordinate type of each `GeneralizedContractionShell` instance.
Default value is "spherical".
ovr : bool
Flag for performing overlap screening between contractions.
Expand Down Expand Up @@ -233,8 +234,8 @@ def make_contractions(basis_dict, atoms, coords, coord_types, tol=1e-20, overlap

if len(coord_types) != num_coord_types:
raise ValueError(
f"If coord_types is a list, it must be the same length as the total number of contractions."
f"got {len(coord_types)}"
f"If coord_types is a list, it must be the same length "
f"as the total number of contractions. got {len(coord_types)}"
)

# make shells
Expand Down
Loading