Issues with etsf-io and POT files

External optional components of Abinit (BigDFT, Wannier90...) and codes using/providing data from/to Abinit (AtomPAW, ONCVPSP, EXC, DP, Yambo...)

Moderators: ebousquet, bxu

Locked
User avatar
carsten.fortmann
Posts: 11
Joined: Tue Nov 20, 2012 2:25 pm

Issues with etsf-io and POT files

Post by carsten.fortmann » Thu Dec 20, 2012 2:03 pm

summary: cut3d crashes when attempting to read *-etsf.nc potential files.

---------------------------------------

description
abinit version: 6.12.3 built from sources w/ etsf-io fallback connector
platform: linux x86-64 3.2.x kernel

for several reasons i rely on the etsf-io capability, so my typical input files look like this one:

Code: Select all

acell 1 1 1 angstrom
    rprim  0.00000000  2.71530000  2.71530000
           2.71530000  0.00000000  2.71530000
           2.71530000  2.71530000  0.00000000

# Atomic type information
ntypat 1
typat 1 1
znucl 14

# Atomic positions
natom 2
xred 0.0000 0.0000 0.0000
     0.2500 0.2500 0.2500


# Exchange Correlation Parameters
ixc -001009
nsppol 1
nspinor 1
nspden 1

# Iteration Control Parameters
iscf 17
nstep 40
npulayit 5
iprcel 0
toldfe 1e-06

# Numerical Accuracy Parameters
tphysel 0
ngkpt 3 3 3

# Basis Set Parameters
nband 16
ecut 20

# Additional Parameters
chksymbreak 0
chkprim 0

# Output control
# Print results to *-etsf.nc netcdf files.
accesswff 3
istwfk *1
prteig 1
prtpot 1

abinit successfully returns and generates a couple of *-etsf.nc netcdf files, e.g. output_POT-etsf.nc.
i open the POT using the ase.io.pupynere module (python script):

Code: Select all

#file readpot.py
import ase.io.pupynere as ase_pupynere
import numpy
potfile = ase_pupynere.NetCDFFile('output_POT-etsf.nc','r')
# 'exchange_correlation_potential' is the only 3D scalar field variable in the file,
# so i figure it is the eff. potential.
potential = potfile.variables['exchange_correlation_potential'].data
print potential[0,0,0,0]


Code: Select all

$> python readpot.py
9.96920997e+36

