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

Trying out mode solving with negative epsilon #135

Open
mdecea opened this issue Jun 13, 2021 · 1 comment
Open

Trying out mode solving with negative epsilon #135

mdecea opened this issue Jun 13, 2021 · 1 comment

Comments

@mdecea
Copy link

mdecea commented Jun 13, 2021

Hello,

I wanted to try out using MPB with negative epsilon materials. I know it is an "experimental" feature, but I have not even been successful in making the MPB simulation complete, I always get the error RuntimeError: meep: invalid dielectric function for MPB. This happens in the "Initializing epsilon function" step.

I have set is_negative_epsilon_ok = True and run ModeSolver.allow_negative_epsilon() before ModeSolver.run(). Am I missing some additional setting to make it work?

Here is a minimal example (in python) reproducing the issue:

import meep as mp
from meep import mpb

geometry_lattice = mp.Lattice(size=mp.Vector3(0,2,2))

mat1 = mp.Medium(epsilon=1)
mat2 = mp.Medium(epsilon=-2)

geometry = [mp.Block(size=mp.Vector3(mp.inf, 2, 1), 
   center=mp.Vector3(z=-0.5), material = mat1), 
   mp.Block(size=mp.Vector3(mp.inf, 2, 1), 
   center=mp.Vector3(z=0.5), material = mat2)

k_min = 0.1
k_max = 2.0
k_points = mp.interpolate(num_k, [mp.Vector3(k_min), mp.Vector3(k_max)])

ms = mpb.ModeSolver(geometry_lattice = geometry_lattice, 
   geometry=geometry, 
   k_points=k_points, 
   resolution = 32, 
   num_bands=2, 
   is_negative_epsilon_ok=True, 
   target_freq=1/mp.inf)

ms.allow_negative_epsilon()
ms.run()
@stevengj
Copy link
Collaborator

It's possible that it isn't working in the Python interface, where it may not have been tested. Have you tried it in the Scheme interface?

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

No branches or pull requests

2 participants