How to download the total dos?

I often use get_dos_by_material_id to get Dos information.
But I don’t know how to get total dos.
If I do this,

from pymatgen import MPRester 

key = MPRester("my_API_key")

data = key.get_dos_by_material_id('mp-635471')

print(data)
Complete DOS for Full Formula (Ni3 Pt1)

 Reduced Formula: Ni3Pt

 abc   :   3.648502   3.648502   3.648502

 angles:  90.000000  90.000000  90.000000

 Sites (4)

   #  SP      a    b    c

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

   0  Ni    0.5  0    0.5

   1  Ni    0    0.5  0.5

   2  Ni    0.5  0.5  0

   3  Pt    0    0    0

But I want to get the value of the energy and the density of states about total dos.
I already have checked the type of “data”.
That is <class ‘pymatgen.electronic_structure.dos.CompleteDos’>.
I can’t find the def. to get the total dos value at that class.
Is there any method to get the total dos directly from pymatgen?

1 Like

Hello Fred,

A solution is to do:

m = MPRester(‘api_key’)
dos = m.get_dos_by_material_id(‘mp_id’)
total_dos = sum(dos.densities.values())

This will also sum both spins if present.

I hope this helps!

Howard Yanxon

3 Likes