Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MeanFi
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
Quantum Tinkerer
MeanFi
Commits
3bb6e720
Commit
3bb6e720
authored
1 year ago
by
Kostas Vilkelis
Browse files
Options
Downloads
Patches
Plain Diff
debug F calculator
parent
1719f29c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
General dimension
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
codes/hf.py
+24
-4
24 additions, 4 deletions
codes/hf.py
with
24 additions
and
4 deletions
codes/hf.py
+
24
−
4
View file @
3bb6e720
from
scipy.ndimage
import
convolve
import
numpy
as
np
import
utils
import
codes.utils
as
utils
from
functools
import
partial
from
scipy.optimize
import
anderson
def
mean_field_F
(
vals
,
vecs
,
E_F
):
"""
Returns the mean field F_ij(k) = <psi_i(k)|psi_j(k)> for all k-points and
eigenvectors below the Fermi level.
Parameters
----------
vals : array_like
eigenvalues of the Hamiltonian
vecs : array_like
eigenvectors of the Hamiltonian
E_F : float
Fermi level
Returns
-------
F : array_like
mean field F[kx, ky, ..., i, j] where i,j are cell indices.
"""
cell_size
=
vals
.
shape
[
-
1
]
dim
=
len
(
vals
.
shape
)
-
1
nk
=
vals
.
shape
[
0
]
nk
=
vals
.
shape
[
0
]
# not sure about this, since it forces a square grid
vals_flat
=
vals
.
reshape
(
-
1
,
cell_size
)
unocc_vals
=
vals_flat
>
E_F
occ_vecs_flat
=
vecs
.
reshape
(
-
1
,
cell_size
,
cell_size
)
occ_vecs_flat
[
unocc_vals
]
=
0
occ_vecs_flat
=
np
.
transpose
(
occ_vecs_flat
,
axes
=
[
0
,
2
,
1
])
occ_vecs_flat
[
unocc_vals
,
:]
=
0
occ_vecs_flat
=
np
.
transpose
(
occ_vecs_flat
,
axes
=
[
0
,
2
,
1
])
# inner products between eigenvectors
F_ij
=
np
.
einsum
(
"
ijk,kli
->ij
l
"
,
occ_vecs_flat
,
occ_vecs_flat
.
conj
()
.
T
)
F_ij
=
np
.
einsum
(
"
kie,kje
->
k
ij
"
,
occ_vecs_flat
,
occ_vecs_flat
.
conj
())
reshape_order
=
[
nk
for
i
in
range
(
dim
)]
reshape_order
.
extend
([
cell_size
,
cell_size
])
...
...
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