Skip to content

Commit

Permalink
vasp.handlers: error counter for brmix
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Feb 1, 2016
1 parent 7df4d5d commit b859e6d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import operator
import shutil
from functools import reduce
from collections import Counter
import re

from six.moves import map
Expand Down Expand Up @@ -96,6 +97,7 @@ def __init__(self, output_filename="vasp.out"):
"""
self.output_filename = output_filename
self.errors = set()
self.error_count = Counter()

def check(self):
incar = Incar.from_file("INCAR")
Expand Down Expand Up @@ -130,13 +132,15 @@ def correct(self):

if "brmix" in self.errors:

if vi["KPOINTS"].style == Kpoints.supported_modes.Gamma:
if self.error_count['brmix'] == 0 and vi["KPOINTS"].style == Kpoints.supported_modes.Gamma:
actions.append({"dict": "KPOINTS",
"action": {"_set": {"generation_style": "Monkhorst"}}})
self.error_count['brmix'] += 1

elif vi["KPOINTS"].style == Kpoints.supported_modes.Monkhorst:
elif self.error_count['brmix'] <= 1 and vi["KPOINTS"].style == Kpoints.supported_modes.Monkhorst:
actions.append({"dict": "KPOINTS",
"action": {"_set": {"generation_style": "Gamma"}}})
self.error_count['brmix'] += 1

if vi["KPOINTS"].num_kpts < 1:
all_kpts_even = all([
Expand All @@ -150,10 +154,14 @@ def correct(self):
"kpoints": new_kpts
}}})

if not actions:
else:
actions.append({"dict": "INCAR",
"action": {"_set": {"ISYM": 0}}})

if vi["KPOINTS"].style == Kpoints.supported_modes.Monkhorst:
actions.append({"dict": "KPOINTS",
"action": {"_set": {"generation_style": "Gamma"}}})

# Based on VASP forum's recommendation, you should delete the
# CHGCAR and WAVECAR when dealing with this error.
actions.append({"file": "CHGCAR",
Expand Down

0 comments on commit b859e6d

Please sign in to comment.