zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
201 stars 60 forks source link

Siesta read wfs and wfsx files #147

Closed zerothi closed 1 year ago

zerothi commented 5 years ago

Describe the feature Title says it all.

Probably this should only be in fdf since then we can read the Hamiltonian and associate it simultaneously with the gauge.

zerothi commented 4 years ago

Given this some thought and files should implement this read_state method

pfebrer commented 4 years ago

This would be very nice to have :)

zerothi commented 4 years ago

I'll reopen since it is not stable for real use. It is slow and only provides one way of dealing with it.

pfebrer commented 3 years ago

I would like to improve the reading of WFSX files so that it is usable in practice for visualization purposes. I have two different use cases:

Also, I've done a quick search to know if direct accessing is a possibility (i.e. going directly to the part of the file where the WF that we want is). It seems like there are portability issues between fortran runtimes. Is that right? Do you know if it could be possible to use for WFSX files?

zerothi commented 3 years ago

Good idea, could you have a look in the gf fortran sources, they can do this and is quite sufficient in performance!

pfebrer commented 3 years ago

What do I have to do to test changes in fortran sources? Reinstall sisl again?

zerothi commented 3 years ago

What do I have to do to test changes in fortran sources? Reinstall sisl again?

Yes, it is fastest locally, and fortran codes are quite fast to compile, so I don't think it should be a problem? A little tedious, but ok...

pfebrer commented 3 years ago

So say I add a new function in sisl/io/siesta/wfsx_read.f90. Just doing pip uninstall sisl and pip install sisl should make the function available under sisl.io.siesta._siesta?

zerothi commented 3 years ago

Yes, if all you do is change the wfsx_read.f90 source file, then all you need is to re-install the code to ensure it gets compiled. This should also be trivially seen when installing, it lists gfortran commands if it compiles the sources, and setuptools detects changes from a build directory. So you don't need anything special in this regard.

Only if you want to add a file (which I don't think you need, except if you need wfsx_write.f90?).

I would encourage you to do the same as in sisl/io/siesta/_src/gf_read.f90 for consistency, there exists a function read_gf_find which jumps the file-handle forward to the correct position (just before the actual data). Then a subsequent read returns the data.

As a last remark, note that WFSX files contain the k-points in 1/bohr units (as far as I recall).

zerothi commented 3 years ago

Oh, and check the _gfSile which contains the file handle. The wfsx_read.f90 should be changed quite a bit to store file unit from fortran. In that way you can have the file open and need not read through the entire file on every call (this is what can be very problematic...)

zerothi commented 3 years ago

Also, I've done a quick search to know if direct accessing is a possibility (i.e. going directly to the part of the file where the WF that we want is). It seems like there are portability issues between fortran runtimes. Is that right? Do you know if it could be possible to use for WFSX files?

This won't work due to the incompatibilities as you mention. Storing the file handle in the python object is the way forward :)

zerothi commented 1 year ago

I believe @pfebrer has done everything here :) I'll close this.