same for all other indices. :(

:idea: ok, maybe i should not read the file directly but use cut3d, instead.

Code: Select all

$> cut3d
  What is the name of the 3D function (density, potential or wavef) file ?
output_POT-etsf.nc
  => Your 3D function file is : output_POT-etsf.nc
 
  Does this file contain formatted 3D ASCII data (=0) 
   or unformatted binary header + 3D data        (=1) ?
   or ETSF binary                                (=2) ?
2
  2 => Your file contains ETSF data
  The information it contains should be sufficient.
 WffOpen: opening output_POT-etsf.nc on unit 3
  cut3d : read file output_POT-etsf.nc.
 
 hdr_io_etsf: accessing ABINIT specific data from unit 3

 hdr_io_etsf.F90:186:WARNING
   Backtrace          : etsf_io_low_read_dim()
  Action performed   : inquire dimension ID
  Target (name)      : rhoijdim2
  Error message      : NetCDF: Invalid dimension ID or name
  Error id           : -46


 hdr_io_etsf.F90:240:ERROR
   Backtrace          : read_var_integer_1D()
                       read_var_infos_name()
  Action performed   : inquire variable ID
  Target (name)      : number_of_wavelets
  Error message      : NetCDF: Variable not found
  Error id           : -49


 hdr_io_etsf.F90:240:ERROR
   Backtrace          : read_var_integer_1D()
                       read_var_infos_name()
  Action performed   : inquire variable ID
  Target (name)      : number_of_wavelets
  Error message      : NetCDF: Variable not found
  Error id           : -49


 leave_new : decision taken to exit ...

:?: ase.io.pupynere reads the file but it does not contain sensible data and cut3d cannot read it.

finally, i resort to remove the lines accesswff 3 and istwfk *1 from the input file, so that abinit writes unformatted binary files. cut3d then successfully reads the potential file (output_POT).

running the original input file but replacing "prtpot" by e.g. "prtvxc" or "prtvha", so as to obtain the exchange-correlation and hartree potentials, respectively, i receive etsf.nc files that now contain valid potential data but that are again not readable by cut3d. same result if i have "prtvxc 1" and "prtvha 1" both enabled at the same time. as a check, i also write to unformatted VXC and VHA binary files, read them using cut3d, and the data are identical to the corresponding NetCDFFile().variables['exchange_correlation_potential'].data objects.
last, by enabling "prtpot 1" additionaly, all three etsf.nc files (VXC, VHA, and POT) now contain the same non-sense large numbers as described above and are (as always) not readable by cut3d.

any ideas? need more info? should this be filed as a bug?

i'm open to any suggestions.

thanks, carsten

rangel
Posts: 45
Joined: Tue Aug 18, 2009 9:50 pm

Re: Issues with etsf-io and POT files

Post by rangel » Thu May 16, 2013 2:45 pm

There might be an issue with the netcdf format.
I have never used this option, so I cannot help much.

But one should be able to use the standard binary format and cut3d.
There are several options with cut3d (e.g., to obtain the full potential all along the box, or along a vector, xmgrace format, etc..).
Do they all give wrong results?

Best wishes,
Tonatiuh Rangel
Tonatiuh Rangel

dcaliste
Posts: 44
Joined: Thu Oct 22, 2009 9:15 am
Contact:

Re: Issues with etsf-io and POT files

Post by dcaliste » Tue May 28, 2013 12:33 pm

I confirm that the POT file is empty, while the DEN file is OK. I'll investigate.

After investigation, it looks like a on-purpose restriction, quoting 95_drive/outscfcv.F90:671

Code: Select all

!    MJV note: why is accessfil forced to 0???? This disables the writing of ETSF
!    format potentials!
!   
!    set to 1 for netcdf output
     accessfil = 0


Why is it like that, I've no idea. Removing this

Code: Select all

accessfil = 0
statement should solve the problem.

simpak
Posts: 1
Joined: Fri Jun 21, 2013 8:23 am

Re: Issues with etsf-io and POT files

Post by simpak » Fri Jun 21, 2013 8:25 am

carsten.fortmann wrote:summary: cut3d crashes when attempting to read *-etsf.nc potential files.

---------------------------------------

description
abinit version: 6.12.3 built from sources w/ etsf-io fallback connector
platform: linux x86-64 3.2.x kernel

for several reasons i rely on the etsf-io capability, so my typical input files look like this one:

Code: Select all

acell 1 1 1 angstrom
    rprim  0.00000000  2.71530000  2.71530000
           2.71530000  0.00000000  2.71530000
           2.71530000  2.71530000  0.00000000

# Atomic type information
ntypat 1
typat 1 1
znucl 14

# Atomic positions
natom 2
xred 0.0000 0.0000 0.0000
     0.2500 0.2500 0.2500


# Exchange Correlation Parameters
ixc -001009
nsppol 1
nspinor 1
nspden 1

# Iteration Control Parameters
iscf 17
nstep 40
npulayit 5
iprcel 0
toldfe 1e-06

# Numerical Accuracy Parameters
tphysel 0
ngkpt 3 3 3

# Basis Set Parameters
nband 16
ecut 20

# Additional Parameters
chksymbreak 0
chkprim 0

# Output control
# Print results to *-etsf.nc netcdf files.
accesswff 3
istwfk *1
prteig 1
prtpot 1

abinit successfully returns and generates a couple of *-etsf.nc netcdf files, e.g. output_POT-etsf.nc.
i open the POT using the ase.io.pupynere module (python script):

Code: Select all

#file readpot.py
import ase.io.pupynere as ase_pupynere
import numpy
potfile = ase_pupynere.NetCDFFile('output_POT-etsf.nc','r')
# 'exchange_correlation_potential' is the only 3D scalar field variable in the file,
# so i figure it is the eff. potential.
potential = potfile.variables['exchange_correlation_potential'].data
print potential[0,0,0,0]


Code: Select all

$> python readpot.py
9.96920997e+36

same for all other indices. :(

:idea: ok, maybe i should not read the file directly but use cut3d, instead.

Code: Select all

$> cut3d
  What is the name of the 3D function (density, potential or wavef) file ?
output_POT-etsf.nc
  => Your 3D function file is : output_POT-etsf.nc
 
  Does this file contain formatted 3D ASCII data (=0) 
   or unformatted binary header + 3D data        (=1) ?
   or ETSF binary                                (=2) ?
2
  2 => Your file contains ETSF data
  The information it contains should be sufficient.
 WffOpen: opening output_POT-etsf.nc on unit 3
  cut3d : read file output_POT-etsf.nc.
 
 hdr_io_etsf: accessing ABINIT specific data from unit 3

 hdr_io_etsf.F90:186:WARNING
   Backtrace          : etsf_io_low_read_dim()
  Action performed   : inquire dimension ID
  Target (name)      : rhoijdim2
  Error message      : NetCDF: Invalid dimension ID or name
  Error id           : -46


 hdr_io_etsf.F90:240:ERROR
   Backtrace          : read_var_integer_1D()
                       read_var_infos_name()
  Action performed   : inquire variable ID
  Target (name)      : number_of_wavelets
  Error message      : NetCDF: Variable not found
  Error id           : -49


 hdr_io_etsf.F90:240:ERROR
   Backtrace          : read_var_integer_1D()
                       read_var_infos_name()
  Action performed   : inquire variable ID
  Target (name)      : number_of_wavelets
  Error message      : NetCDF: Variable not found
  Error id           : -49


 leave_new : decision taken to exit ...

:?: ase.io.pupynere reads the file but it does not contain sensible data and cut3d cannot read it.

finally, i resort to remove the lines accesswff 3 and istwfk *1 from the input file, so that abinit writes unformatted binary files. cut3d then successfully reads the potential file (output_POT).

running the original input file but replacing "prtpot" by e.g. "prtvxc" or "prtvha", so as to obtain the exchange-correlation and hartree potentials, respectively, i receive etsf.nc files that now contain valid potential data but that are again not readable by cut3d. same result if i have "prtvxc 1" and "prtvha 1" both enabled at the same time. as a check, i also write to unformatted VXC and VHA binary files, read them using cut3d, and the data are identical to the corresponding NetCDFFile().variables['exchange_correlation_potential'].data objects.
last, by enabling "prtpot 1" additionaly, all three etsf.nc files (VXC, VHA, and POT) now contain the same non-sense large numbers as described above and are (as always) not readable by cut3d.

any ideas? need more info? should this be filed as a bug?

i'm open to any suggestions.

thanks, carsten



this is really hard Man, :)

User avatar
carsten.fortmann
Posts: 11
Joined: Tue Nov 20, 2012 2:25 pm

Re: Issues with etsf-io and POT files

Post by carsten.fortmann » Mon Oct 14, 2013 10:59 am

simpak, i know, MAN.

but thanks for the hint, dcaliste, i'll try it out.

Locked