Closed oskooi closed 6 years ago
The initial portion of mpb.cpp:get_eigenmode
used to set the kpoint
(lines 238-242) only sets the ky component to 0.52240
. This is expected since eig_vol
has size 0 x 10 x 0
(i.e., the size in the y-direction is equal to that of the cell size). kz is not set here since the cell size is 0.025
.
It seems that the discrepancy in the two results for get_eigenmode_coefficients
and get_eigenmode
is due to the _kpoint
parameter passed to get_eigenmode
during get_eigenmode_coefficients
: the _kpoint
is always (0,0,0)
whereas when calling get_eigenmode
directly it is (2.76475,0.52240,1.04081)
.
Thus, it seems that get_eigenmode_coefficients
is calling get_eigenmode
with the wrong kpoint
for the case of a 2d cell with non-zero kz.
The kz component of the
k_point
is ignored byget_eigenmode_coefficients
(taken to be as just0
) for a 2d cell (in x and y) even though kz is non-zero and the simulation itself is 3d.As a demonstration of this bug, the binary grating example is modified in the script below to include a non-zero kz. The
k_point
had originally been "in the plane" with kz=0 resulting in a 2d simulation.The output indicates that the cell is 3d which is correct.
Note that the
eig_parity
is set toNO_PARITY
due to the non-zero kz. In this example, kz is1.0408
. All modes computed by MPB viaget_eigenmode_coefficients
should have the same value. However, the kz values of these modes are always 0.This indicates that
get_eigenmode_coefficients
is not correctly inferring the dimensions of the cell.As an additional note, calling
get_eigenmode
separately with a non-zero kz does yield modes with the same kz. This is demonstrated in the following script.The output shows a
KPOINT
with the correct kz value.