Partial charge density

Dear all,
I wonder if it is possible to calculate the partial charge density by selecting an eigenvalue energy range from a previously converged SCF. I saw that one way is to fix the occupancy of selected bands and recalculate the density but it is not exactly what I need; also, it is not possible to fix the occupancy and the charge density at the same time, which is what is closer to my need. Another option is to generate xsf files using cut3d by selecting specific k-points and bands one by one and then sum all the charge density files by any means or software, like VESTA for example. However, this last part is very time consuming because cut3d runs only in interactive modes and cannot be used in a bash script. What I need is the equivalent of what is described here

https://www.vasp.at/wiki/index.php/Band_decomposed_charge_densities

for the VASP software.

Do you have any suggestion?
Thanks a lot in advance.

Antonio

Hi Antonio,

Regarding your second part of the comment, cut3d can be, in fact, automatized and therefore used in a bash script. Please have a look at the internal test v2[77]

This is the input of v2_77:
(Of course at this level the following lines don’t mean much without seeing the actual options, but I left it here as an example)

------t77.abi----below----
t76o_DS1_DEN
2
2
-0.25 -0.25 -0.25
 1.50  1.50  1.50
70
t77.abo
1
5
t77.aboden
0
---------------------------

And you can use simply cut3d < t77.abi once you have, in this case, the density file t76o_DS1_DEN available. That obviously can be replaced by other suitable files for cut3d.
If you need a separation of bands and k-points I recommend looking at the test file v3_t67 where the WF file is treated.

Regarding the first part of your comment, you can run cut3d and direct all your output to a generic
CUT3DDENPOT.nc (netcdf file) with option 15 if you want a more versatile way of dealing with the data.
This file can be handled by AbiPy simply issuing in a python script:

from abipy import abilab
myfile=abilab.abiopen("CUT3DDENPOT.nc")
myfile.get_dims_dataframe()
                                 value
complex                              2
symbol_length                        2
character_string_length             80
number_of_cartesian_directions       3
number_of_reduced_dimensions         3
number_of_vectors                    3
one                                  1
two                                  2
three                                3
four                                 4
five                                 5
six                                  6
seven                                7
eight                                8
nine                                 9
ten                                 10
fnlen                              265
real_or_complex_density              1
number_of_grid_points_vector1       16
number_of_grid_points_vector2       16
number_of_grid_points_vector3       16
number_of_components                 1
max_number_of_states                 4
number_of_atoms                      2
number_of_atom_species               1
number_of_kpoints                    2
number_of_spinor_components          1
number_of_spins                      1
number_of_symmetry_operations       48
npsp                                 1
codvsnlen                            8
psptitlen                          132
nshiftk_orig                         1
nshiftk                              1
bantot                               8
md5_slen                            32
number_of_atom_pseudopotentials      1

After this you can use the dataframe at your will. You can also use directly in python the cut3d utility via one of abipy classes(see the python class here abio Package — abipy 0.9.1 documentation )

Good luck and let us know if this solution worked for you.
Bogdan

The solution with the nc file didn’t work for me. However, I can use the cut3d solution that you suggested. I can make a bash script which calls cut3d in a loop and generates all the xsf density files which correspond to selected band and k-points; then I can create one xsf density file by summing the single densities contained in each xsf file. This could be done in python if the nc file contained the eigenvalues with the corresponding k-point and band index, but I didn’t find this information in the nc file.

Thanks a lot for the answer!

Antonio