From 4fc6be0b0acd33ad2a7f5de9a54eabfe6dff7651 Mon Sep 17 00:00:00 2001 From: Wanrun Jiang <58099845+Vibsteamer@users.noreply.github.com> Date: Wed, 19 Jan 2022 17:31:40 +0800 Subject: [PATCH 1/4] Update outcar.py VASP6 writes NELMIN(minimum number of electronic steps) ahead of NELM(max num), dpdata reads the first line contains "NEIM", then will take the value of NELMIN as that of NELM, inducing "false" in scf_convergence_check this revise includes this such cases by request a stronger check that the line should not be initiated by "NELMIN" or "NELMDL" --- dpdata/vasp/outcar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index a99332603..b327f9708 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -13,7 +13,9 @@ def system_info (lines, type_idx_zero = False) : atom_names.append(_ii.split('_')[0]) else: atom_names.append(_ii) - elif 'NELM' in ii and nelm == None: + #find the line contains NELM but not initiated by other vasp_keys like NELMIN and NELMDL ... + #...format adjustmnet in vasp 6 request this check ; compatible with the older version + elif 'NELM' in ii and nelm == None and (ii.split()[0] != "NELMIN") and (ii.split()[0] != "NELMDL"): # will read only first nelm nelm = int(ii.split()[2].rstrip(";")) elif 'ions per type' in ii : From ccdd31e8dfa9605e3d065c640f642abc4614fc2f Mon Sep 17 00:00:00 2001 From: Wanrun Jiang <58099845+Vibsteamer@users.noreply.github.com> Date: Fri, 21 Jan 2022 11:51:03 +0800 Subject: [PATCH 2/4] bug_fix | read "nelm" | compatible with vasp6 adding a stricter check for whether the line is actually assigning value for "NELM". expecting the assignment follows the format : ``` "anywhere_in_the_line"+"NELM"+"any_number_of_spaces"+"="+"value(data-type-check_omitted_don't-believe-it's-needed-here)"+"whatever_else" ``` --- dpdata/vasp/outcar.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index b327f9708..0a2d9143f 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -4,7 +4,8 @@ def system_info (lines, type_idx_zero = False) : atom_names = [] atom_numbs = None nelm = None - for ii in lines: + for ii in lines: + ii_word_list=ii.split() if 'TITEL' in ii : # get atom names from POTCAR info, tested only for PAW_PBE ... _ii=ii.split()[3] @@ -13,11 +14,9 @@ def system_info (lines, type_idx_zero = False) : atom_names.append(_ii.split('_')[0]) else: atom_names.append(_ii) - #find the line contains NELM but not initiated by other vasp_keys like NELMIN and NELMDL ... - #...format adjustmnet in vasp 6 request this check ; compatible with the older version - elif 'NELM' in ii and nelm == None and (ii.split()[0] != "NELMIN") and (ii.split()[0] != "NELMDL"): - # will read only first nelm - nelm = int(ii.split()[2].rstrip(";")) + #a stricker check for "NELM"; compatible with distingct formats in different versions(6 and older, newers_expect-to-work) of vasp + elif 'NELM' in ii_word_list and (ii_word_list[ii_word_list.index("NELM") + 1] == "=") and nelm == None: + nelm = int(ii_word_list[ii_word_list.index("NELM") + 2].rstrip(";")) elif 'ions per type' in ii : atom_numbs_ = [int(s) for s in ii.split()[4:]] if atom_numbs is None : From 13968cb9b78b2b538e8e0da0246fa1608161343c Mon Sep 17 00:00:00 2001 From: Wanrun Jiang <58099845+Vibsteamer@users.noreply.github.com> Date: Wed, 9 Feb 2022 15:58:57 +0800 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Jinzhe Zeng --- dpdata/vasp/outcar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index 0a2d9143f..c8e69db11 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -15,8 +15,10 @@ def system_info (lines, type_idx_zero = False) : else: atom_names.append(_ii) #a stricker check for "NELM"; compatible with distingct formats in different versions(6 and older, newers_expect-to-work) of vasp - elif 'NELM' in ii_word_list and (ii_word_list[ii_word_list.index("NELM") + 1] == "=") and nelm == None: - nelm = int(ii_word_list[ii_word_list.index("NELM") + 2].rstrip(";")) + elif nelm is None: + m = re.search(r'NELM\s*=\s*(\d+)', ii) + if m: + nelm = int(m.group(1)) elif 'ions per type' in ii : atom_numbs_ = [int(s) for s in ii.split()[4:]] if atom_numbs is None : From 68d9578a6dfe4c06ebb721bab5acb695ac25fe8e Mon Sep 17 00:00:00 2001 From: Wanrun Jiang <58099845+Vibsteamer@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:02:31 +0800 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Jinzhe Zeng --- dpdata/vasp/outcar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index c8e69db11..f35b54b23 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -1,4 +1,5 @@ import numpy as np +import re def system_info (lines, type_idx_zero = False) : atom_names = []