Lower level function called by `run_k_points` that runs a simulation for a single *k* point `k_point` and returns a `Harminv` instance. Useful when you need to access more `Harminv` data than just the frequencies.
(self, t: float = None, k: Vector3Type = None)
| 2893 | self._run_sources_until(self, 0, step_funcs) |
| 2894 | |
| 2895 | def run_k_point(self, t: float = None, k: Vector3Type = None): |
| 2896 | """ |
| 2897 | Lower level function called by `run_k_points` that runs a simulation for a single |
| 2898 | *k* point `k_point` and returns a `Harminv` instance. Useful when you need to |
| 2899 | access more `Harminv` data than just the frequencies. |
| 2900 | """ |
| 2901 | components = [s.component for s in self.sources] |
| 2902 | pts = [s.center for s in self.sources] |
| 2903 | |
| 2904 | src_freqs_min = min( |
| 2905 | ( |
| 2906 | s.src.frequency - 1 / s.src.width / 2 |
| 2907 | if isinstance(s.src, mp.GaussianSource) |
| 2908 | else mp.inf |
| 2909 | ) |
| 2910 | for s in self.sources |
| 2911 | ) |
| 2912 | fmin = max(0, src_freqs_min) |
| 2913 | |
| 2914 | fmax = max( |
| 2915 | ( |
| 2916 | s.src.frequency + 1 / s.src.width / 2 |
| 2917 | if isinstance(s.src, mp.GaussianSource) |
| 2918 | else 0 |
| 2919 | ) |
| 2920 | for s in self.sources |
| 2921 | ) |
| 2922 | |
| 2923 | if not components or fmin > fmax: |
| 2924 | raise ValueError("Running with k_points requires a 'GaussianSource' source") |
| 2925 | |
| 2926 | self.change_k_point(k) |
| 2927 | self.restart_fields() |
| 2928 | |
| 2929 | h = Harminv(components[0], pts[0], 0.5 * (fmin + fmax), fmax - fmin) |
| 2930 | self.run(after_sources(h), until_after_sources=t) |
| 2931 | |
| 2932 | return h |
| 2933 | |
| 2934 | def run_k_points(self, t: float = None, k_points: List[Vector3Type] = None): |
| 2935 | """ |
no test coverage detected