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

Add force_all_components #631

Merged
merged 2 commits into from
Dec 14, 2018
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
8 changes: 7 additions & 1 deletion python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ def __init__(self,
output_volume=None,
output_single_precision=False,
load_structure='',
geometry_center=mp.Vector3()):
geometry_center=mp.Vector3(),
force_all_components=False):

self.cell_size = cell_size
self.geometry = geometry
Expand Down Expand Up @@ -516,6 +517,7 @@ def __init__(self,
self.dft_objects = []
self._is_initialized = False
self._fragment_size = 10
self.force_all_components = force_all_components

# To prevent the user from having to specify `dims` and `is_cylindrical`
# to Volumes they create, the library will adjust them appropriately based
Expand Down Expand Up @@ -973,6 +975,10 @@ def init_sim(self):
not self.accurate_fields_near_cylorigin
)

if self.force_all_components and self.dimensions != 1:
self.fields.require_component(mp.Ez)
self.fields.require_component(mp.Hz)

if self.verbose:
self.fields.verbose()

Expand Down