From dbc23716d891a39935334c21a52d5c5b02312e17 Mon Sep 17 00:00:00 2001 From: "Kevin J. Sung" Date: Sat, 15 Jun 2024 00:11:42 -0500 Subject: [PATCH] rename arg and add type annotation --- python/ffsim/hamiltonians/molecular_hamiltonian.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/ffsim/hamiltonians/molecular_hamiltonian.py b/python/ffsim/hamiltonians/molecular_hamiltonian.py index 10386aa3a..363f5e059 100644 --- a/python/ffsim/hamiltonians/molecular_hamiltonian.py +++ b/python/ffsim/hamiltonians/molecular_hamiltonian.py @@ -12,6 +12,7 @@ import dataclasses import itertools +import os import numpy as np import pyscf.ao2mo @@ -53,13 +54,13 @@ class MolecularHamiltonian: constant: float = 0.0 @staticmethod - def from_fcidump(filename) -> MolecularHamiltonian: + def from_fcidump(file: str | bytes | os.PathLike) -> MolecularHamiltonian: """Initialize a MolecularHamiltonian from an FCIDUMP file. Args: - filename: The FCIDUMP file name or path. + file: The FCIDUMP file path. """ - data = pyscf.tools.fcidump.read(filename, verbose=False) + data = pyscf.tools.fcidump.read(file, verbose=False) return MolecularHamiltonian( one_body_tensor=data["H1"], two_body_tensor=pyscf.ao2mo.restore(1, data["H2"], data["NORB"]),