Skip to content

Commit

Permalink
mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist committed Mar 7, 2024
1 parent 6acf418 commit f2b01f4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pymolresponse/cphf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Driver for solving the coupled perturbed Hartree-Fock (CPHF) equations."""

from abc import ABC, abstractmethod
from typing import Optional, Sequence
from typing import List, Optional, Sequence

import numpy as np

Expand All @@ -16,7 +16,7 @@ def __init__(self, solver: Solver) -> None:
assert isinstance(solver, Solver)
self.solver = solver

self.results = []
self.results: List[np.ndarray] = []

@abstractmethod
def run(self, hamiltonian: Hamiltonian, spin: Spin, program: Program, program_obj) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pymolresponse/integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _form_rhs_geometric(C: np.ndarray, occupations, natoms, MO, mints):

if __name__ == "__main__":
dalton_integrals = parse_aoproper("r_lih_hf_sto-3g/dalton_response_rpa_singlet/AOPROPER")
from pymolresponse.utils import dalton_label_to_operator
from pymolresponse.interfaces.dalton.utils import dalton_label_to_operator

labels = dalton_integrals.keys()
for label in labels:
Expand Down
2 changes: 1 addition & 1 deletion pymolresponse/td.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def form_results(self) -> None:

def print_results(self) -> None:
energies = self.solver.eigvals.real
for idx in len(energies):
for idx in range(len(energies)):
print("=" * 78)
print(f" State: {idx + 1}")
print(f" Excitation energy [a.u.]: {energies[idx]}")
Expand Down
3 changes: 1 addition & 2 deletions pymolresponse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from itertools import accumulate
from pathlib import Path
from sys import exit
from typing import List, Tuple, Union

import numpy as np
Expand Down Expand Up @@ -350,7 +349,7 @@ def flip_triangle_sign(A: np.ndarray, triangle: str = "lower") -> np.ndarray:
elif triangle == "upper":
indices = np.triu_indices(dim)
else:
exit(1)
raise ValueError("argument to triangle must be 'upper' or 'lower'")
B = A.copy()
B[indices] *= -1.0
return B
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ warn_unused_configs = true

[[tool.mypy.overrides]]
module = [
"periodictable",
"psi4",
"pyscf",
"scipy",
Expand Down

0 comments on commit f2b01f4

Please sign in to comment.