From 81275b8335028d1f150bd89a013a99b8bfe025c4 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 17:06:40 +0800 Subject: [PATCH 01/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpdata/system.py b/dpdata/system.py index 1dbbd2118..22073f62e 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -176,6 +176,7 @@ def __init__ (self, begin = 0, step = 1, data = None, + req_converged = True **kwargs) : """ Constructor @@ -208,7 +209,9 @@ def __init__ (self, step : int The number of skipped frames when loading MD trajectory. data : dict - The raw data of System class. + The raw data of System class. + req_converged : boolean + Whether to request a convergence check. """ self.data = {} self.data['atom_numbs'] = [] From 5789e8731dad237389eda406b91bbfd6f34826a5 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 17:07:51 +0800 Subject: [PATCH 02/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 0e0475151..706fff443 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -65,7 +65,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml) + = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["req_converged"]) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 467310def9abaa339e744c4c5d36d3834a592f69 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 17:28:28 +0800 Subject: [PATCH 03/34] Update outcar.py Signed-off-by: Pan Xiang --- dpdata/vasp/outcar.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index cae1dd158..db4e02220 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -52,7 +52,7 @@ def get_outcar_block(fp, ml = False): return blk # we assume that the force is printed ... -def get_frames(fname, begin = 0, step = 1, ml = False): +def get_frames(fname, begin = 0, step = 1, ml = False, req_converged=True): fp = open(fname) blk = get_outcar_block(fp) @@ -66,10 +66,11 @@ def get_frames(fname, begin = 0, step = 1, ml = False): all_virials = [] cc = 0 + rec_failed = [] while len(blk) > 0 : if cc >= begin and (cc - begin) % step == 0 : coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm, ml) - if is_converge : + if is_converge or not req_converged: if len(coord) == 0: break all_coords.append(coord) @@ -78,10 +79,16 @@ def get_frames(fname, begin = 0, step = 1, ml = False): all_forces.append(force) if virial is not None : all_virials.append(virial) + else: + rec_failed.append(cc+1) blk = get_outcar_block(fp, ml) cc += 1 - + + if len(rec_failed) > 0 : + prt = ".\n So they are not collected." if req_converged else ".\n But they were also collected" + print("The following structures were unconverged:\n", rec_failed, prt) + if len(all_virials) == 0 : all_virials = None else : From 184607ef68f2a8b06155690b8badd5eadd70fbff Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 17:35:27 +0800 Subject: [PATCH 04/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/system.py b/dpdata/system.py index 22073f62e..797777304 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -176,7 +176,7 @@ def __init__ (self, begin = 0, step = 1, data = None, - req_converged = True + req_converged = True, **kwargs) : """ Constructor From df0c3a1ed9ab71809adf6c2e00dec4732ba9c406 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:02:03 +0800 Subject: [PATCH 05/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpdata/system.py b/dpdata/system.py index 797777304..eb2ed3e3a 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -176,7 +176,7 @@ def __init__ (self, begin = 0, step = 1, data = None, - req_converged = True, + converge = True, **kwargs) : """ Constructor @@ -210,7 +210,7 @@ def __init__ (self, The number of skipped frames when loading MD trajectory. data : dict The raw data of System class. - req_converged : boolean + converge : boolean Whether to request a convergence check. """ self.data = {} @@ -227,7 +227,7 @@ def __init__ (self, return if file_name is None : return - self.from_fmt(file_name, fmt, type_map=type_map, begin= begin, step=step, **kwargs) + self.from_fmt(file_name, fmt, type_map=type_map, begin= begin, step=step, converge=converge, **kwargs) if type_map is not None: self.apply_type_map(type_map) From 5705656add29826e8a1c405ce29000e891b9cf04 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:03:09 +0800 Subject: [PATCH 06/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 706fff443..07c88d71e 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -65,7 +65,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["req_converged"]) + = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["converged"]) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From e79d23c73d57387fd3359acdaf487ba2d77bf50d Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:05:36 +0800 Subject: [PATCH 07/34] Update outcar.py Signed-off-by: Pan Xiang --- dpdata/vasp/outcar.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index db4e02220..31c1ca6e5 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -1,5 +1,6 @@ import numpy as np import re +import warnings def system_info(lines, type_idx_zero = False): atom_names = [] @@ -70,24 +71,24 @@ def get_frames(fname, begin = 0, step = 1, ml = False, req_converged=True): while len(blk) > 0 : if cc >= begin and (cc - begin) % step == 0 : coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm, ml) + if len(coord) == 0: + break if is_converge or not req_converged: - if len(coord) == 0: - break all_coords.append(coord) all_cells.append(cell) all_energies.append(energy) all_forces.append(force) if virial is not None : all_virials.append(virial) - else: + if not is_converge: rec_failed.append(cc+1) blk = get_outcar_block(fp, ml) cc += 1 if len(rec_failed) > 0 : - prt = ".\n So they are not collected." if req_converged else ".\n But they were also collected" - print("The following structures were unconverged:\n", rec_failed, prt) + prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) if len(all_virials) == 0 : all_virials = None From 285f99c4b4ab64a4cb28ddcce79bf68fc382043a Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:12:21 +0800 Subject: [PATCH 08/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 07c88d71e..2e1e1d45d 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -65,7 +65,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["converged"]) + = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["converge"]) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 4a2ae35b3f27d632f3f4345b5fcbceae5fbbb2f8 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:29:05 +0800 Subject: [PATCH 09/34] Update movement.py Signed-off-by: Pan Xiang --- dpdata/pwmat/movement.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dpdata/pwmat/movement.py b/dpdata/pwmat/movement.py index 121f38855..9f629948e 100644 --- a/dpdata/pwmat/movement.py +++ b/dpdata/pwmat/movement.py @@ -1,5 +1,6 @@ import numpy as np from ..periodic_table import ELEMENTS +import warnings def system_info (lines, type_idx_zero = False) : atom_names = [] @@ -49,7 +50,7 @@ def get_movement_block(fp) : return blk # we assume that the force is printed ... -def get_frames (fname, begin = 0, step = 1) : +def get_frames (fname, begin = 0, step = 1, req_converged=True) : fp = open(fname) blk = get_movement_block(fp) @@ -64,20 +65,28 @@ def get_frames (fname, begin = 0, step = 1) : all_virials = [] cc = 0 + rec_failed = [] while len(blk) > 0 : if cc >= begin and (cc - begin) % step == 0 : coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm) - if is_converge : - if len(coord) == 0: - break + if len(coord) == 0: + break + if is_converge or not req_converged: all_coords.append(coord) all_cells.append(cell) all_energies.append(energy) all_forces.append(force) if virial is not None : all_virials.append(virial) + if not is_converge: + rec_failed.append(cc+1) + blk = get_movement_block(fp) cc += 1 + + if len(rec_failed) > 0 : + prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) if len(all_virials) == 0 : all_virials = None From a5bc1994562caa97d2e3a0d87ece322ead843d71 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:32:15 +0800 Subject: [PATCH 10/34] Update output.py Signed-off-by: Pan Xiang --- dpdata/fhi_aims/output.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dpdata/fhi_aims/output.py b/dpdata/fhi_aims/output.py index 4ee819c3b..e0b787dab 100755 --- a/dpdata/fhi_aims/output.py +++ b/dpdata/fhi_aims/output.py @@ -1,5 +1,6 @@ import numpy as np import re +import warnings latt_patt="\|\s+([0-9]{1,}[.][0-9]*)\s+([0-9]{1,}[.][0-9]*)\s+([0-9]{1,}[.][0-9]*)" pos_patt_first="\|\s+[0-9]{1,}[:]\s\w+\s(\w+)(\s.*[-]?[0-9]{1,}[.][0-9]*)(\s+[-]?[0-9]{1,}[.][0-9]*)(\s+[-]?[0-9]{1,}[.][0-9]*)" @@ -63,7 +64,7 @@ def get_fhi_aims_block(fp) : return blk return blk -def get_frames (fname, md=True, begin = 0, step = 1) : +def get_frames (fname, md=True, begin = 0, step = 1, req_converged=True) : fp = open(fname) blk = get_fhi_aims_block(fp) ret = get_info(blk, type_idx_zero = True) @@ -78,6 +79,7 @@ def get_frames (fname, md=True, begin = 0, step = 1) : all_virials = [] cc = 0 + rec_failed = [] while len(blk) > 0 : if debug: with open(str(cc),'w') as f: @@ -87,9 +89,9 @@ def get_frames (fname, md=True, begin = 0, step = 1) : coord, _cell, energy, force, virial, is_converge = analyze_block(blk, first_blk=True, md=md) else: coord, _cell, energy, force, virial, is_converge = analyze_block(blk, first_blk=False) - if is_converge : - if len(coord) == 0: - break + if len(coord) == 0: + break + if is_converge or not req_converged: all_coords.append(coord) if _cell: @@ -101,9 +103,16 @@ def get_frames (fname, md=True, begin = 0, step = 1) : all_forces.append(force) if virial is not None : all_virials.append(virial) + if not is_converge: + rec_failed.append(cc+1) + blk = get_fhi_aims_block(fp) cc += 1 + if len(rec_failed) > 0 : + prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) + if len(all_virials) == 0 : all_virials = None else : From c345e5eea26155a714488d87f101a3707feb7da6 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:33:16 +0800 Subject: [PATCH 11/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index 7756e0c5c..db4fcff2b 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -21,7 +21,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial \ - = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step) + = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step, req_converged=kwargs["converge"]) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 34cc8c5ffe65e2c99893f70a88a1973708241124 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:33:46 +0800 Subject: [PATCH 12/34] Update fhi_aims.py Signed-off-by: Pan Xiang --- dpdata/plugins/fhi_aims.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index 96e000c6b..956e6e5e2 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -14,7 +14,7 @@ def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, **kwargs) data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step) + = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step, req_converged=kwargs["converge"]) if tmp_virial is not None : data['virials'] = tmp_virial return data From 0a241c185e7c3cf2419d55a59ac021d7ba233980 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 21:41:04 +0800 Subject: [PATCH 13/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dpdata/system.py b/dpdata/system.py index eb2ed3e3a..c7201b7f2 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -201,6 +201,8 @@ def __init__ (self, - ``siesta/output``: siesta SCF output file - ``siesta/aimd_output``: siesta aimd output file - ``pwmat/atom.config``: pwmat atom.config + - ``pwmat/movement``: pwmat movement + - ``fhi_aims/output``: fhi_aims output type_map : list of str Needed by formats lammps/lmp and lammps/dump. Maps atom type to name. The atom with type `ii` is mapped to `type_map[ii]`. If not provided the atom names are assigned to `'Type_1'`, `'Type_2'`, `'Type_3'`... From 2b0c2c048a16de6d49732d9f04a25dca0da42d4b Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Fri, 2 Sep 2022 22:16:44 +0800 Subject: [PATCH 14/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dpdata/system.py b/dpdata/system.py index c7201b7f2..05ea5af21 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -193,16 +193,49 @@ def __init__ (self, - ``deepmd/raw``: deepmd-kit raw - ``deepmd/npy``: deepmd-kit compressed format (numpy binary) - ``vasp/poscar``: vasp POSCAR + - ``vasp/contcar``: vasp contcar + - ``vasp/string``: vasp string + - ``vasp/outcar``: vasp outcar + - ``vasp/xml``: vasp xml - ``qe/cp/traj``: Quantum Espresso CP trajectory files. should have: file_name+'.in' and file_name+'.pos' - ``qe/pw/scf``: Quantum Espresso PW single point calculations. Both input and output files are required. If file_name is a string, it denotes the output file name. Input file name is obtained by replacing 'out' by 'in' from file_name. Or file_name is a list, with the first element being the input file name and the second element being the output filename. - ``abacus/scf``: ABACUS pw/lcao scf. The directory containing INPUT file is required. - ``abacus/md``: ABACUS pw/lcao MD. The directory containing INPUT file is required. - - ``abacus/relax``: ABACUS pw/lcao relax or cell-relax. The directory containing INPUT file is required. + - ``abacus/relax``: ABACUS pw/lcao relax or cell-relax. The directory containing INPUT file is required. + - ``abacus/stru``: abacus stru + - ``abacus/lcao/scf``: abacus lcao scf + - ``abacus/pw/scf``: abacus pw scf + - ``abacus/lcao/md``: abacus lcao md + - ``abacus/pw/md``: abacus pw md + - ``abacus/lcao/relax``: abacus lcao relax + - ``abacus/pw/relax``: abacus pw relax - ``siesta/output``: siesta SCF output file - ``siesta/aimd_output``: siesta aimd output file - ``pwmat/atom.config``: pwmat atom.config - ``pwmat/movement``: pwmat movement + - ``pwmat/output``: pwmat output + - ``pwmat/mlmd``: pwmat mlmd + - ``pwmat/final.config``: pwmat final.config + - ``quip/gap/xyz_file``: quip gap xyz_file + - ``quip/gap/xyz``: quip gap xyz - ``fhi_aims/output``: fhi_aims output + - ``fhi_aims/md``: fhi_aims md + - ``fhi_aims/scf``: fhi_aims scf + - ``pymatgen/structure``: pymatgen structure + - ``pymatgen/molecule``: pymatgen molecule + - ``pymatgen/computedstructureentry``: pymatgen computedstructureentry + - ``amber/md``: amber md + - ``sqm/out``: sqm out + - ``sqm/in``: sqm in + - ``ase/structure``: ase structure + - ``gaussian/log``: gaussian log + - ``gaussian/md``: gaussian md + - ``gaussian/gjf``: gaussian gjf + - ``deepmd/comp``: deepmd comp + - ``deepmd/hdf5``: deepmd hdf5 + - ``gromacs/gro``: gromacs gro + - ``cp2k/aimd_output``: cp2k aimd_output + - ``cp2k/output``: cp2k output type_map : list of str Needed by formats lammps/lmp and lammps/dump. Maps atom type to name. The atom with type `ii` is mapped to `type_map[ii]`. If not provided the atom names are assigned to `'Type_1'`, `'Type_2'`, `'Type_3'`... From a5e0f96ec042da1e331cb9dc07c0317c53bf63af Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Sat, 3 Sep 2022 23:46:28 +0800 Subject: [PATCH 15/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 2e1e1d45d..213089822 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -55,6 +55,7 @@ def to_system(self, data, frame_idx=0, **kwargs): class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): + print("kwargs:", kwargs) data = {} ml = kwargs.get("ml", False) data['atom_names'], \ From b51c870ae673e845a700cd1db854403e5004e5e0 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Sun, 4 Sep 2022 00:37:53 +0800 Subject: [PATCH 16/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 213089822..d73061ad4 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -55,7 +55,8 @@ def to_system(self, data, frame_idx=0, **kwargs): class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): - print("kwargs:", kwargs) + if "converge" not in kwargs.keys(): + kwargs["converge"] = True data = {} ml = kwargs.get("ml", False) data['atom_names'], \ From ba4fa0672ffef74bb7cd13e8aa3c6a663b5e15cd Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Sun, 4 Sep 2022 07:58:10 +0800 Subject: [PATCH 17/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index db4fcff2b..68858d473 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -12,6 +12,8 @@ class PwmatOutputFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): + if "converge" not in kwargs.keys(): + kwargs["converge"] = True data = {} data['atom_names'], \ data['atom_numbs'], \ From abd9587496769fffff43d83d547fc9bd404b8b4f Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Sun, 4 Sep 2022 07:58:30 +0800 Subject: [PATCH 18/34] Update fhi_aims.py Signed-off-by: Pan Xiang --- dpdata/plugins/fhi_aims.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index 956e6e5e2..51b3af869 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -5,6 +5,8 @@ @Format.register("fhi_aims/output") class FhiMDFormat(Format): def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, **kwargs): + if "converge" not in kwargs.keys(): + kwargs["converge"] = True data = {} data['atom_names'], \ data['atom_numbs'], \ From b48b3e51b6e3dcd737f94abea57fcf9c855cfa9c Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:07:44 +0800 Subject: [PATCH 19/34] Update fhi_aims.py Signed-off-by: Pan Xiang --- dpdata/plugins/fhi_aims.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index 51b3af869..d0657d8f2 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -5,8 +5,7 @@ @Format.register("fhi_aims/output") class FhiMDFormat(Format): def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, **kwargs): - if "converge" not in kwargs.keys(): - kwargs["converge"] = True + kwargs.setdefault("converge", True) data = {} data['atom_names'], \ data['atom_numbs'], \ From cdda3d43f6817b9e1d8cf4f64f3e3775713998ed Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:08:06 +0800 Subject: [PATCH 20/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index 68858d473..e8553976f 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -12,8 +12,7 @@ class PwmatOutputFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): - if "converge" not in kwargs.keys(): - kwargs["converge"] = True + kwargs.setdefault("converge", True) data = {} data['atom_names'], \ data['atom_numbs'], \ From fe0d3a51a8d99d25a9fcad95e1ed50e993ff1b8f Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:08:38 +0800 Subject: [PATCH 21/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index d73061ad4..bfe1194e4 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -55,8 +55,7 @@ def to_system(self, data, frame_idx=0, **kwargs): class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): - if "converge" not in kwargs.keys(): - kwargs["converge"] = True + kwargs.setdefault("converge", True) data = {} ml = kwargs.get("ml", False) data['atom_names'], \ From 26b5966353a0e0e8d0151a74b6e650384aef942a Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:14:10 +0800 Subject: [PATCH 22/34] Update fhi_aims.py Signed-off-by: Pan Xiang --- dpdata/plugins/fhi_aims.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index d0657d8f2..364782e1f 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -4,8 +4,7 @@ @Format.register("fhi_aims/md") @Format.register("fhi_aims/output") class FhiMDFormat(Format): - def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, **kwargs): - kwargs.setdefault("converge", True) + def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, converge=True, **kwargs): data = {} data['atom_names'], \ data['atom_numbs'], \ @@ -15,7 +14,7 @@ def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, **kwargs) data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step, req_converged=kwargs["converge"]) + = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step, req_converged=converge) if tmp_virial is not None : data['virials'] = tmp_virial return data From 1c4d660d05ae8221d978c99052006fe443825dad Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:14:32 +0800 Subject: [PATCH 23/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index e8553976f..bd28b3798 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -11,8 +11,7 @@ @Format.register("pwmat/output") class PwmatOutputFormat(Format): @Format.post("rot_lower_triangular") - def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): - kwargs.setdefault("converge", True) + def from_labeled_system(self, file_name, begin=0, step=1, converge, **kwargs): data = {} data['atom_names'], \ data['atom_numbs'], \ @@ -22,7 +21,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial \ - = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step, req_converged=kwargs["converge"]) + = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step, req_converged=converge) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From e99ee95a1ef83cca4b9857633a0570d230ee2923 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:14:57 +0800 Subject: [PATCH 24/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index bfe1194e4..d2c321fec 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -54,7 +54,7 @@ def to_system(self, data, frame_idx=0, **kwargs): @Format.register("vasp/outcar") class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") - def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): + def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwargs): kwargs.setdefault("converge", True) data = {} ml = kwargs.get("ml", False) @@ -66,7 +66,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, **kwargs): data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=kwargs["converge"]) + = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=converge) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 8903132e5c1bdb4e5e1aa17b080d9d38f1beacbb Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Mon, 5 Sep 2022 20:15:35 +0800 Subject: [PATCH 25/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index bd28b3798..e189e0a5f 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -11,7 +11,7 @@ @Format.register("pwmat/output") class PwmatOutputFormat(Format): @Format.post("rot_lower_triangular") - def from_labeled_system(self, file_name, begin=0, step=1, converge, **kwargs): + def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwargs): data = {} data['atom_names'], \ data['atom_numbs'], \ From 4f701a3fe3f6050dab2823ff9e7ba729f1f60ea8 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:45:20 +0800 Subject: [PATCH 26/34] Update system.py Signed-off-by: Pan Xiang --- dpdata/system.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpdata/system.py b/dpdata/system.py index 05ea5af21..0600f5634 100644 --- a/dpdata/system.py +++ b/dpdata/system.py @@ -176,7 +176,7 @@ def __init__ (self, begin = 0, step = 1, data = None, - converge = True, + convergence_check = True, **kwargs) : """ Constructor @@ -245,7 +245,7 @@ def __init__ (self, The number of skipped frames when loading MD trajectory. data : dict The raw data of System class. - converge : boolean + convergence_check : boolean Whether to request a convergence check. """ self.data = {} @@ -262,7 +262,7 @@ def __init__ (self, return if file_name is None : return - self.from_fmt(file_name, fmt, type_map=type_map, begin= begin, step=step, converge=converge, **kwargs) + self.from_fmt(file_name, fmt, type_map=type_map, begin= begin, step=step, convergence_check=convergence_check, **kwargs) if type_map is not None: self.apply_type_map(type_map) From 9a2029b5a3fe1213a0e1f134c0b6f1f5896abefa Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:46:20 +0800 Subject: [PATCH 27/34] Update outcar.py Signed-off-by: Pan Xiang --- dpdata/vasp/outcar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index 31c1ca6e5..b05631dae 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -53,7 +53,7 @@ def get_outcar_block(fp, ml = False): return blk # we assume that the force is printed ... -def get_frames(fname, begin = 0, step = 1, ml = False, req_converged=True): +def get_frames(fname, begin = 0, step = 1, ml = False, convergence_check=True): fp = open(fname) blk = get_outcar_block(fp) @@ -73,7 +73,7 @@ def get_frames(fname, begin = 0, step = 1, ml = False, req_converged=True): coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm, ml) if len(coord) == 0: break - if is_converge or not req_converged: + if is_converge or not convergence_check: all_coords.append(coord) all_cells.append(cell) all_energies.append(energy) From 2b2c805d41e87d1b5985a60c1db6df5e1b2907dd Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:47:17 +0800 Subject: [PATCH 28/34] Update movement.py Signed-off-by: Pan Xiang --- dpdata/pwmat/movement.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpdata/pwmat/movement.py b/dpdata/pwmat/movement.py index 9f629948e..c39950f0a 100644 --- a/dpdata/pwmat/movement.py +++ b/dpdata/pwmat/movement.py @@ -50,7 +50,7 @@ def get_movement_block(fp) : return blk # we assume that the force is printed ... -def get_frames (fname, begin = 0, step = 1, req_converged=True) : +def get_frames (fname, begin = 0, step = 1, convergence_check=True) : fp = open(fname) blk = get_movement_block(fp) @@ -71,7 +71,7 @@ def get_frames (fname, begin = 0, step = 1, req_converged=True) : coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm) if len(coord) == 0: break - if is_converge or not req_converged: + if is_converge or not convergence_check: all_coords.append(coord) all_cells.append(cell) all_energies.append(energy) @@ -85,7 +85,7 @@ def get_frames (fname, begin = 0, step = 1, req_converged=True) : cc += 1 if len(rec_failed) > 0 : - prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + prt = "so they are not collected." if convergence_check else "but they are still collected due to the requirement for ignoring convergence checks." warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) if len(all_virials) == 0 : From 01d0781d54bf55cc6ff79674102f549841cb7804 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:47:34 +0800 Subject: [PATCH 29/34] Update outcar.py Signed-off-by: Pan Xiang --- dpdata/vasp/outcar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpdata/vasp/outcar.py b/dpdata/vasp/outcar.py index b05631dae..3e32a1461 100644 --- a/dpdata/vasp/outcar.py +++ b/dpdata/vasp/outcar.py @@ -87,7 +87,7 @@ def get_frames(fname, begin = 0, step = 1, ml = False, convergence_check=True): cc += 1 if len(rec_failed) > 0 : - prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + prt = "so they are not collected." if convergence_check else "but they are still collected due to the requirement for ignoring convergence checks." warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) if len(all_virials) == 0 : From 48497c0dd3352ea53b37daee0e770637174960e2 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:47:57 +0800 Subject: [PATCH 30/34] Update output.py Signed-off-by: Pan Xiang --- dpdata/fhi_aims/output.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dpdata/fhi_aims/output.py b/dpdata/fhi_aims/output.py index e0b787dab..1a1b2c579 100755 --- a/dpdata/fhi_aims/output.py +++ b/dpdata/fhi_aims/output.py @@ -64,7 +64,7 @@ def get_fhi_aims_block(fp) : return blk return blk -def get_frames (fname, md=True, begin = 0, step = 1, req_converged=True) : +def get_frames (fname, md=True, begin = 0, step = 1, convergence_check=True) : fp = open(fname) blk = get_fhi_aims_block(fp) ret = get_info(blk, type_idx_zero = True) @@ -91,7 +91,7 @@ def get_frames (fname, md=True, begin = 0, step = 1, req_converged=True) : coord, _cell, energy, force, virial, is_converge = analyze_block(blk, first_blk=False) if len(coord) == 0: break - if is_converge or not req_converged: + if is_converge or not convergence_check: all_coords.append(coord) if _cell: @@ -110,7 +110,7 @@ def get_frames (fname, md=True, begin = 0, step = 1, req_converged=True) : cc += 1 if len(rec_failed) > 0 : - prt = "so they are not collected." if req_converged else "but they are still collected due to the requirement for ignoring convergence checks." + prt = "so they are not collected." if convergence_check else "but they are still collected due to the requirement for ignoring convergence checks." warnings.warn(f"The following structures were unconverged: {rec_failed}; "+prt) if len(all_virials) == 0 : From 95568985f82e50a53bbc644537617fc6623b0edd Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:48:24 +0800 Subject: [PATCH 31/34] Update fhi_aims.py Signed-off-by: Pan Xiang --- dpdata/plugins/fhi_aims.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/plugins/fhi_aims.py b/dpdata/plugins/fhi_aims.py index 364782e1f..b1805c4ef 100644 --- a/dpdata/plugins/fhi_aims.py +++ b/dpdata/plugins/fhi_aims.py @@ -4,7 +4,7 @@ @Format.register("fhi_aims/md") @Format.register("fhi_aims/output") class FhiMDFormat(Format): - def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, converge=True, **kwargs): + def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, convergence_check=True, **kwargs): data = {} data['atom_names'], \ data['atom_numbs'], \ @@ -14,7 +14,7 @@ def from_labeled_system(self, file_name, md=True, begin = 0, step = 1, converge= data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step, req_converged=converge) + = dpdata.fhi_aims.output.get_frames(file_name, md = md, begin = begin, step = step, convergence_check=convergence_check) if tmp_virial is not None : data['virials'] = tmp_virial return data From a8f33c5abe5c1ac2061e7fcaaf861ccbfcd72024 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:48:40 +0800 Subject: [PATCH 32/34] Update pwmat.py Signed-off-by: Pan Xiang --- dpdata/plugins/pwmat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/plugins/pwmat.py b/dpdata/plugins/pwmat.py index e189e0a5f..3365806e5 100644 --- a/dpdata/plugins/pwmat.py +++ b/dpdata/plugins/pwmat.py @@ -11,7 +11,7 @@ @Format.register("pwmat/output") class PwmatOutputFormat(Format): @Format.post("rot_lower_triangular") - def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwargs): + def from_labeled_system(self, file_name, begin=0, step=1, convergence_check=True, **kwargs): data = {} data['atom_names'], \ data['atom_numbs'], \ @@ -21,7 +21,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwarg data['energies'], \ data['forces'], \ tmp_virial \ - = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step, req_converged=converge) + = dpdata.pwmat.movement.get_frames(file_name, begin=begin, step=step, convergence_check=convergence_check) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 66edac2652626a3b0a328aa8e4186eb630d57f27 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:49:01 +0800 Subject: [PATCH 33/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index d2c321fec..36ab38118 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -54,7 +54,7 @@ def to_system(self, data, frame_idx=0, **kwargs): @Format.register("vasp/outcar") class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") - def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwargs): + def from_labeled_system(self, file_name, begin=0, step=1, convergence_check=True, **kwargs): kwargs.setdefault("converge", True) data = {} ml = kwargs.get("ml", False) @@ -66,7 +66,7 @@ def from_labeled_system(self, file_name, begin=0, step=1, converge=True, **kwarg data['energies'], \ data['forces'], \ tmp_virial, \ - = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, req_converged=converge) + = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml, convergence_check=convergence_check) if tmp_virial is not None: data['virials'] = tmp_virial # scale virial to the unit of eV From 308c13cf16f44c7b8fe9b9d7b73042a036feb159 Mon Sep 17 00:00:00 2001 From: Pan Xiang Date: Tue, 6 Sep 2022 12:53:03 +0800 Subject: [PATCH 34/34] Update vasp.py Signed-off-by: Pan Xiang --- dpdata/plugins/vasp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dpdata/plugins/vasp.py b/dpdata/plugins/vasp.py index 36ab38118..07ec34f17 100644 --- a/dpdata/plugins/vasp.py +++ b/dpdata/plugins/vasp.py @@ -55,7 +55,6 @@ def to_system(self, data, frame_idx=0, **kwargs): class VASPOutcarFormat(Format): @Format.post("rot_lower_triangular") def from_labeled_system(self, file_name, begin=0, step=1, convergence_check=True, **kwargs): - kwargs.setdefault("converge", True) data = {} ml = kwargs.get("ml", False) data['atom_names'], \