question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to do inner products between different k

See original GitHub issue

We have es.state[n, i] where n is a band index and i an orbital in the primitive cell. And H.tocsr() has indices [i, J] with i an orbital index in the primitive cell and J one in the supercell.

To compute general matrix elements we need <s1| A |s2> = s1.inner(matrix=A.tocsr(), ket=s2.state_sc) to compute general matrix elements between the Bloch states s1, s2.

What I have in mind is thus that s2.state_sc should have indices [m, J] such that the general inner product <s1(n)| A |s2(m)> takes the form [n, i] . [i,J] . ([m, J].T). (It is a separate discussion if we should transpose the ket internally or not)

_Originally posted by @tfrederiksen in https://github.com/zerothi/sisl/pull/355#discussion_r666131276_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
zerothicommented, Dec 15, 2021

Maybe it is worth to understand how SIESTA is computing macroscopic polarization of dielectrics (via the geometric Berry phase) as implemented in the subroutine KSV_pol?

In siesta it is calculated using the matrix elements $phi_i(r-r_i)dkr*phi_j(r-r_j) + HC$ to get a phase on the orbital. Then subsequently it is the determinant of some overlap matrix times the wavefunction coefficients (not fully correct, but along these lines).

I would say this path is not feasible in sisl due to the matrix elements not being calculate-able in a fast way.

1reaction
zerothicommented, Jul 9, 2021
<k1(n) | k2(m)> = k1.state[n, i].S[i, J].((k2.state_sc[m, J]).T)

But I think this is equivalent to <k1|S(k2)|k2>, right? S[i, J] * k2[m, J] == S[i, J] * exp(2j*pi * k2 @ isc(J)) * k2[m, j] or am I wrong here?

You are right, they are equivalent…

Here is a little script exploring this for the non-ortho case:

import sisl
import numpy as np

geom = sisl.geom.graphene()

H = sisl.Hamiltonian(geom, orthogonal=False)
H.construct([[0.1, 1.5], [[0, 1], [2.7, 0.3]]])

k = np.array([2/3, 1/3, 0])
es = H.eigenstate(k)
es_ext = np.concatenate([np.exp(2j * np.pi * k.dot(isc)) * es.state for _, isc in H.geom.sc], axis=1)

s = es.inner(es, diag=False)
s_ext = es.state.conj().dot(H.tocsr(-1).dot(es_ext.T))
assert np.allclose(s, s_ext)

ev = np.diag(es.state.conj().dot(H.tocsr().dot(es_ext.T)))
assert np.allclose(ev, es.eig)

k2 = np.array([0, 0, 0])
es2 = H.eigenstate(k2)
es2_ext = np.concatenate([np.exp(2j * np.pi * k2.dot(isc)) * es2.state for _, isc in H.geom.sc], axis=1)

s21 = es2.inner(es, diag=False) # using S(k2) from es2
s12_ext = es.state.conj().dot(H.tocsr(-1).dot(es2_ext.T))
assert np.allclose(s21.conj().T, s12_ext)

s12 = es.inner(es2, diag=False) # using S(k) from es
assert not np.allclose(s12, s12_ext)

A note, you shouldn’t use tocsr. When you start using NC/SOC what you want is Hk(format='sc'). I have just fixed so one can use format=‘sc’` for gamma-point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

9 Inner product
In calculus, the “dot product” of two vectors x = 〈2, −3〉 and y = 〈5, 1〉 is ... We get an inner...
Read more >
Bras and Kets II: Non-standard Inner Products - YouTube
When working with a non-standard inner product, ... This changes the form of the bras, but not the kets. ... 3.8 K views...
Read more >
Inner Product Introduction - YouTube
http://adampanagos.orgThe inner product, defined on some vector space V, is a function that maps two vectors to a scalar. The inner product ......
Read more >
Inner Product and Orthogonal Functions , Quick Example
Thanks to all of you who support me on Patreon. You da real mvps! $1 per month helps!! :) https://www.patreon.com/patrickjmt !! Inner ......
Read more >
Advanced Linear Algebra - Lecture 21: All Inner ... - YouTube
We show that every inner product looks like the usual dot product, as long as you represent your vectors in an orthonormal basis....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found