Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions python/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ def __init__(
volume=None,
eig_lattice_size=None,
eig_lattice_center=None,
eig_vol=None,
component=mp.ALL_COMPONENTS,
direction=mp.AUTOMATIC,
eig_band=1,
Expand Down Expand Up @@ -551,12 +552,13 @@ def __init__(
optional `eig_lattice_size` and `eig_lattice_center`, which define a volume
(which must enclose `size` and `center`) that is used for the unit cell in MPB
with the dielectric function ε taken from the corresponding region in the Meep
simulation.
simulation. Alternatively, a volume object `eig_vol` can be specified.
"""

super().__init__(src, component, center, volume, **kwargs)
self.eig_lattice_size = eig_lattice_size
self.eig_lattice_center = eig_lattice_center
self.eig_vol = eig_vol
self.component = component
self.direction = direction
self.eig_band = eig_band
Expand Down Expand Up @@ -643,12 +645,13 @@ def add_source(self, sim):
else:
direction = self.direction

eig_vol = mp.Volume(
self.eig_lattice_center,
self.eig_lattice_size,
sim.dimensions,
is_cylindrical=sim.is_cylindrical,
).swigobj
if self.eig_vol is None:
self.eig_vol = mp.Volume(
self.eig_lattice_center,
self.eig_lattice_size,
sim.dimensions,
is_cylindrical=sim.is_cylindrical,
)

if isinstance(self.eig_band, mp.DiffractedPlanewave):
eig_band = 1
Expand All @@ -663,7 +666,7 @@ def add_source(self, sim):
self.src.swigobj,
direction,
where,
eig_vol,
self.eig_vol.swigobj,
eig_band,
mp.py_v3_to_vec(
sim.dimensions, self.eig_kpoint, is_cylindrical=sim.is_cylindrical
Expand Down