Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michele Nottoli
gext
Commits
a7068085
Commit
a7068085
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Checked descriptors.
parent
7da1d3f3
No related branches found
No related tags found
No related merge requests found
Pipeline
#2064
failed
1 year ago
Stage: test
Stage: lint
Stage: coverage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gext/descriptors.py
+3
-3
3 additions, 3 deletions
gext/descriptors.py
gext/fitting.py
+1
-2
1 addition, 2 deletions
gext/fitting.py
tests/test_descriptor_fitting.py
+4
-3
4 additions, 3 deletions
tests/test_descriptor_fitting.py
with
8 additions
and
8 deletions
gext/descriptors.py
+
3
−
3
View file @
a7068085
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
numpy
as
np
import
numpy
as
np
from
scipy.spatial.distance
import
pdist
from
scipy.spatial.distance
import
pdist
class
Base
Fitting
:
class
Base
Descriptor
:
supported_options
=
{}
supported_options
=
{}
...
@@ -16,7 +16,7 @@ class BaseFitting:
...
@@ -16,7 +16,7 @@ class BaseFitting:
if
len
(
kwargs
)
>
0
:
if
len
(
kwargs
)
>
0
:
raise
ValueError
(
"
Invalid arguments given to the descriptor class.
"
)
raise
ValueError
(
"
Invalid arguments given to the descriptor class.
"
)
class
Distance
(
Base
Fitting
):
class
Distance
(
Base
Descriptor
):
"""
Distance matrix descriptors.
"""
"""
Distance matrix descriptors.
"""
...
@@ -34,7 +34,7 @@ class Coulomb(Distance):
...
@@ -34,7 +34,7 @@ class Coulomb(Distance):
"""
Compute the Coulomb matrix as a descriptor.
"""
"""
Compute the Coulomb matrix as a descriptor.
"""
return
1.0
/
super
().
compute
(
coords
)
return
1.0
/
super
().
compute
(
coords
)
class
FlattenMatrix
(
Base
Fitting
):
class
FlattenMatrix
(
Base
Descriptor
):
"""
Use the quantity as it is, just flatten it.
"""
"""
Use the quantity as it is, just flatten it.
"""
...
...
This diff is collapsed.
Click to expand it.
gext/fitting.py
+
1
−
2
View file @
a7068085
...
@@ -117,9 +117,8 @@ class LeastSquare(AbstractFitting):
...
@@ -117,9 +117,8 @@ class LeastSquare(AbstractFitting):
if
self
.
options
[
"
regularization
"
]
>
0.0
:
if
self
.
options
[
"
regularization
"
]
>
0.0
:
a
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
a
+=
np
.
identity
(
len
(
b
))
*
self
.
options
[
"
regularization
"
]
coefficients
=
np
.
linalg
.
solve
(
a
,
b
)
coefficients
=
np
.
linalg
.
solve
(
a
,
b
)
print
(
coefficients
)
return
np
.
array
(
coefficients
,
dtype
=
np
.
float64
)
return
np
.
array
(
coefficients
,
dtype
=
np
.
float64
)
class
QuasiTimeReversible
(
AbstractFitting
):
class
QuasiTimeReversible
(
AbstractFitting
):
"""
Quasi time reversible fitting scheme.
"""
"""
Quasi time reversible fitting scheme.
"""
...
...
This diff is collapsed.
Click to expand it.
tests/test_descriptor_fitting.py
+
4
−
3
View file @
a7068085
...
@@ -10,7 +10,7 @@ import gext.fitting
...
@@ -10,7 +10,7 @@ import gext.fitting
import
gext.grassmann
import
gext.grassmann
import
utils
import
utils
SMALL
=
1
e-8
SMALL
=
2
e-8
THRESHOLD
=
5e-2
THRESHOLD
=
5e-2
@pytest.mark.parametrize
(
"
datafile
"
,
[
"
urea.json
"
,
"
glucose.json
"
])
@pytest.mark.parametrize
(
"
datafile
"
,
[
"
urea.json
"
,
"
glucose.json
"
])
...
@@ -27,7 +27,7 @@ def test_least_square(datafile, regularization):
...
@@ -27,7 +27,7 @@ def test_least_square(datafile, regularization):
# initialize an extrapolator
# initialize an extrapolator
extrapolator
=
gext
.
Extrapolator
(
nelectrons
,
nbasis
,
natoms
,
extrapolator
=
gext
.
Extrapolator
(
nelectrons
,
nbasis
,
natoms
,
nsteps
=
nframes
,
fitting_regularization
=
regularization
,
nsteps
=
nframes
,
fitting_regularization
=
regularization
,
fitting
=
"
leastsquare
"
)
fitting
=
"
leastsquare
"
,
descriptor
=
"
distance
"
)
# 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
"
],
...
@@ -69,7 +69,8 @@ def test_quasi_time_reversible(datafile, regularization):
...
@@ -69,7 +69,8 @@ def test_quasi_time_reversible(datafile, regularization):
# initialize an extrapolator
# initialize an extrapolator
extrapolator
=
gext
.
Extrapolator
(
nelectrons
,
nbasis
,
natoms
,
extrapolator
=
gext
.
Extrapolator
(
nelectrons
,
nbasis
,
natoms
,
nsteps
=
nframes
,
fitting
=
"
qtr
"
,
fitting_regularization
=
regularization
)
nsteps
=
nframes
,
fitting
=
"
qtr
"
,
fitting_regularization
=
regularization
,
descriptor
=
"
distance
"
)
# 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
"
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment