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
e2b4ca59
Commit
e2b4ca59
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Now it is possible to skip overlap storing.
parent
f60da40e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
QTR
Pipeline
#1957
failed
1 year ago
Stage: test
Stage: lint
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gext/main.py
+12
-6
12 additions, 6 deletions
gext/main.py
with
12 additions
and
6 deletions
gext/main.py
+
12
−
6
View file @
e2b4ca59
...
...
@@ -22,6 +22,7 @@ class Extrapolator:
"
descriptor
"
:
"
distance
"
,
"
fitting
"
:
"
leastsquare
"
,
"
allow_partially_filled
"
:
True
,
"
store_overlap
"
:
True
,
}
self
.
nelectrons
=
nelectrons
...
...
@@ -30,9 +31,10 @@ class Extrapolator:
self
.
set_options
(
**
kwargs
)
self
.
gammas
=
CircularBuffer
(
self
.
options
[
"
nsteps
"
],
(
self
.
nelectrons
//
2
,
self
.
nbasis
))
self
.
overlaps
=
CircularBuffer
(
self
.
options
[
"
nsteps
"
],
(
self
.
nbasis
,
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
.
tangent
:
Optional
[
np
.
ndarray
]
=
None
...
...
@@ -78,8 +80,7 @@ class Extrapolator:
raise
ValueError
(
"
Unsupported descriptor
"
)
self
.
fitting_calculator
.
set_options
(
**
fitting_options
)
def
load_data
(
self
,
coords
:
np
.
ndarray
,
coeff
:
np
.
ndarray
,
overlap
:
np
.
ndarray
):
def
load_data
(
self
,
coords
:
np
.
ndarray
,
coeff
:
np
.
ndarray
,
overlap
):
"""
Load a new data point in the extrapolator.
"""
# Crop the coefficient matrix up to the number of electron
...
...
@@ -94,14 +95,16 @@ class Extrapolator:
# push the new data to the corresponding vectors
self
.
gammas
.
push
(
self
.
_grassmann_log
(
coeff
))
self
.
descriptors
.
push
(
self
.
_compute_descriptor
(
coords
))
self
.
overlaps
.
push
(
overlap
)
def
guess
(
self
,
coords
:
np
.
ndarray
,
overlap
=
None
)
->
np
.
ndarray
:
if
self
.
options
[
"
store_overlap
"
]:
self
.
overlaps
.
push
(
overlap
)
def
guess
(
self
,
coords
:
np
.
ndarray
,
overlap
=
None
)
->
np
.
ndarray
:
"""
Get a new electronic density matrix to be used as a guess.
"""
c_guess
=
self
.
guess_coefficients
(
coords
,
overlap
)
return
c_guess
@
c_guess
.
T
def
guess_coefficients
(
self
,
coords
:
np
.
ndarray
,
overlap
=
None
)
->
np
.
ndarray
:
def
guess_coefficients
(
self
,
coords
:
np
.
ndarray
,
overlap
=
None
)
->
np
.
ndarray
:
"""
Get a new coefficient matrix to be used as a guess.
"""
# check if we have enough data points to perform an extrapolation
...
...
@@ -115,6 +118,9 @@ class Extrapolator:
if
count
<
n
:
raise
ValueError
(
"
Not enough data loaded in the extrapolator
"
)
if
overlap
is
None
and
not
self
.
options
[
"
store_overlap
"
]:
raise
ValueError
(
"
Guessing without overlap requires `store_overlap` true.
"
)
# use the descriptors to find the fitting coefficients
prev_descriptors
=
self
.
descriptors
.
get
(
n
)
descriptor
=
self
.
_compute_descriptor
(
coords
)
...
...
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