Skip to content

Commit

Permalink
Merge branch 'debug_outcar' into dev_sud
Browse files Browse the repository at this point in the history
  • Loading branch information
sudarsan-surendralal committed Feb 2, 2019
2 parents 74e8450 + fb09909 commit 8b2acc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pyiron/vasp/outcar.py
Expand Up @@ -5,6 +5,7 @@
import numpy as np
import warnings
import scipy.constants
import re

__author__ = "Sudarsan Surendralal"
__copyright__ = "Copyright 2019, Max-Planck-Institut für Eisenforschung GmbH - " \
Expand Down Expand Up @@ -562,8 +563,10 @@ def get_broyden_mixing_mesh(filename="OUTCAR"):
lines = f.readlines()
for i, line in enumerate(lines):
if trigger in line:
line_ngx = lines[i-2].split()
return int(line_ngx[2]) * int(line_ngx[5]) * int(line_ngx[8])
line_ngx = lines[i - 2]
# Exclude all alphabets, and spaces. Then split based on '='
str_list = re.sub(r'[a-zA-Z]', r'', line_ngx.replace(" ", "").replace("\n", "")).split("=")
return np.prod([int(val) for val in str_list[1:]])

@staticmethod
def get_temperatures(filename="OUTCAR"):
Expand Down
2 changes: 1 addition & 1 deletion tests/static/vasp_test_files/outcar_samples/OUTCAR_8
Expand Up @@ -569,7 +569,7 @@ Automatic generation of k-mesh.
wavefun : 195232. kBytes

Broyden mixing: mesh for mixing (old mesh)
NGX = 21 NGY = 21 NGZ = 21
NGX =21 NGY= 21 NGZ = 21
(NGX = 96 NGY = 96 NGZ = 96)
gives a total of 9261 points

Expand Down
3 changes: 3 additions & 0 deletions tests/vasp/test_outcar.py
Expand Up @@ -285,6 +285,9 @@ def test_get_broyden_mixing_mesh(self):
if int(filename.split('/OUTCAR_')[-1]) in [2, 3, 4, 5, 6]:
mixing = 343
self.assertEqual(mixing, output)
if int(filename.split('/OUTCAR_')[-1]) == 8:
mixing = 21 ** 3
self.assertEqual(mixing, output)

def test_get_dipole_moments(self):
for filename in self.file_list:
Expand Down

0 comments on commit 8b2acc4

Please sign in to comment.