This script calculates the bare Coulomb matrix elements using real space Wannier functions (xsf files)
python version requires numba
c++ version can be complied with OpenMP via CMake:
mkdir build
cd build/
cmake ..
make
Run python Wannier_Coulomb.py or Wannier_Coulomb.x in the same directory with W1.xsf and W2.xsf files from wannier90. Play with mc_steps parameter to reach the required accuracy. Optionally set r_center and r_cut to reduce the size for Monte Carlo sampling, but keeping the norms of Wannier functions close to 1.