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

Method update_band_range_data

python/solver.py:506–517  ·  view source on GitHub ↗
(self, brd, freqs, kpoint)

Source from the content-addressed store, hash-verified

504 # Here, we update this data with a new list of band frequencies, and return the new
505 # data. If band-range-data is null or too short, the needed entries will be created.
506 def update_band_range_data(self, brd, freqs, kpoint):
507 def update_brd(brd, freqs, br_start):
508 if not freqs:
509 return br_start + brd
510 br = brd[0] if brd else ((mp.inf, -1), (-mp.inf, -1))
511 br_rest = brd[1:] if brd else []
512 newmin = (freqs[0], kpoint) if freqs[0] < br[0][0] else br[0]
513 newmax = (freqs[0], kpoint) if freqs[0] > br[1][0] else br[1]
514 new_start = br_start + [(newmin, newmax)]
515 return update_brd(br_rest, freqs[1:], new_start)
516
517 return update_brd(brd, freqs, [])
518
519 def output_band_range_data(self, br_data):
520 if verbosity.mpb > 0:

Callers 2

run_parityMethod · 0.95

Calls

no outgoing calls

Tested by 1