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

Adding tests for BoltzWann (at least for the electrical conductivity) #282

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test-suite/tests/jobconfig
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ program = POSTW90_GENINTERPDAT_OK
inputs_args = ('silicon.win', '')
output = silicon_geninterp.dat

# Test of the electrical conductivity in BoltzWann
[testpostw90_boltzwann/]
program = POSTW90_BOLTZWANN_ELCOND_OK
inputs_args = ('silicon.win', '')
output = silicon_elcond.dat

# Test of AHC for bcc iron
[testpostw90_fe_ahc/]
program = POSTW90_WPOUT_OK
Expand Down
9 changes: 9 additions & 0 deletions test-suite/tests/testpostw90_boltzwann/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
silicon.wpout
silicon.mmn
silicon_boltzdos.dat
silicon_kappa.dat
silicon_seebeck.dat
silicon_sigmas.dat
silicon_tdf.dat


14 changes: 14 additions & 0 deletions test-suite/tests/testpostw90_boltzwann/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all: $(patsubst %.chk.fmt.bz2, %.chk, $(wildcard *.chk.fmt.bz2)) $(patsubst %.mmn.bz2, %.mmn, $(wildcard *.mmn.bz2))

%.chk: %.chk.fmt.bz2
$(eval SEEDNAME:=$(patsubst %.chk.fmt.bz2, %, $<))
echo $(SEEDNAME)
cat $< | bunzip2 - > $(SEEDNAME).chk.fmt && ../../../w90chk2chk.x -f2u $(SEEDNAME) && rm $(SEEDNAME).chk.fmt

%.mmn: %.mmn.bz2
$(eval SEEDNAME:=$(patsubst %.mmn.bz2, %, $<))
echo $(SEEDNAME)
cat $< | bunzip2 - > $(SEEDNAME).mmn


.PHONY: all
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Written by the BoltzWann module of the Wannier90 code.
# [Electrical conductivity in SI units, i.e. in 1/Ohm/m]
# Mu(eV) Temp(K) ElCond_xx ElCond_xy ElCond_yy ElCond_xz ElCond_yz ElCond_zz
5.000000000 300.0000000 6504317.803 -207173.9111 6669730.422 200281.9835 209188.4251 6478066.135
6,146 changes: 6,146 additions & 0 deletions test-suite/tests/testpostw90_boltzwann/silicon.amn

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test-suite/tests/testpostw90_boltzwann/silicon.chk.fmt.bz2
768 changes: 768 additions & 0 deletions test-suite/tests/testpostw90_boltzwann/silicon.eig

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test-suite/tests/testpostw90_boltzwann/silicon.mmn.bz2
124 changes: 124 additions & 0 deletions test-suite/tests/testpostw90_boltzwann/silicon.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
num_bands = 12
num_wann = 8
use_ws_distance = true
search_shells=12

boltzwann = true
boltz_calc_also_dos = true
boltz_dos_energy_step = 0.1
smr_type = gauss
boltz_dos_adpt_smr = false
boltz_dos_smr_fixed_en_width = 0.03
kmesh = 20
boltz_mu_min = 5.
boltz_mu_max = 5.
boltz_mu_step = 0.01
boltz_temp_min = 300.
boltz_temp_max = 300.
boltz_temp_step = 50
boltz_relax_time = 10.

dis_win_max = 17.0d0
dis_froz_max = 6.4d0
dis_num_iter = 120
dis_mix_ratio = 1.d0
dis_conv_tol = 1.0e-13

num_iter = 300
num_print_cycles = 10

Begin Atoms_Frac
Si -0.25 0.75 -0.25
Si 0.00 0.00 0.00
End Atoms_Frac

Begin Projections
Si : sp3
End Projections

begin kpoint_path
L 0.50000 0.50000 0.5000 G 0.00000 0.00000 0.0000
G 0.00000 0.00000 0.0000 X 0.50000 0.00000 0.5000
X 0.50000 -0.50000 0.0000 K 0.37500 -0.37500 0.0000
K 0.37500 -0.37500 0.0000 G 0.00000 0.00000 0.0000
end kpoint_path


Begin Unit_Cell_Cart
-2.6988 0.0000 2.6988
0.0000 2.6988 2.6988
-2.6988 2.6988 0.0000
End Unit_Cell_Cart


mp_grid = 4 4 4


