Dear Anna,

1. In the newer versions of Kwant you must define the `norbs`, it may not be up 
to date everywhere in the documentation. Certainly the `kpm` module makes use 
of this parameter of your system.

2. The Kubo conductivity is calculated as a trace per unit cell, you can see 
the details in the references cited in the documentation of the 
`kpm.conductivity` function. 
For a finite system with open boudary conditions, the results will make sense 
if you compute this local quantity in the bulk of your system far away from the 
edges. To do this, you can make use of the `vector_factory` argument in the 
`kpm` module, for example with the `kwant.kom.LocalVectors` class.

The finite system does not need to have leads as we don't compute currents or 
scattering states, we compute the linear response (in some direction `x_alpha`) 
of the system to an electric field in some other direction (`x_beta`). These 
directions enter in the conductivity function with the `alpha`, and `beta` 
arguments. 


For systems with periodic boundary conditions you need to define periodic 
velocity operatos and pass them to `kpm.conductivity`. This is not implemented 
in Kwant and can be tricky to define.

In both cases, you need to normalize the results by the area that each of your 
vectors cover.

By the way, I tried running your sistem and does not show a gap. Therefore, the 
conductivities are not quantized to a topological invariant.

Here a snippet of how you could define the local vectors in your case

```
    edge_width = min(L, W) / 4
    
    def center(s):
        return (edge_width <= s.pos[0] < L - edge_width) and (edge_width <= 
s.pos[1] < W - edge_width)
    
    center_vectors = np.array(list(kwant.kpm.RandomVectors(syst, where=center)))
    # here kwant.kpm.LocalVectors can also be used, but will produce much more 
vectors
    num_vectors = len(center_vectors)
    norm = np.linalg.norm(center_vectors[0]) ** 2
    
    num_vectors=num_vectors, vector_factory=center_vectors
```

I hope this helps, regards,
Pablo

Reply via email to