Closed zerothi closed 1 year ago
Given this some thought and files should implement this read_state
method
This would be very nice to have :)
I'll reopen since it is not stable for real use. It is slow and only provides one way of dealing with it.
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:
_siesta.read_wfsx_index_*
to read the eigenstate. This would be simple and scale linearly because the worst case is that you need to read the full file twice. Not optimal I guess but better than the current implementation._siesta.read_wfsx_index_*
it doesn't read the file from the beginning again? Otherwise could a temporary solution be to just read everything in one go? It could make the computer run out of memory, but at least it would be usable for not that big WFSX files and again much faster than the current implementation.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?
Good idea, could you have a look in the gf fortran sources, they can do this and is quite sufficient in performance!
What do I have to do to test changes in fortran sources? Reinstall sisl again?
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...
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
?
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).
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...)
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 :)
I believe @pfebrer has done everything here :) I'll close this.
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.