Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
qbox
qbox-public
Commits
2a6b99f8
Commit
2a6b99f8
authored
Feb 22, 2022
by
Francois Gygi
Browse files
Update qbox_dos.py, add ef parameter
parent
12b8adb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
util/qbox_dos.py
View file @
2a6b99f8
#!/usr/bin/python
# qbox_dos.py: extract electronic DOS from Qbox output
# generate DOS plot in gnuplot format
# use: qbox_dos.py [-last] emin emax width file.r
# emin, emax: bounds of plot in [eV]
# use: qbox_dos.py [-last] emin emax ef width file.r
# emin, emax: bounds of plot in [eV] relative to ef
# ef: value of Fermi energy [eV]
# width: gaussian broadening in [eV]
# the DOS is accumulated separately for each spin
# With the -last option, only the last <eigenset> is used to compute the DOS
...
...
@@ -11,8 +12,8 @@ import xml.sax
import
sys
import
math
if
(
len
(
sys
.
argv
)
!=
5
)
and
(
len
(
sys
.
argv
)
!=
6
)
:
print
"use: "
,
sys
.
argv
[
0
],
" [-last] emin emax width file.r"
if
(
len
(
sys
.
argv
)
!=
6
)
and
(
len
(
sys
.
argv
)
!=
7
)
:
print
"use: "
,
sys
.
argv
[
0
],
" [-last] emin emax
ef
width file.r"
sys
.
exit
()
iarg
=
1
...
...
@@ -25,6 +26,8 @@ emin = float(sys.argv[iarg])
iarg
+=
1
emax
=
float
(
sys
.
argv
[
iarg
])
iarg
+=
1
ef
=
float
(
sys
.
argv
[
iarg
])
iarg
+=
1
width
=
float
(
sys
.
argv
[
iarg
])
iarg
+=
1
infile
=
sys
.
argv
[
iarg
]
...
...
@@ -74,22 +77,22 @@ class QboxOutputHandler(xml.sax.handler.ContentHandler):
for
i
in
range
(
len
(
self
.
e
)):
for
j
in
range
(
ndos
):
ej
=
emin
+
j
*
de
self
.
dos_up
[
j
]
+=
gauss
(
float
(
self
.
e
[
i
])
-
ej
,
width
)
*
self
.
weight
self
.
dos_up
[
j
]
+=
gauss
(
float
(
self
.
e
[
i
])
-
ef
-
ej
,
width
)
*
self
.
weight
if
self
.
spin
==
1
:
for
i
in
range
(
len
(
self
.
e
)):
for
j
in
range
(
ndos
):
ej
=
emin
+
j
*
de
self
.
dos_dn
[
j
]
+=
gauss
(
float
(
self
.
e
[
i
])
-
ej
,
width
)
*
self
.
weight
self
.
dos_dn
[
j
]
+=
gauss
(
float
(
self
.
e
[
i
]
-
ef
)
-
ej
,
width
)
*
self
.
weight
def
print_dos
(
self
):
print
"# "
,
infile
,
" spin=0 width="
,
width
print
"# "
,
infile
,
"
ef="
,
ef
,
"
spin=0 width="
,
width
for
j
in
range
(
ndos
):
ej
=
emin
+
j
*
de
print
ej
,
self
.
dos_up
[
j
]
if
self
.
nspin
==
2
:
print
print
print
"# "
,
infile
,
" spin=1 width="
,
width
print
"# "
,
infile
,
"
ef="
,
ef
,
"
spin=1 width="
,
width
for
j
in
range
(
ndos
):
ej
=
emin
+
j
*
de
print
ej
,
self
.
dos_dn
[
j
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment