NanoComp / mpb

MIT Photonic-Bands: computation of photonic band structures in periodic media
GNU General Public License v2.0
160 stars 87 forks source link

Symmetry-transformed overlap integrals #134

Closed thchr closed 3 years ago

thchr commented 3 years ago

Hi @stevengj,

As I mentioned last week, I've had some code laying around for a while in my fork (and have used it a bunch) which computes the overlap integral of modes under a symmetry operation. This allows one to easily compute which irrep a given solution transforms like by using the little group operations and character tables (e.g., via Crystalline.jl). I figured this might be interesting to contribute back to your main repo, since it could be of general interest.

The way it works is just to do the integral in the real-space basis: ideally, it could've been done in the plane-wave basis - but it seemed simpler to do in the real-space basis since the transformation of the mode polarization is straightforward there. It's reasonably fast as-is: I found the cost of evaluating the symmetries to be negligible compared to obtaining the band solutions themselves.

There are some caveats to consider if you think this might be worth merging:

-Thomas

stevengj commented 3 years ago

Is there any test for this that could be included?

thchr commented 3 years ago

We could add a simple test that e.g. checks against regressions for a simple operation, e.g. inversion? I have some 2D and 3D .ctl files that do that; would that be sufficient or do we want to test more thoroughly?

E.g., adding something like:

(set! resolution 16)
(set! num-bands 6)
(set! output-epsilon (lambda () (print "skipping output-epsilon\n")))
; define a simple geometry with inversion
(set! geometry-lattice (make lattice (size 1 1 1)
                                     (basis1 1 0 0) (basis2 0 1 0) (basis3 0 0 1)))
(set! geometry (list (make sphere
                        (center 0 0 0) (radius 0.25)
                        (material (make dielectric (epsilon 13) )))))
; set a k-point whose little group includes inversion
(set! k-points (list (vector3 0.5 0.5 0.5)))
; define inversion as a symmetry operation {W|w}
(define W (matrix3x3 (vector3 -1 0 0) (vector3 0 -1 0) (vector3 0 0 -1)))
(define w (vector3 0 0 0))

(define (print-sym which-band) (print (compute-symmetry which-band W w) "\n"))

; run the calculation
(run print-sym)

; calculate and print symmetry eigenvalues of each band
(print (compute-symmetries W w))

to the test suite? (and then of course testing against some hardcoded output)

stevengj commented 3 years ago

Yes, that should be fine.

thchr commented 3 years ago

There's some tests now and I resolved the mpb/field.c comment as well.

stevengj commented 3 years ago

Looks good. I’m assuming make check passes, since GitHub is not running it automatically at the moment?

thchr commented 3 years ago

I checked it locally and it passed, yep.