Dear Adel thanks a lot. very useful.

Garanti sans virus.

Le lun. 7 sept. 2020 à 16:17, Abbout Adel <> a écrit :
Dear Adel,

The post by Christoph you are referring to is just a reflection and an invitation to think about parallelization in kwant.
It is not implemented in kwant. As the error message suggests, there is no argument  "comm=MPI.COMM_WORLD" in the scattering matrix.

If you want to run your code in parallel, you can do a simple change in your code as follows:

import numpy as np
import kwant
from mpi4py import MPI
rank = comm.Get_rank()
nprocessor = comm.size

def make_sys():
      return sys.finalized()


for energy in energies:

So, your code will return a number  "nprocessor" .npy files of the transmission, each one of them is for a range of energies.

I hope this helps

On Sun, Sep 6, 2020 at 2:43 PM Adel Belayadi <> wrote:
Dear user
I hope you are doing well.
I am having troubles when using parallel distribution to run my python script using kwant.

I  went through kwant discuss mailing list and tried to read about similar issues. I have red for instance the comment made by hristoph Groth Mon, 08 Aug 2016 08:12:46 -0700.
add "from mpi4py import MPI" in the preamble,
• substitute kwant.smatrix(…) -> kwant.smatrix(…, comm=MPI.COMM_WORLD), • execute the script using "mpiexec",

I have got an error while using kwant.smatrix(comm=MPI.COMM_WORLD).
kwant does not recognize comm
TypeError: got an unexpected keyword argument 'comm'

I have also tried without comm but with the following command
mpiexec -n 4 python
mpirun.openmpi -n 4 -x OMP_NUM_THREADS=1 python

but I got the result 4 times


Abbout Adel