From a283e0c3ec0bc6ce7187aa7bebe541615f32daa3 Mon Sep 17 00:00:00 2001 From: Michele Nottoli <michele.nottoli@gmail.com> Date: Tue, 24 Oct 2023 17:25:37 +0200 Subject: [PATCH] Renamed to gext. --- .gitlab-ci.yml | 4 ++-- README.md | 14 +++++++------- {grext => gext}/__init__.py | 2 +- {grext => gext}/buffer.py | 0 {grext => gext}/descriptors.py | 0 {grext => gext}/fitting.py | 0 {grext => gext}/grassmann.py | 0 {grext => gext}/main.py | 0 setup.py | 2 +- tests/test_buffer.py | 2 +- tests/test_descriptor_fitting.py | 18 +++++++++--------- tests/test_extrapolation.py | 6 +++--- tests/test_grassmann.py | 8 ++++---- 13 files changed, 28 insertions(+), 28 deletions(-) rename {grext => gext}/__init__.py (56%) rename {grext => gext}/buffer.py (100%) rename {grext => gext}/descriptors.py (100%) rename {grext => gext}/fitting.py (100%) rename {grext => gext}/grassmann.py (100%) rename {grext => gext}/main.py (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b1a74a..98f56a2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: variables: PYLINT_CMD: > - (pylint grext --exit-zero > pylint.out) || true + (pylint gext --exit-zero > pylint.out) || true PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" default: @@ -35,7 +35,7 @@ lint: stage: lint script: - mkdir -p ./public - - pylint grext --exit-zero | tee pylint.out + - pylint gext --exit-zero | tee pylint.out - score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.out) - echo "Pylint score was $score" - anybadge --value=$score --file=public/pylint_badge.svg pylint diff --git a/README.md b/README.md index 77532e9..67fb2ae 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ - - - + + + -# grext: Grassmann Extrapolation Library +# gext: Grassmann Extrapolation Library This library define an `Extrapolator` class to be used for providing guesses in QM simulations. It is designed in such a way that requires minimum modifications on the QM code side. @@ -15,10 +15,10 @@ The library can be installed using `pip`: ## Usage The usage requires only four lines of code: - - Add an import statement `import grext`. + - Add an import statement `import gext`. - Initialize a new extrapolator by inserting the line: - `extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms)`. + `extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms)`. **Note:** the extrapolator can be finely controlled by passing additional keyword arguments. This is explained in the next section. - When a new SCF calculation has been performed, load the resulting data in the extrapolator by running: @@ -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 -`grext.Extrapolator()` constructor. **Note: many options are not yet implemented.** +`gext.Extrapolator()` constructor. **Note: many options are not yet implemented.** This is an up to date list of available keyword options: diff --git a/grext/__init__.py b/gext/__init__.py similarity index 56% rename from grext/__init__.py rename to gext/__init__.py index 06beea2..c0b8298 100644 --- a/grext/__init__.py +++ b/gext/__init__.py @@ -1,4 +1,4 @@ -"""The package grext provides tools for generating new guesses for the +"""The package gext provides tools for generating new guesses for the self consistent field in molecular dynamics simulations.""" from .main import Extrapolator diff --git a/grext/buffer.py b/gext/buffer.py similarity index 100% rename from grext/buffer.py rename to gext/buffer.py diff --git a/grext/descriptors.py b/gext/descriptors.py similarity index 100% rename from grext/descriptors.py rename to gext/descriptors.py diff --git a/grext/fitting.py b/gext/fitting.py similarity index 100% rename from grext/fitting.py rename to gext/fitting.py diff --git a/grext/grassmann.py b/gext/grassmann.py similarity index 100% rename from grext/grassmann.py rename to gext/grassmann.py diff --git a/grext/main.py b/gext/main.py similarity index 100% rename from grext/main.py rename to gext/main.py diff --git a/setup.py b/setup.py index 718abde..aa7212a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup( - name="grext", + name="gext", version="0.5.0", packages=find_packages(), install_requires=["numpy", "scipy"], diff --git a/tests/test_buffer.py b/tests/test_buffer.py index 659c5bd..81f495d 100644 --- a/tests/test_buffer.py +++ b/tests/test_buffer.py @@ -4,7 +4,7 @@ import sys import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -from grext.buffer import CircularBuffer +from gext.buffer import CircularBuffer def test_buffer(): diff --git a/tests/test_descriptor_fitting.py b/tests/test_descriptor_fitting.py index c673bce..e7d84b3 100644 --- a/tests/test_descriptor_fitting.py +++ b/tests/test_descriptor_fitting.py @@ -4,10 +4,10 @@ import sys import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import grext -import grext.descriptors -import grext.fitting -import grext.grassmann +import gext +import gext.descriptors +import gext.fitting +import gext.grassmann import utils SMALL = 1e-10 @@ -23,7 +23,7 @@ def test_descriptor_fitting(datafile): nframes = data["trajectory"].shape[0] # initialize an extrapolator - extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms, nframes) + extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms, nframes) # load data in the extrapolator for (coords, coeff, overlap) in zip(data["trajectory"], @@ -37,8 +37,8 @@ def test_descriptor_fitting(datafile): for start in range(0, 9): vectors = descriptors[start:-1] - fit_coefficients = grext.fitting.linear(vectors, target) - fitted_target = grext.fitting.linear_combination(vectors, fit_coefficients) + fit_coefficients = gext.fitting.linear(vectors, target) + fitted_target = gext.fitting.linear_combination(vectors, fit_coefficients) errors.append(np.linalg.norm(target - fitted_target, ord=np.inf)) assert errors[0] < errors[-1] @@ -47,7 +47,7 @@ def test_descriptor_fitting(datafile): # used for the fitting vectors = descriptors[:-1] vectors[0] = target - fit_coefficients = grext.fitting.linear(vectors, target) - fitted_target = grext.fitting.linear_combination(vectors, fit_coefficients) + fit_coefficients = gext.fitting.linear(vectors, target) + fitted_target = gext.fitting.linear_combination(vectors, fit_coefficients) assert np.linalg.norm(target - fitted_target, ord=np.inf) < SMALL diff --git a/tests/test_extrapolation.py b/tests/test_extrapolation.py index 5fcb992..69914ef 100644 --- a/tests/test_extrapolation.py +++ b/tests/test_extrapolation.py @@ -4,8 +4,8 @@ import sys import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import grext -import grext.grassmann +import gext +import gext.grassmann import utils SMALL = 1e-10 @@ -26,7 +26,7 @@ def test_extrapolation(datafile): assert n < nframes # initialize an extrapolator - extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms, n) + extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms, n) # load data in the extrapolator up to index n - 1 for (coords, coeff, overlap) in zip(data["trajectory"][:n], diff --git a/tests/test_grassmann.py b/tests/test_grassmann.py index 1602bff..04d3fb9 100644 --- a/tests/test_grassmann.py +++ b/tests/test_grassmann.py @@ -4,8 +4,8 @@ import sys import numpy as np sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import grext -import grext.grassmann +import gext +import gext.grassmann import utils SMALL = 1e-10 @@ -21,7 +21,7 @@ def test_grassmann(datafile): nframes = data["trajectory"].shape[0] # initialize an extrapolator - extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms, nframes) + extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms, nframes) # load data in the extrapolator for (coords, coeff, overlap) in zip(data["trajectory"], @@ -44,7 +44,7 @@ def test_grassmann(datafile): assert np.trace(d) - nelectrons < SMALL # compute the density from the inverse Grassmann map: Exp(Log(D)) - coeff_1 = grext.grassmann.exp(gamma, c0) + coeff_1 = gext.grassmann.exp(gamma, c0) d_1 = coeff_1 @ coeff_1.T # standard check on the second density -- GitLab