(self, fname_prefix, output_k)
| 640 | self.mode_solver.curfield_reset() |
| 641 | |
| 642 | def _output_complex_scalar_field(self, fname_prefix, output_k): |
| 643 | curfield_type = "C" |
| 644 | kpoint_index = self.mode_solver.get_kpoint_index() |
| 645 | curfield_band = self.mode_solver.curfield_band |
| 646 | fname = f"{curfield_type}.k{kpoint_index:02d}.b{curfield_band:02d}" |
| 647 | description = "{} field, kpoint {}, band {}, freq={:.6g}".format( |
| 648 | curfield_type, kpoint_index, curfield_band, self.freqs[curfield_band - 1] |
| 649 | ) |
| 650 | fname = self._create_fname(fname, fname_prefix, True) |
| 651 | if verbosity.mpb > 0: |
| 652 | print(f"Outputting complex scalar field to {fname}...") |
| 653 | |
| 654 | with h5py.File(fname, "w") as f: |
| 655 | f["description"] = description.encode() |
| 656 | f["Bloch wavevector"] = np.array(output_k) |
| 657 | self._write_lattice_vectors(f) |
| 658 | |
| 659 | dims = self.mode_solver.get_dims() |
| 660 | field = np.empty(np.prod(dims), np.complex128) |
| 661 | self.mode_solver.get_curfield_cmplx(field) |
| 662 | |
| 663 | reshaped_field = field.reshape(dims) |
| 664 | |
| 665 | f["c.r"] = np.real(reshaped_field) |
| 666 | f["c.i"] = np.imag(reshaped_field) |
| 667 | |
| 668 | def _output_vector_field(self, curfield_type, fname_prefix, output_k, component): |
| 669 | components = ["x", "y", "z"] |
no test coverage detected