Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate dat file from output for further plotting #153

Open
danasad80 opened this issue Jul 11, 2024 · 5 comments
Open

How to generate dat file from output for further plotting #153

danasad80 opened this issue Jul 11, 2024 · 5 comments

Comments

@danasad80
Copy link

Dear All,

I am new to using PYPROCAR. I have two questions which will be really helpful for me:

  1. Is there a possibility to change format of the plotting, for example, a 'stacked_species' comes with filled areas by default. Is there any way of getting normal curve without filled areas

  2. Can I get the output of pyprocar in '.dat' format for further plotting (e.g. gnuplot) and analysis.

Thanks!
Danial Asad

@lllangWV
Copy link
Member

Hey Daniel.

  1. Is there a possibility to change format of the plotting, for example, a 'stacked_species' comes with filled areas by default. Is there any way of getting normal curve without filled areas.

You can use mode=overlay_species, to get the curves without the filled areas.

  1. Can I get the output of pyprocar in '.dat' format for further plotting (e.g. gnuplot) and analysis.

Currently, there isn't. Though you dosplot does return matplotlib.axes object, so you could extract the curves from there

I could add an option to save all the curves in a json file.

A possible implementation would look like this

pyprocar.dosplot(
                    code='vasp',
                    mode='stack_species',
                    orbitals = [4,5,6,7,8],
                    spins=[0,1],
                    clim=[0,1],
                    orientation='horizontal',
                    fermi=5.3017,
                    dirname=data_dir,
                    export_data='{path to file}.json'
)

Then the json would look like this:

{
"energies":  values
"dos_total_spin-0":  values
"dos_total_spin-1":  values
"Sr-d_spin-0-projected": values
"O-d_spin-0-projected": values
"V-d_spin-0-projected": values
}

Something like this. If you have any suggestions on how the format let me know!

Best,

Logan Lang

@danasad80
Copy link
Author

Hi Logan,

Thanks for your kind reply. I think it will be really nice if one can also get the data in traditiional '.dat' format to be plotted in gnuplot etc. But JSON solution should also work!

cheer,
Daniel Asad.

@lllangWV
Copy link
Member

Hey Daniel,

I have been quite busy, I will get to this tomorrow afternoon. It shouldn't take me long to do this.

Logan Lang

@lllangWV
Copy link
Member

Hey Daniel,

I have added an option to export the data into a csv,json,dat,txt file.

Here what the .dat file looks like. It has a header column, then the data. The column names should be self described.

energies dosTotalSpin-0 dosTotalSpin-1 spinChannel-0_orbitals-4:5:6:7:8_atoms-2:3:4_spinProjection-0:1 spinChannel-0_orbitals-4:5:6:7:8_atoms-0_spinProjection-0:1 spinChannel-0_orbitals-4:5:6:7:8_atoms-1_spinProjection-0:1 spinChannel-1_orbitals-4:5:6:7:8_atoms-2:3:4_spinProjection-0:1 spinChannel-1_orbitals-4:5:6:7:8_atoms-0_spinProjection-0:1 spinChannel-1_orbitals-4:5:6:7:8_atoms-1_spinProjection-0:1
-36.5055 0.0 -0.0 0.0 0.0 0.0 -0.0 -0.0 -0.0
-36.497699999999995 0.0 -0.0 0.0 0.0 0.0 -0.0 -0.0 -0.0

Here is how to do this:

pyprocar.dosplot(
                    code='vasp',
                    mode='stack_species',
                    orbitals = [4,5,6,7,8],
                    spins=[0,1],
                    clim=[0,1],
                    # orientation='horizontal',
                    orientation='vertical',
                    fermi=5.3017,
                    grid=True,
                    dirname=data_dir,
                    export_data_file=os.path.join(curent_dir,'data.dat'),
                    # export_data_file=os.path.join(curent_dir,'data.csv'),
                    # export_data_file=os.path.join(curent_dir,'data.json'),
                    # export_data_file=os.path.join(curent_dir,'data.txt'),
                    )

I have pushed my changes to the main branch. I am not going to immediately update pypi or conda, as there are other issues I am working on. So if you want to use the most updated changes clone the repository and install that version

git clone [email protected]:romerogroup/pyprocar.git
cd pyprocar
pip install -e .

Tell me if there is anything else you would like.

Logan Lang

@danasad80
Copy link
Author

danasad80 commented Jul 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants