dipc-cc / hubbard

Python tools for mean-field Hubbard models
https://dipc-cc.github.io/hubbard/
GNU Lesser General Public License v3.0
21 stars 8 forks source link

Permission Error in clar-goblet example #114

Closed PG13s closed 2 years ago

PG13s commented 2 years ago

Dear authors: I‘m testing the clar-goblet molecule example and run : python compute_FM-AFM.py, it comes out:

Traceback (most recent call last):
  File "/public/home/user/Package/dipc-cc_hubbard/examples/molecules/clar-goblet/compute_FM-AFM.py", line 51, in <module>
    H.write_density('clar-goblet.nc')
  File "/public/home/user/anaconda3/lib/python3.9/site-packages/hubbard/hamiltonian.py", line 419, in write_density
    fh = nc.ncSileHubbard(fn, mode=mode)
  File "/public/home/user/anaconda3/lib/python3.9/site-packages/sisl/io/sile.py", line 729, in __init__
    self.__dict__['fh'] = _netCDF4.Dataset(str(self.file), self._mode,
  File "src/netCDF4/_netCDF4.pyx", line 2307, in netCDF4._netCDF4.Dataset.__init__
  File "src/netCDF4/_netCDF4.pyx", line 1925, in netCDF4._netCDF4._ensure_nc_success
PermissionError: [Errno 13] Permission denied: b'clar-goblet.nc'

Why is there a permission request for clar-goblet.nc? I‘m not root user and chmod 777 doesn't works. By the way, does this hubbard code support 2D or 3D crystal MFH calculation if I use sisl to create graphene or diamond geometry? Thank you!

sofiasanz commented 2 years ago

Hi! This permission issue has nothing to do with root permissions, is an issue coming from the way in which we write the densities in netcdf format. This issue comes from a recent update in these functions, I changed it and now it should work, could you try with the last version?

sofiasanz commented 2 years ago

By the way, does this hubbard code support 2D or 3D crystal MFH calculation if I use sisl to create graphene or diamond geometry?

Yes, it works. You just have to pass a number of k-points to sample the Brillouin zone in all directions of periodicity when creating the HubbardHamiltonian object:

HubbardHamiltonian(TBHam, U, kT, nkpt=[nkx, nky, nkz])

Where nkx, nky, nkz should be larger than one if the system is periodic along is periodic along the 0,1,2 axis.

PG13s commented 2 years ago

Hi! This permission issue has nothing to do with root permissions, is an issue coming from the way in which we write the densities in netcdf format. This issue comes from a recent update in these functions, I changed it and now it should work, could you try with the last version?

Thanks for your reply, how to uninstall the old hubbard? It gets error if I install the new one: Successfully built hubbard Installing collected packages: hubbard Attempting uninstall: hubbard Found existing installation: hubbard 0.0.0 ERROR: Cannot uninstall 'hubbard'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

sofiasanz commented 2 years ago

It's not needed to uninstall hubbard, you can either reinstall it and it will overwrite your last version installed or have an environment variable in you .bashrc script:

export PYTHONPATH=path-to-hubbard7hubbard/:${PYTHONPATH}
zerothi commented 2 years ago

This is probably related to my changes in #111, I need to do some additional testing... Hmm....

PG13s commented 2 years ago

Thanks, by installing the new hubbard, there is no error going out!

It's not needed to uninstall hubbard, you can either reinstall it and it will overwrite your last version installed or have an environment variable in you .bashrc script:

export PYTHONPATH=path-to-hubbard7hubbard/:${PYTHONPATH}
PG13s commented 2 years ago

By the way, does this hubbard code support 2D or 3D crystal MFH calculation if I use sisl to create graphene or diamond geometry?

Yes, it works. You just have to pass a number of k-points to sample the Brillouin zone in all directions of periodicity when creating the HubbardHamiltonian object:

HubbardHamiltonian(TBHam, U, kT, nkpt=[nkx, nky, nkz])

Where nkx, nky, nkz should be larger than one if the system is periodic along is periodic along the 0,1,2 axis.

Thank you a lot, I will try.