From 18a0b79e0d495c14a2517bbd8a834e477a3cc365 Mon Sep 17 00:00:00 2001 From: Michele Nottoli <michele.nottoli@gmail.com> Date: Tue, 7 Nov 2023 16:31:50 +0100 Subject: [PATCH] Documentation and lint. --- README.md | 4 ++-- gext/fitting.py | 5 +++-- gext/main.py | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9b7e3b2..e120b47 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The usage requires only four lines of code: ## Further options The behavior can be finely controlled by passing additional keyword arguments to the -`gext.Extrapolator()` constructor. **Note: many options are not yet implemented.** +`gext.Extrapolator()` constructor. **Note:** some options might be implemented in the future. This is an up to date list of available keyword options: @@ -58,6 +58,6 @@ Some options can be piped to the fitting modules. This work is based on these papers: - 1. F. Pes, È. Polack, P. Mazzeo, G. Dusson, B. Stamm, and F. Lipparini, “A Quasi Time-Reversible scheme based on density matrix extrapolation on the Grassmann manifold for Born-Oppenheimer Molecular Dynamics.” arXiv, 2023. doi: 10.48550/ARXIV.2307.05653. + 1. F. Pes, É. Polack, P. Mazzeo, G. Dusson, B. Stamm, and F. Lipparini, “A Quasi Time-Reversible Scheme Based on Density Matrix Extrapolation on the Grassmann Manifold for Born–Oppenheimer Molecular Dynamics,” The Journal of Physical Chemistry Letters, vol. 14, no. 43. American Chemical Society (ACS), pp. 9720–9726, Oct. 25, 2023. doi: 10.1021/acs.jpclett.3c02098. 2. É. Polack, G. Dusson, B. Stamm, and F. Lipparini, “Grassmann Extrapolation of Density Matrices for Born–Oppenheimer Molecular Dynamics,” Journal of Chemical Theory and Computation, vol. 17, no. 11. American Chemical Society (ACS), pp. 6965–6973, Oct. 08, 2021. doi: 10.1021/acs.jctc.1c00751. 3. É. Polack, A. Mikhalev, G. Dusson, B. Stamm, and F. Lipparini, “An approximation strategy to compute accurate initial density matrices for repeated self-consistent field calculations at different geometries,” Molecular Physics, vol. 118, no. 19–20. Informa UK Limited, p. e1779834, Jun. 22, 2020. doi: 10.1080/00268976.2020.1779834. diff --git a/gext/fitting.py b/gext/fitting.py index c726142..efd09f0 100644 --- a/gext/fitting.py +++ b/gext/fitting.py @@ -70,7 +70,7 @@ class LeastSquare(AbstractFitting): class QuasiTimeReversible(AbstractFitting): - """Quasi time reversible fitting scheme. Not yet implemented.""" + """Quasi time reversible fitting scheme.""" supported_options = { "regularization": 0.0, @@ -85,7 +85,8 @@ class QuasiTimeReversible(AbstractFitting): raise ValueError("Unsupported value for regularization") def fit(self, vectors: List[np.ndarray], target: np.ndarray): - """Time reversible least square minimization fitting.""" + """Given a set of vectors and a target return the fitting + coefficients in a quasi time reversible scheme.""" past_target = vectors[0] matrix = np.array(vectors[1:]).T diff --git a/gext/main.py b/gext/main.py index 71de73a..f1546f3 100644 --- a/gext/main.py +++ b/gext/main.py @@ -25,7 +25,8 @@ class Extrapolator: def __init__(self, nelectrons: int, nbasis: int, natoms: int, **kwargs): - if not (type(nelectrons) == int and type(nbasis) == int and type(natoms) == int): + if not (isinstance(nelectrons, int) and isinstance(nbasis, int) \ + and isinstance(natoms, int)): raise ValueError("Dimensions are not integers") self.nelectrons = nelectrons @@ -33,11 +34,13 @@ class Extrapolator: self.natoms = natoms self.set_options(**kwargs) - self.gammas = CircularBuffer(self.options["nsteps"], (self.nelectrons//2, self.nbasis)) + self.gammas = CircularBuffer(self.options["nsteps"], + (self.nelectrons//2, self.nbasis)) self.descriptors = CircularBuffer(self.options["nsteps"], ((self.natoms - 1)*self.natoms//2, )) if self.options["store_overlap"]: - self.overlaps = CircularBuffer(self.options["nsteps"], (self.nbasis, self.nbasis)) + self.overlaps = CircularBuffer(self.options["nsteps"], + (self.nbasis, self.nbasis)) self.tangent: Optional[np.ndarray] = None -- GitLab