MCPcopy Create free account
hub / github.com/NanoComp/meep / run_k_points

Method run_k_points

python/simulation.py:2934–2965  ·  view source on GitHub ↗

Given a list of `Vector3`, `k_points` of *k* vectors, runs a simulation for each *k* point (i.e. specifying Bloch-periodic boundary conditions) and extracts the eigen-frequencies, and returns a list of the complex frequencies. In particular, you should have specified

(self, t: float = None, k_points: List[Vector3Type] = None)

Source from the content-addressed store, hash-verified

2932 return h
2933
2934 def run_k_points(self, t: float = None, k_points: List[Vector3Type] = None):
2935 """
2936 Given a list of `Vector3`, `k_points` of *k* vectors, runs a simulation for each
2937 *k* point (i.e. specifying Bloch-periodic boundary conditions) and extracts the
2938 eigen-frequencies, and returns a list of the complex frequencies. In particular,
2939 you should have specified one or more Gaussian sources. It will run the simulation
2940 until the sources are turned off plus an additional $t$ time units. It will run
2941 [Harminv](#harminv) at the same point/component as the first Gaussian source and
2942 look for modes in the union of the frequency ranges for all sources. Returns a
2943 list of lists of frequencies (one list of frequencies for each *k*). Also prints
2944 out a comma-delimited list of frequencies, prefixed by `freqs:`, and their
2945 imaginary parts, prefixed by `freqs-im:`. See [Tutorial/Resonant Modes and
2946 Transmission in a Waveguide
2947 Cavity](Python_Tutorials/Resonant_Modes_and_Transmission_in_a_Waveguide_Cavity.md).
2948 """
2949 k_index = 0
2950 all_freqs = []
2951
2952 for k in k_points:
2953 k_index += 1
2954 harminv = self.run_k_point(t, k)
2955 freqs = [complex(m.freq, m.decay) for m in harminv.modes]
2956
2957 if verbosity.meep > 0:
2958 print(f"freqs:, {k_index}, {k.x}, {k.y}, {k.z}, ", end="")
2959 print(", ".join([str(f.real) for f in freqs]))
2960 print(f"freqs-im:, {k_index}, {k.x}, {k.y}, {k.z}, ", end="")
2961 print(", ".join([str(f.imag) for f in freqs]))
2962
2963 all_freqs.append(freqs)
2964
2965 return all_freqs
2966
2967 def set_epsilon(self, eps):
2968 if self.fields is None:

Callers 4

mainFunction · 0.95
test_run_k_pointsMethod · 0.80

Calls 1

run_k_pointMethod · 0.95