Abipy - write bands etc. to text files

Hi all,

just wondering if there is a simple way to write bands (and DOS, fat bands) from abipy to a text file? i.e. columns with the points along the kpath and the eigenvalues at each point.

It’s really useful for visualising results, but I wanted to make some plots using gnuplot and can’t see a simple way to write the outputs to text files. Abinit prints the bands in xmgrace format, and it would be quite cumbersome to convert to something that gnuplot can use

Hi @dbennett1994

usually if I want the raw data (e.g. to make my own plots) I directly read Abinit’s output data from the netcdf files like EIG.nc, WFK.nc or DOS.nc, with either Python’s netcdf4 library or with Matlab’s functions like ncread, without passing through AbiPy. From those files you can for sure access bands, wavefunction coefficients and density of states.

For example if you want to plot the bands yourself, you can read the EIG.nc file corresponding to the dataset/input file that does the interpolation along a high-symmetry line.

I don’t know if the fat bands have their own netcdf file or the variables are just printed in the same EIG/WFK file, so for that you should wait for somebody with more experience to reply.


1 Like

Hi Danny,
On my side I’m using prtebands flag (Ground-State - abinit) to get gnuplot files (or xmgrace depending what you prefer) that are fast to handle.

1 Like

Thanks @LucaBuia and @ebousquet ! I’ll take a look at python-netcdf. I’m pretty sure abinit prints .nc for fat bands, LDOS etc. Also I was not aware of the prtebands option, this will save me a lot of hassle as I prefer to make plots with gnuplot rather than grace or python