hainingpan / Conductance_Kwant

Calculation of conductance of 1D nanowire using Kwant
7 stars 7 forks source link

invalid value encountered in scalar divide when the Zeeman splitting energy exceeds the chemical potential of the lead #1

Closed DanChai22 closed 2 months ago

DanChai22 commented 2 months ago

Execute mpiexec -n 32 python -m mpi4py.futures Conductance_Kwant/Majorana_main.py -V_bias=0 -mass 0.03 -alpha 0.08 -Delta0 0.12 -L 3 -mu_lead 0.2 -barrier_E 15 -coupling_SC_SM 0.15 -lead_num=2 -y='mu' -conductance And the logging is

/mnt/petrelfs/chaishengdu/Pro/Coding/Majorana_Disorder/Conductance_Kwant/Majorana_utils.py:514: RuntimeWarning: invalid value encountered in scalar divide phase = np.array([(-1)m*basis_wf[m,n]/abs(basis_wf[m,n]) for n,m in enumerate(normalize)]) /mnt/petrelfs/chaishengdu/Pro/Coding/Majorana_Disorder/Conductance_Kwant/Majorana_utils.py:514: RuntimeWarning: invalid value encountered in scalar divide phase = np.array([(-1)*mbasis_wf[m,n]/abs(basis_wf[m,n]) for n,m in enumerate(normalize)]) /mnt/petrelfs/chaishengdu/Pro/Coding/Majorana_Disorder/Conductance_Kwant/Majorana_utils.py:514: RuntimeWarning: invalid value encountered in scalar divide phase = np.array([(-1)m*basis_wf[m,n]/abs(basis_wf[m,n]) for n,m in enumerate(normalize)]) /mnt/petrelfs/chaishengdu/Pro/Coding/Majorana_Disorder/Conductance_Kwant/Majorana_utils.py:514: RuntimeWarning: invalid value encountered in scalar divide phase = np.array([(-1)*mbasis_wf[m,n]/abs(basis_wf[m,n]) for n,m in enumerate(normalize)]) /mnt/petrelfs/chaishengdu/Pro/Coding/Majorana_Disorder/Conductance_Kwant/Majorana_utils.py:514: RuntimeWarning: invalid value encountered in scalar divide phase = np.array([(-1)*mbasis_wf[m,n]/abs(basis_wf[m,n]) for n,m in enumerate(normalize)]) 10%|▉ | 7525/77056 [00:31<04:48, 241.19it/s] Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/site-packages/mpi4py/futures/main.py", line 74, in main() File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/site-packages/mpi4py/futures/main.py", line 62, in main run_command_line() File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/site-packages/mpi4py/run.py", line 47, in run_command_line run_path(sys.argv[0], run_name='main') File "", line 291, in run_path File "", line 98, in _run_module_code File "", line 88, in _run_code File "Conductance_Kwant/Majorana_main.py", line 545, in rs=list(tqdm(executor.map(wrapper,inputs),total=len(inputs))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/site-packages/tqdm/std.py", line 1181, in iter for obj in iterable: File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/site-packages/mpi4py/futures/pool.py", line 234, in result_iterator yield futures.pop().result() ^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/mnt/petrelfs/chaishengdu/anaconda3/envs/demo/lib/python3.11/concurrent/futures/_base.py", line 401, in get_result raise self._exception IndexError: index 4 is out of bounds for axis 1 with size 4

hainingpan commented 2 months ago

Hi Chai,

Thank you for your question.

Your syntax for calling the code is correct. However, there are some issues related to the physics, specifically with the -mu_lead parameter. The value of mu_lead defines the energy of the incoming propagating wave. If the energy is too small, there are not enough propagating modes in the wire beyond the effective chemical potential in the wire, which results in an incomplete 8 by 8 scattering matrix (s_matrix).

To address this issue, you can increase the value of -mu_lead. For example, you can set it to 25 meV, which is the default value:

mpiexec -n 32 python -m mpi4py.futures Conductance_Kwant/Majorana_main.py -V_bias=0 -mass 0.03 -alpha 0.08 -Delta0 0.12 -L 3 -mu_lead 25 -barrier_E 15 -coupling_SC_SM 0.15 -lead_num=2 -y='mu' -conductance

Alternatively, you can omit the -mu_lead parameter altogether:

mpiexec -n 32 python -m mpi4py.futures Conductance_Kwant/Majorana_main.py -V_bias=0 -mass 0.03 -alpha 0.08 -Delta0 0.12 -L 3 -barrier_E 15 -coupling_SC_SM 0.15 -lead_num=2 -y='mu' -conductance

The results generated should look like this: D0 12a0 08L3 0mL25 0G0 0001bE15 0-Vz(0,2 048),mu(-0 3,0 3)-2L_cond

In principle, if you really need to set mu_lead to a specific value, you may only compute s_matrix up to the same energy scale of the Zeeman energy Vz, which is 0.2 in your command. Data points with a Zeeman energy larger than 0.2 will be problematic due to the reduced number of propagating modes in the wires.

However, you have raised a valid point that highlighted a bug in my code, specifically regarding the plotting of TV and kappa when the y-axis is not set to bias voltage V_bias. This issue has been fixed in commit 12345abc. Let me know if this problem is solved.

Best,
Haining Pan