Skip to content

Commit d4ee83c

Browse files
committed
Merge branch 'release/0.3.1'
2 parents a31e580 + 727a1dd commit d4ee83c

File tree

7 files changed

+6167
-5
lines changed

7 files changed

+6167
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.3.1] - 2020-09-09
2+
3+
* cp2k_pdos: add support for list-of-atoms output
4+
15
## [0.3.0] - 2020-09-09
26

37
* add cp2k_pdos tool

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Modular CP2K output file parsers, mostly in the form of regular expressions plus
77
* `cp2kparse` ... parse CP2K output files (for restart & input files look at the [cp2k-input-tools](https://github.com/cp2k/cp2k-input-tools) project)
88
* `xyz_restart_parser` ... when restarts occur during an MD you may end up with duplicated frames in the trajectory, this tool filters them
99
* `cp2k_bs2csv` ... convert a CP2K band structure file to multiple (one-per-set) CSV files for easier plotting. There is also an API available if you need to import bandstructure data into your application.
10+
* `cp2k_pdos` ... bring CP2Ks PDOS dump into a more CSV-like form for easier plotting/parsing
1011

1112
## Requirements
1213

cp2k_output_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.1"
22

33
__all__ = ["builtin_matchers", "parse_iter"]
44

cp2k_output_tools/scripts/pdos.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""
22
Convert the discrete CP2K PDOS points to a smoothed curve using convoluted gaussians.
3+
4+
If you have separate alpha/beta-spin pdos files (spin-unrestricted calculation),
5+
pass both files as arguments to get one common grid for both of them.
36
"""
47

58
# Copyright (c) 2020 Tiziano Müller <[email protected]>,
@@ -15,7 +18,8 @@
1518

1619

1720
HEADER_MATCH = re.compile(
18-
r"\# Projected DOS for atomic kind (?P<element>\w+) at iteration step i = \d+, E\(Fermi\) = [ \t]* (?P<Efermi>[^\t ]+) a\.u\."
21+
r"\# Projected DOS for (?:atomic kind \w+|list \d+ of \d+ atoms,)"
22+
r" at iteration step i = \d+, E\(Fermi\) = [ \t]* (?P<Efermi>[^\t ]+) a\.u\."
1923
)
2024

2125
# Column indexes, starting from 0
@@ -45,7 +49,7 @@ def cp2k_pdos():
4549
metavar="<PDOS-file>",
4650
type=str,
4751
nargs="+",
48-
help="the PDOS file generated by CP2K, specify two (alpha/beta) files for a common grid",
52+
help="the PDOS file generated by CP2K, specify two files (alpha/beta) in a spin-unrestricted case",
4953
)
5054
parser.add_argument("--sigma", "-s", type=float, default=0.02, help="sigma for the gaussian distribution (default: 0.02)")
5155
parser.add_argument("--de", "-d", type=float, default=0.001, help="integration step size (default: 0.001)")
@@ -67,7 +71,7 @@ def cp2k_pdos():
6771
print(
6872
f"The file '{pdosfilename}' does not look like a CP2K PDOS output.\n"
6973
"If it is indeed a correct output file, please report an issue at\n"
70-
" https://github.com/dev-zero/cp2k-tools/issues"
74+
" https://github.com/cp2k/cp2k-output-tools/issues"
7175
)
7276
sys.exit(1)
7377

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cp2k-output-tools"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "Python tools to handle CP2K output files"
55
authors = ["Tiziano Müller <[email protected]>"]
66
repository = "https://github.com/cp2k/cp2k-output-tools"

tests/inputs/list-of-atoms.pdos

Lines changed: 6144 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_pdos.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ def test_pdos(script_runner):
1010
assert ret.success
1111
assert "Nr of lines: 936" in ret.stderr
1212
assert "Energy_[eV]" in ret.stdout
13+
14+
15+
@pytest.mark.script_launch_mode("subprocess")
16+
def test_pdos_list_of_atoms(script_runner):
17+
ret = script_runner.run("cp2k_pdos", str(TEST_DIR / "inputs" / "list-of-atoms.pdos"))
18+
19+
assert ret.success
20+
assert "Nr of lines: 6142" in ret.stderr
21+
assert "Energy_[eV]" in ret.stdout

0 commit comments

Comments
 (0)