File: dos.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (32 lines) | stat: -rw-r--r-- 581 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# creates: dos.png
import matplotlib.pyplot as plt
import numpy as np

from ase.dft import DOS


class MyCalc:
    def get_eigenvalues(self, kpt=0, spin=0):
        return np.random.uniform(-5.0, 2.0, 90)

    def get_k_point_weights(self):
        return [1.0]

    def get_number_of_spins(self):
        return 1

    def get_fermi_level(self):
        return 0.0


calc = MyCalc()
dos = DOS(calc, width=0.2)
d = dos.get_dos()
e = dos.get_energies()

plt.figure(figsize=(5, 4))
plt.plot(e, d)
plt.xlabel('energy [eV]')
plt.ylabel('DOS')
plt.tight_layout()
plt.savefig('dos.png')