begin kpoints
0.0000 0.0000 0.0000
0.0000 0.2500 0.0000
0.0000 0.5000 0.0000
0.0000 0.7500 0.0000
0.2500 0.0000 0.0000
0.2500 0.2500 0.0000
0.2500 0.5000 0.0000
0.2500 0.7500 0.0000
0.5000 0.0000 0.0000
0.5000 0.2500 0.0000
0.5000 0.5000 0.0000
0.5000 0.7500 0.0000
0.7500 0.0000 0.0000
0.7500 0.2500 0.0000
0.7500 0.5000 0.0000
0.7500 0.7500 0.0000
0.0000 0.0000 0.2500
0.0000 0.2500 0.2500
0.0000 0.5000 0.2500
0.0000 0.7500 0.2500
0.2500 0.0000 0.2500
0.2500 0.2500 0.2500
0.2500 0.5000 0.2500
0.2500 0.7500 0.2500
0.5000 0.0000 0.2500
0.5000 0.2500 0.2500
0.5000 0.5000 0.2500
0.5000 0.7500 0.2500
0.7500 0.0000 0.2500
0.7500 0.2500 0.2500
0.7500 0.5000 0.2500
0.7500 0.7500 0.2500
0.0000 0.0000 0.5000
0.0000 0.2500 0.5000
0.0000 0.5000 0.5000
0.0000 0.7500 0.5000
0.2500 0.0000 0.5000
0.2500 0.2500 0.5000
0.2500 0.5000 0.5000
0.2500 0.7500 0.5000
0.5000 0.0000 0.5000
0.5000 0.2500 0.5000
0.5000 0.5000 0.5000
0.5000 0.7500 0.5000
0.7500 0.0000 0.5000
0.7500 0.2500 0.5000
0.7500 0.5000 0.5000
0.7500 0.7500 0.5000
0.0000 0.0000 0.7500
0.0000 0.2500 0.7500
0.0000 0.5000 0.7500
0.0000 0.7500 0.7500
0.2500 0.0000 0.7500
0.2500 0.2500 0.7500
0.2500 0.5000 0.7500
0.2500 0.7500 0.7500
0.5000 0.0000 0.7500
0.5000 0.2500 0.7500
0.5000 0.5000 0.7500
0.5000 0.7500 0.7500
0.7500 0.0000 0.7500
0.7500 0.2500 0.7500
0.7500 0.5000 0.7500
0.7500 0.7500 0.7500
End Kpoints


11 changes: 11 additions & 0 deletions test-suite/tests/userconfig
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ exe = ../../postw90.x
extract_fn = tools parsers.parse_shc_kslice_dat.parse
tolerance = ( (1.0e-2, None, 'shc'))

[POSTW90_BOLTZWANN_ELCOND_OK]
exe = ../../postw90.x
extract_fn = tools parsers.parse_boltzwann.parse_elcond
# Abs tolerances are "big" (10) because the absolute values are also big
tolerance = ( (10., 1.0e-4, 'elcond_xx'),
(10., 1.0e-4, 'elcond_xy'),
(10., 1.0e-4, 'elcond_yy'),
(10., 1.0e-4, 'elcond_xz'),
(10., 1.0e-4, 'elcond_yz'),
(10., 1.0e-4, 'elcond_zz'))

[user]
# This is the string (or list of strings) that identifies sets of tests
# to be run - one could have multiple ones
Expand Down
49 changes: 49 additions & 0 deletions test-suite/tools/parsers/parse_boltzwann.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
Parser function parse() to parse the <seedname>_geninerp.dat output file of postw90.x.
"""
from __future__ import print_function

import inspect
import re
from collections import defaultdict

from . import show_output

def parse_elcond(fname):
"""
Open the file, parses it and return the values.
"""
retdict = defaultdict(list)

if show_output:
print( "[{}.{}] Parsing file '{}'".format(
__name__, inspect.currentframe().f_code.co_name, fname))

with open(fname) as f:
lines = f.readlines()

for lno, l in enumerate(lines):

if l.strip().startswith('#'):
# Skip headers
continue

pieces = l.split()
if len(pieces) != 8:
raise ValueError("Wrong line length ({}, instead of 5 or 8); line content: {}".format(
len(pieces)), l)
retdict['mu'].append(float(pieces[0]))
retdict['temp'].append(float(pieces[1]))
retdict['elcond_xx'].append(float(pieces[2]))
retdict['elcond_xy'].append(float(pieces[3]))
retdict['elcond_yy'].append(float(pieces[4]))
retdict['elcond_xz'].append(float(pieces[5]))
retdict['elcond_yz'].append(float(pieces[6]))
retdict['elcond_zz'].append(float(pieces[7]))

retdict = dict(retdict)
if show_output:
for k in sorted(retdict):
print(" {}: {}".format(k, retdict[k]))
print("-"*72)
return retdict