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
2c689449
Commit
2c689449
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Supported options are now a class attribute.
parent
e2b4ca59
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
QTR
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gext/descriptors.py
+4
-0
4 additions, 0 deletions
gext/descriptors.py
gext/fitting.py
+10
-8
10 additions, 8 deletions
gext/fitting.py
gext/main.py
+9
-9
9 additions, 9 deletions
gext/main.py
with
23 additions
and
17 deletions
gext/descriptors.py
+
4
−
0
View file @
2c689449
...
...
@@ -7,6 +7,8 @@ class Distance:
"""
Distance matrix descriptors.
"""
supported_options
=
{}
def
__init__
(
self
,
**
kwargs
):
self
.
set_options
(
**
kwargs
)
...
...
@@ -24,6 +26,8 @@ class Coulomb(Distance):
"""
Coulomb matrix descriptors.
"""
supported_options
=
{}
def
compute
(
self
,
coords
:
np
.
ndarray
)
->
np
.
ndarray
:
"""
Compute the Coulomb matrix as a descriptor.
"""
return
1.0
/
super
().
compute
(
coords
)
This diff is collapsed.
Click to expand it.
gext/fitting.py
+
10
−
8
View file @
2c689449
...
...
@@ -8,8 +8,9 @@ class AbstractFitting(abc.ABC):
"""
Base class for fitting schemes.
"""
supported_options
=
{}
def
__init__
(
self
,
**
kwargs
):
self
.
supported_options
=
{}
self
.
set_options
(
**
kwargs
)
@abc.abstractmethod
...
...
@@ -26,7 +27,6 @@ class AbstractFitting(abc.ABC):
if
option
not
in
self
.
options
:
self
.
options
[
option
]
=
default_value
@abc.abstractmethod
def
fit
(
self
,
vectors
:
List
[
np
.
ndarray
],
target
:
np
.
ndarray
):
"""
Base method for computing new fitting coefficients.
"""
...
...
@@ -45,10 +45,11 @@ class LeastSquare(AbstractFitting):
"""
Simple least square minimization fitting.
"""
supported_options
=
{
"
regularization
"
:
0.0
,
}
def
__init__
(
self
,
**
kwargs
):
self
.
supported_options
=
{
"
regularization
"
:
0.0
,
}
super
().
__init__
(
**
kwargs
)
def
set_options
(
self
,
**
kwargs
):
...
...
@@ -70,10 +71,11 @@ class QuasiTimeReversible(AbstractFitting):
"""
Quasi time reversible fitting scheme. Not yet implemented.
"""
supported_options
=
{
"
regularization
"
:
0.0
,
}
def
__init__
(
self
,
**
kwargs
):
self
.
supported_options
=
{
"
regularization
"
:
0.0
,
}
super
().
__init__
(
**
kwargs
)
def
set_options
(
self
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
gext/main.py
+
9
−
9
View file @
2c689449
...
...
@@ -14,16 +14,16 @@ class Extrapolator:
it requires the number of electrons, the number of basis functions
and the number of atoms of the molecule.
"""
def
__init__
(
self
,
nelectrons
:
int
,
nbasis
:
int
,
natoms
:
int
,
**
kwargs
):
supported_options
=
{
"
verbose
"
:
False
,
"
nsteps
"
:
6
,
"
descriptor
"
:
"
distance
"
,
"
fitting
"
:
"
leastsquare
"
,
"
allow_partially_filled
"
:
True
,
"
store_overlap
"
:
True
,
}
self
.
supported_options
=
{
"
verbose
"
:
False
,
"
nsteps
"
:
6
,
"
descriptor
"
:
"
distance
"
,
"
fitting
"
:
"
leastsquare
"
,
"
allow_partially_filled
"
:
True
,
"
store_overlap
"
:
True
,
}
def
__init__
(
self
,
nelectrons
:
int
,
nbasis
:
int
,
natoms
:
int
,
**
kwargs
):
self
.
nelectrons
=
nelectrons
self
.
nbasis
=
nbasis
...
...
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