Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symmetry-transformed overlap integrals #134

Merged
merged 18 commits into from
Jun 6, 2021
Merged

Conversation

thchr
Copy link
Contributor

@thchr thchr commented Jun 1, 2021

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:

  • Currently, the functionality only works for mpb and not for mpb-mpi, mpbi, or mpbi-mpi. There are some issues in the HAVE_MPI and SCALAR_COMPLEX cases that I haven't managed to get to the bottom of.
  • There's no pretty-printing of the output included here. I have some Scheme code elsewhere that achieves this (e.g., by printing symmetry operation matrix-vector pairs as coordinate triplets) but I wasn't sure if it was worthwhile to include here.
  • There are currently no tests; I could add some if that's desirable.

-Thomas

…oking get_bfield/get_dfield and add a clearer method description:

- compute_symmetry (band function)
- compute_symmetries (all bands)

Also minor revisions to comments and micro-refactoring.
- The translation component of {W|w}^-1 contains a factor of W^-1
- Previously, nonsymmorphic operations were consequently wrongly implemented
- also add a comment to remind ourselves why the current implementation
doesn't work with mpbi + a likely explanation for the origin of the
issue
mpb/fields.c Outdated Show resolved Hide resolved
@stevengj
Copy link
Collaborator

stevengj commented Jun 1, 2021

Is there any test for this that could be included?

@thchr
Copy link
Contributor Author

thchr commented Jun 2, 2021

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
Copy link
Collaborator

stevengj commented Jun 3, 2021

Yes, that should be fine.

@thchr
Copy link
Contributor Author

thchr commented Jun 4, 2021

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

mpb/fields.c Outdated Show resolved Hide resolved
Revert use of `static` for C89 compatibility.

Co-authored-by: Steven G. Johnson <[email protected]>
@stevengj
Copy link
Collaborator

stevengj commented Jun 5, 2021

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

@thchr
Copy link
Contributor Author

thchr commented Jun 5, 2021

I checked it locally and it passed, yep.

@stevengj stevengj merged commit 74fb432 into NanoComp:master Jun 6, 2021
thchr added a commit to thchr/meep that referenced this pull request Feb 7, 2022
stevengj pushed a commit to NanoComp/meep that referenced this pull request Feb 11, 2022
* pympb ports of of `transform_overlap`, `compute_symmetry`, & `compute_symmetries`

- corresponding MPB PRs: NanoComp/mpb#134 and NanoComp/mpb#100

* remove `!SCALAR_COMPLEX` and `HAVE_MPI` related code

* remove overlooked stale MPI-specific code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants