Skip to content
Snippets Groups Projects
Commit 55c3f32b authored by Michele Nottoli's avatar Michele Nottoli
Browse files

Merge branch 'rename' into 'main'

Renamed to gext.

See merge request !3
parents 93887ac1 a283e0c3
Branches
Tags
1 merge request!3Renamed to gext.
Pipeline #1946 passed
...@@ -5,7 +5,7 @@ stages: ...@@ -5,7 +5,7 @@ stages:
variables: variables:
PYLINT_CMD: > PYLINT_CMD: >
(pylint grext --exit-zero > pylint.out) || true (pylint gext --exit-zero > pylint.out) || true
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
default: default:
...@@ -35,7 +35,7 @@ lint: ...@@ -35,7 +35,7 @@ lint:
stage: lint stage: lint
script: script:
- mkdir -p ./public - 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) - score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.out)
- echo "Pylint score was $score" - echo "Pylint score was $score"
- anybadge --value=$score --file=public/pylint_badge.svg pylint - anybadge --value=$score --file=public/pylint_badge.svg pylint
......
![CI_Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/grext/badges/main/pipeline.svg) ![CI_Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/gext/badges/main/pipeline.svg)
![Pylint Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/grext/-/jobs/artifacts/main/raw/public/pylint_badge.svg?job=lint) ![Pylint Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/gext/-/jobs/artifacts/main/raw/public/pylint_badge.svg?job=lint)
![Coverage Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/grext/-/jobs/artifacts/main/raw/public/coverage.svg?job=coverage) ![Coverage Badge](https://gitlab.mathematik.uni-stuttgart.de/nottolme/gext/-/jobs/artifacts/main/raw/public/coverage.svg?job=coverage)
# 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. 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`: ...@@ -15,10 +15,10 @@ The library can be installed using `pip`:
## Usage ## Usage
The usage requires only four lines of code: 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: - 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. **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: - 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: ...@@ -39,7 +39,7 @@ The usage requires only four lines of code:
## Further options ## Further options
The behavior can be finely controlled by passing additional keyword arguments to the 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: This is an up to date list of available keyword options:
......
"""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.""" self consistent field in molecular dynamics simulations."""
from .main import Extrapolator from .main import Extrapolator
File moved
File moved
File moved
File moved
File moved
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup( setup(
name="grext", name="gext",
version="0.5.0", version="0.5.0",
packages=find_packages(), packages=find_packages(),
install_requires=["numpy", "scipy"], install_requires=["numpy", "scipy"],
......
...@@ -4,7 +4,7 @@ import sys ...@@ -4,7 +4,7 @@ import sys
import numpy as np import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) 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(): def test_buffer():
......
...@@ -4,10 +4,10 @@ import sys ...@@ -4,10 +4,10 @@ import sys
import numpy as np import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import grext import gext
import grext.descriptors import gext.descriptors
import grext.fitting import gext.fitting
import grext.grassmann import gext.grassmann
import utils import utils
SMALL = 1e-10 SMALL = 1e-10
...@@ -23,7 +23,7 @@ def test_descriptor_fitting(datafile): ...@@ -23,7 +23,7 @@ def test_descriptor_fitting(datafile):
nframes = data["trajectory"].shape[0] nframes = data["trajectory"].shape[0]
# initialize an extrapolator # initialize an extrapolator
extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms, nframes) extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms, nframes)
# load data in the extrapolator # load data in the extrapolator
for (coords, coeff, overlap) in zip(data["trajectory"], for (coords, coeff, overlap) in zip(data["trajectory"],
...@@ -37,8 +37,8 @@ def test_descriptor_fitting(datafile): ...@@ -37,8 +37,8 @@ def test_descriptor_fitting(datafile):
for start in range(0, 9): for start in range(0, 9):
vectors = descriptors[start:-1] vectors = descriptors[start:-1]
fit_coefficients = grext.fitting.linear(vectors, target) fit_coefficients = gext.fitting.linear(vectors, target)
fitted_target = grext.fitting.linear_combination(vectors, fit_coefficients) fitted_target = gext.fitting.linear_combination(vectors, fit_coefficients)
errors.append(np.linalg.norm(target - fitted_target, ord=np.inf)) errors.append(np.linalg.norm(target - fitted_target, ord=np.inf))
assert errors[0] < errors[-1] assert errors[0] < errors[-1]
...@@ -47,7 +47,7 @@ def test_descriptor_fitting(datafile): ...@@ -47,7 +47,7 @@ def test_descriptor_fitting(datafile):
# used for the fitting # used for the fitting
vectors = descriptors[:-1] vectors = descriptors[:-1]
vectors[0] = target vectors[0] = target
fit_coefficients = grext.fitting.linear(vectors, target) fit_coefficients = gext.fitting.linear(vectors, target)
fitted_target = grext.fitting.linear_combination(vectors, fit_coefficients) fitted_target = gext.fitting.linear_combination(vectors, fit_coefficients)
assert np.linalg.norm(target - fitted_target, ord=np.inf) < SMALL assert np.linalg.norm(target - fitted_target, ord=np.inf) < SMALL
...@@ -4,8 +4,8 @@ import sys ...@@ -4,8 +4,8 @@ import sys
import numpy as np import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import grext import gext
import grext.grassmann import gext.grassmann
import utils import utils
SMALL = 1e-10 SMALL = 1e-10
...@@ -26,7 +26,7 @@ def test_extrapolation(datafile): ...@@ -26,7 +26,7 @@ def test_extrapolation(datafile):
assert n < nframes assert n < nframes
# initialize an extrapolator # 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 # load data in the extrapolator up to index n - 1
for (coords, coeff, overlap) in zip(data["trajectory"][:n], for (coords, coeff, overlap) in zip(data["trajectory"][:n],
......
...@@ -4,8 +4,8 @@ import sys ...@@ -4,8 +4,8 @@ import sys
import numpy as np import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import grext import gext
import grext.grassmann import gext.grassmann
import utils import utils
SMALL = 1e-10 SMALL = 1e-10
...@@ -21,7 +21,7 @@ def test_grassmann(datafile): ...@@ -21,7 +21,7 @@ def test_grassmann(datafile):
nframes = data["trajectory"].shape[0] nframes = data["trajectory"].shape[0]
# initialize an extrapolator # initialize an extrapolator
extrapolator = grext.Extrapolator(nelectrons, nbasis, natoms, nframes) extrapolator = gext.Extrapolator(nelectrons, nbasis, natoms, nframes)
# load data in the extrapolator # load data in the extrapolator
for (coords, coeff, overlap) in zip(data["trajectory"], for (coords, coeff, overlap) in zip(data["trajectory"],
...@@ -44,7 +44,7 @@ def test_grassmann(datafile): ...@@ -44,7 +44,7 @@ def test_grassmann(datafile):
assert np.trace(d) - nelectrons < SMALL assert np.trace(d) - nelectrons < SMALL
# compute the density from the inverse Grassmann map: Exp(Log(D)) # 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 d_1 = coeff_1 @ coeff_1.T
# standard check on the second density # standard check on the second density
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment