Skip to content

Commit e7d2d7b

Browse files
authored
Merge branch 'develop' into refactor
2 parents 1998e85 + b6733d1 commit e7d2d7b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

deepks/iterate/generator_abacus.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ def make_abacus_scf_input(fp_params):
2929
if "scf_thr" in fp_params:
3030
ret += "scf_thr %e\n" % fp_params["scf_thr"]
3131
if "scf_nmax" in fp_params:
32-
assert(fp_params['scf_nmax'] >= 0 and type(fp_params["scf_nmax"])== int), "'scf_nmax' should be a positive integer."
32+
assert(fp_params['scf_nmax'] >= 0 and type(fp_params["scf_nmax"]) == int), "'scf_nmax' should be a positive integer."
3333
ret += "scf_nmax %d\n" % fp_params["scf_nmax"]
3434
if "basis_type" in fp_params:
3535
assert(fp_params["basis_type"] in ["pw", "lcao", "lcao_in_pw"]) , "'basis_type' must in 'pw', 'lcao' or 'lcao_in_pw'."
3636
ret+= "basis_type %s\n" % fp_params["basis_type"]
3737
if "dft_functional" in fp_params:
3838
ret += "dft_functional %s\n" % fp_params["dft_functional"]
3939
if "gamma_only" in fp_params:
40-
assert(fp_params["gamma_only"] ==0 or fp_params["gamma_only"] ==1 ) , "'gamma_only' should be 0 or 1."
40+
assert(fp_params["gamma_only"] == 0 or fp_params["gamma_only"] == 1 ) , "'gamma_only' should be 0 or 1."
4141
ret+= "gamma_only %d\n" % fp_params["gamma_only"]
4242
if "mixing_type" in fp_params:
4343
assert(fp_params["mixing_type"] in ["plain", "kerker", "pulay", "pulay-kerker", "broyden"])
@@ -74,6 +74,9 @@ def make_abacus_scf_input(fp_params):
7474
if "cal_stress" in fp_params:
7575
assert(fp_params["cal_stress"] == 0 or fp_params["cal_stress"] == 1), "'cal_stress' should be either 0 or 1."
7676
ret += "cal_stress %d\n" % fp_params["cal_stress"]
77+
if "out_dos" in fp_params:
78+
assert(type(fp_params["out_dos"]) == int), "'out_dos' should be integer."
79+
ret += "out_dos %d\n" % fp_params["out_dos"]
7780
# Parameters for deepks
7881
if "deepks_out_labels" in fp_params:
7982
assert(fp_params["deepks_out_labels"] == 0 or fp_params["deepks_out_labels"] == 1), "'deepks_out_labels' should be either 0 or 1."
@@ -82,9 +85,9 @@ def make_abacus_scf_input(fp_params):
8285
assert(fp_params["deepks_scf"] == 0 or fp_params["deepks_scf"] == 1), "'deepks_scf' should be either 0 or 1."
8386
ret += "deepks_scf %d\n" % fp_params["deepks_scf"]
8487
if "deepks_bandgap" in fp_params:
85-
assert(fp_params["deepks_bandgap"] == 0 or fp_params["deepks_bandgap"] == 1 or fp_params["deepks_bandgap"] == 2), "'deepks_bandgap' should be either 0 or 1 or 2."
88+
assert(type(fp_params["deepks_bandgap"]) == int), "'deepks_bandgap' should be integer."
8689
ret += "deepks_bandgap %d\n" % fp_params["deepks_bandgap"]
87-
if fp_params["deepks_bandgap"] == 2:
90+
if fp_params["deepks_bandgap"] == 2 or fp_params["deepks_bandgap"] == 3:
8891
assert(len(fp_params["deepks_band_range"]) == 2), "length of 'deepks_band_range' should be 2."
8992
ret += "deepks_band_range %d %d\n" % (fp_params["deepks_band_range"][0], fp_params["deepks_band_range"][1])
9093
if "deepks_v_delta" in fp_params:

deepks/scf/stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def print_stats_s(s_err, indent=0):
9696
def print_stats_o(o_err, indent=0):
9797
ind = " "*indent
9898
print(ind+"Band gap:")
99-
print(ind+f' ME: \t {o_err.mean()}')
99+
#print(ind+f' ME: \t {o_err.mean()}')
100100
print(ind+f' MAE: \t {np.abs(o_err).mean()}')
101101

102102
def load_stat(systems, dump_dir,
@@ -144,7 +144,7 @@ def load_stat(systems, dump_dir,
144144
try:
145145
ro = load_array(get_with_prefix(o_name, rbase, ".npy"))
146146
lo = load_array(get_with_prefix("orbital", lbase, ".npy")).reshape(ro.shape)
147-
o_err.append(np.abs(lo - ro))
147+
o_err.append(np.abs(lo - ro).mean((-1,-2))) #Support different K-point configurations at the same time
148148
except FileNotFoundError as e:
149149
print("Warning! orbital file not found:", e, file=sys.stderr)
150150
return np.concatenate(c_res, 0) if c_res else None, \

0 commit comments

Comments
 (0)