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
44b65723
Commit
44b65723
authored
1 year ago
by
Michele Nottoli
Browse files
Options
Downloads
Patches
Plain Diff
Added the guess method.
parent
a754e65b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
grext/main.py
+24
-2
24 additions, 2 deletions
grext/main.py
with
24 additions
and
2 deletions
grext/main.py
+
24
−
2
View file @
44b65723
...
...
@@ -44,10 +44,27 @@ class Extrapolator:
self
.
descriptors
.
push
(
self
.
_compute_descriptor
(
coords
))
self
.
overlaps
.
push
(
overlap
)
def
guess
(
self
,
coords
:
np
.
ndarray
,
overlap
:
Optional
[
np
.
ndarray
]):
def
guess
(
self
,
coords
:
np
.
ndarray
,
overlap
:
Optional
[
np
.
ndarray
])
->
np
.
ndarray
:
"""
Get a new electronic density to be used as a guess.
"""
prev_descriptors
=
self
.
descriptors
.
get
(
self
.
nsteps
)
gammas
=
self
.
gammas
.
get
(
self
.
nsteps
)
descriptor
=
self
.
_compute_descriptor
(
coords
)
coefficients
=
fitting
.
linear
()
coefficients
=
fitting
.
linear
(
prev_descriptors
,
descriptor
)
gamma
=
fitting
.
linear_combination
(
gammas
,
coefficients
)
if
overlap
is
None
:
overlaps
=
self
.
overlaps
.
get
(
self
.
nsteps
)
overlap
=
fitting
.
linear_combination
(
overlaps
,
coefficients
)
inverse_sqrt_overlap
=
self
.
_inverse_sqrt_overlap
(
overlap
)
else
:
inverse_sqrt_overlap
=
self
.
_inverse_sqrt_overlap
(
overlap
)
c_guess
=
self
.
_grassmann_exp
(
gamma
)
c_guess
=
inverse_sqrt_overlap
@
c_guess
return
c_guess
@
c_guess
.
T
def
_get_tangent
(
self
)
->
np
.
ndarray
:
"""
Get the tangent point.
"""
...
...
@@ -85,6 +102,11 @@ class Extrapolator:
q
,
s
,
vt
=
np
.
linalg
.
svd
(
overlap
,
full_matrices
=
False
)
return
q
@
np
.
diag
(
np
.
sqrt
(
s
))
@
vt
def
_inverse_sqrt_overlap
(
self
,
overlap
)
->
np
.
ndarray
:
"""
Compute the square root of the overlap matrix.
"""
q
,
s
,
vt
=
np
.
linalg
.
svd
(
overlap
,
full_matrices
=
False
)
return
q
@
np
.
diag
(
1.0
/
np
.
sqrt
(
s
))
@
vt
def
_compute_descriptor
(
self
,
coords
)
->
np
.
ndarray
:
"""
Given a set of coordinates compute the corresponding descriptor.
"""
return
descriptors
.
distance
(
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