Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
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
7 changes: 4 additions & 3 deletions gbasis/contractions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Data class for contractions of Gaussian-type primitives."""
from gbasis.utils import factorial2
import numpy as np

from gbasis.utils import factorial2


class GeneralizedContractionShell:
r"""Data class for generalized contractions.
Expand Down Expand Up @@ -384,8 +385,8 @@ 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
5 changes: 3 additions & 2 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
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
3 changes: 2 additions & 1 deletion gbasis/evals/eval_deriv.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""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
import numpy as np


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 @@ -163,7 +164,8 @@ def evaluate_ehrenfest_force(
- (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, coord_type="spherical"
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
7 changes: 4 additions & 3 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 @@ -97,7 +98,7 @@ def parse_gbs(gbs_basis_file):

"""
# pylint: disable=R0914
with open(gbs_basis_file, "r") as basis_fh:
with open(gbs_basis_file) as basis_fh:
gbs_basis = basis_fh.read()
# splits file into 'element', 'basis stuff', 'element',' basis stuff'
# e.g., ['H','stuff with exponents & coefficients\n', 'C', 'stuff with etc\n']
Expand Down
11 changes: 7 additions & 4 deletions gbasis/spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
from scipy.special import comb, factorial

from gbasis.utils import factorial2


Expand Down Expand Up @@ -45,7 +46,8 @@ def expansion_coeff(angmom, mag, i, j, k):
C^{angmom,mag,i,j,k} = -1^{i + k - \text{shift_factor}} * (1/4)^i * {angmom \choose i}
* {(angmom - i) \choose (|mag| + i)} * {i \choose j} * {|mag| \choose 2 * k},

where :math:`shift_factor = 0` if :math:`mag >= 0` and :math:`shift_factor = 1/2` if :math:`mag < 0` .
where :math:`shift_factor = 0` if :math:`mag >= 0` and :math:`shift_factor = 1/2`
if :math:`mag < 0`.

Parameters
----------
Expand Down Expand Up @@ -122,7 +124,8 @@ def harmonic_norm(angmom, mag):
Calculate the normalization constant of a real solid harmonic.

.. math::
N^S_{angmom,m} = 1/(2^{|m|} * angmom!) * \sqrt{2 * (angmom + |{m}|)! * (angmom - |{m}|)! / 2^{\delta_0^m}},
N^S_{angmom,m} = 1/(2^{|m|} * angmom!) * \sqrt{2 * (angmom + |{m}|)! * (angmom - |{m}|)! /
2^{\delta_0^m}},

where :math: `del{0, m}` is the Kronecker delta of 0 and m.

Expand Down Expand Up @@ -301,8 +304,8 @@ def generate_transformation(angmom, cartesian_order, spherical_order, apply_from
# Strip out "-" from the ordering to make sure the right components are there
and {x.replace("-", "") for x in spherical_order}
== set(
["s{}".format(m) for m in range(angmom, 0, -1)]
+ ["c{}".format(m) for m in range(angmom + 1)]
[f"s{m}" for m in range(angmom, 0, -1)]
+ [f"c{m}" for m in range(angmom + 1)]
)
):
raise ValueError(
Expand Down
7 changes: 4 additions & 3 deletions gbasis/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Module for interfacing to other quantum chemistry packages."""
from gbasis.contractions import GeneralizedContractionShell
import numpy as np

from gbasis.contractions import GeneralizedContractionShell


def from_iodata(mol):
"""Return basis set stored within the `IOData` instance in `iodata`.
Expand Down Expand Up @@ -115,15 +116,15 @@ def angmom_components_sph(self):
if self.angmom not in sph_conventions:
raise ValueError(
"Given convention does not support spherical contractions for the angular "
"momentum {0}".format(self.angmom)
f"momentum {self.angmom}"
)

return tuple(sph_conventions[self.angmom])

if molbasis.primitive_normalization != "L2": # pragma: no cover
raise ValueError(
"Only L2 normalization scheme is supported in `gbasis`. Given `IOData` instance uses "
"primitive normalization scheme, {}".format(molbasis.primitive_normalization)
f"primitive normalization scheme, {molbasis.primitive_normalization}"
)

basis = []
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ dependencies = [
]
dynamic = ["version"]

[tool.setuptools.packages.find]
where = ["."] # list of folders that contain the packages (["."] by default)
include = ["gbasis"] # package names should match these glob patterns (["*"] by default)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically this line should pass the initial setup of the package that will run action for building and updating website later


[project.urls]
Documentation = "https://gbasis.qcdevs.org"
Issues = "https://github.com/theochem/gbasis/issues"
Expand Down Expand Up @@ -76,7 +80,7 @@ line-length = 100
# RUF is Ruff-specific rules
select = ["E", "F", "UP", "B", "I", "PGH", "PL", "RUF"]
line-length = 100
ignore = ["PLR2004", "PLR0913", "PLR0912", "PLW2901", "PLR0915", "RUF013"]
ignore = ["PLR2004", "PLR0913", "PLR0912", "PLW2901", "PLR0915", "RUF013", "E741"]
extend-exclude = ["doc/*", "doc/*/*"]

[tool.pytest.ini_options]
Expand Down
Loading