pwact 0.1.25__tar.gz → 0.1.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pwact-0.1.25 → pwact-0.1.27}/PKG-INFO +1 -1
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/explore/run_model_md.py +17 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/cmd_infos.py +1 -1
- pwact-0.1.27/pwact/utils/draw/__init__.py +0 -0
- pwact-0.1.27/pwact/utils/draw/hist_model_devi.py +132 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/file_operation.py +6 -1
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/tmp.py +3 -3
- {pwact-0.1.25 → pwact-0.1.27}/pwact.egg-info/PKG-INFO +1 -1
- {pwact-0.1.25 → pwact-0.1.27}/pwact.egg-info/SOURCES.txt +3 -1
- {pwact-0.1.25 → pwact-0.1.27}/setup.py +1 -1
- {pwact-0.1.25 → pwact-0.1.27}/LICENSE +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/README.md +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/environment.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/explore/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/explore/select_image.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/aimd.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/duplicate_scale.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/init_bulk_run.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/relabel.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/init_bulk/relax.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/label/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/label/labeling.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/slurm/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/slurm/slurm.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/slurm/slurm_tool.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/test/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/test/test.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/train/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/train/dp_kpu.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/train/train_model.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/init_bulk_input.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/iter_input.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/resource.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/scf_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/model_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/nep_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/nn_feature_type.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/optimizer_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/train_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/work_file_param.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/workdir.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/bin/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/data_format/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/data_format/configop.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/main.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/__init__.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/common.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/cp2k.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/cp2k_dp.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/lammps.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/app_lib/pwmat.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/constant.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/format_input_output.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/json_operation.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/pre_al_data_util.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/process_tool.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact/utils/slurm_script.py +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact.egg-info/dependency_links.txt +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact.egg-info/entry_points.txt +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/pwact.egg-info/top_level.txt +0 -0
- {pwact-0.1.25 → pwact-0.1.27}/setup.cfg +0 -0
|
@@ -26,6 +26,7 @@ from pwact.utils.constant import AL_STRUCTURE, TEMP_STRUCTURE, EXPLORE_FILE_STRU
|
|
|
26
26
|
from pwact.utils.format_input_output import get_iter_from_iter_name, get_sub_md_sys_template_name,\
|
|
27
27
|
make_md_sys_name, get_md_sys_template_name, make_temp_press_name, make_temp_name, make_train_name
|
|
28
28
|
from pwact.utils.file_operation import write_to_file, add_postfix_dir, link_file, read_data, search_files, copy_dir, copy_file, del_file, del_dir, del_file_list, del_file_list_by_patten, mv_file
|
|
29
|
+
from pwact.utils.draw.hist_model_devi import draw_hist_list
|
|
29
30
|
from pwact.utils.app_lib.lammps import make_lammps_input
|
|
30
31
|
from pwact.data_format.configop import save_config, get_atom_type
|
|
31
32
|
|
|
@@ -288,7 +289,16 @@ class Explore(object):
|
|
|
288
289
|
'''
|
|
289
290
|
def post_process_md(self):
|
|
290
291
|
md_sys_dir_list = search_files(self.md_dir, get_md_sys_template_name())
|
|
292
|
+
# draw model deviation
|
|
291
293
|
is_kpu = self.input_param.strategy.uncertainty.upper() == UNCERTAINTY.kpu.upper()
|
|
294
|
+
if is_kpu is False:
|
|
295
|
+
for md_sys_dir in md_sys_dir_list:
|
|
296
|
+
draw_hist_list(file_path=[md_sys_dir],
|
|
297
|
+
legend_label=["{}-{}".format(self.itername, os.path.basename(md_sys_dir))],
|
|
298
|
+
save_path = os.path.join(md_sys_dir, "model_devi_distribution.png"),
|
|
299
|
+
low=self.input_param.strategy.lower_model_deiv_f,
|
|
300
|
+
high=self.input_param.strategy.upper_model_deiv_f)
|
|
301
|
+
|
|
292
302
|
for md_sys_dir in md_sys_dir_list:
|
|
293
303
|
sub_md_sys_dir_list =search_files(md_sys_dir, get_md_sys_template_name())
|
|
294
304
|
for sub_md_sys in sub_md_sys_dir_list:
|
|
@@ -313,6 +323,13 @@ class Explore(object):
|
|
|
313
323
|
copy_file(file, os.path.join(self.real_md_dir, os.path.basename(file)))
|
|
314
324
|
for file in md_slurm_scripts:
|
|
315
325
|
copy_file(file, os.path.join(self.real_md_dir, os.path.basename(file)))
|
|
326
|
+
if os.path.exists(os.path.join(md_sys_dir, "model_devi_distribution.png")):
|
|
327
|
+
copy_file(os.path.join(md_sys_dir, "model_devi_distribution.png"),
|
|
328
|
+
os.path.join(self.real_md_dir, os.path.basename(md_sys_dir), "model_devi_distribution.png"))
|
|
329
|
+
link_file(
|
|
330
|
+
os.path.join(self.real_md_dir, os.path.basename(md_sys_dir), "model_devi_distribution.png"),
|
|
331
|
+
os.path.join(self.select_dir, "model_devi_distribution-{}.png".format(os.path.basename(md_sys_dir)))
|
|
332
|
+
)
|
|
316
333
|
copy_dir(self.select_dir, self.real_select_dir)
|
|
317
334
|
|
|
318
335
|
'''
|
|
@@ -25,7 +25,7 @@ def cmd_infos(cmd_type=None):
|
|
|
25
25
|
cmd_info += "you could use this method to extract pwdatas after active learing done.\nFor more detail for this command, you could use 'pwact gather_pwdata -h'\n\n"
|
|
26
26
|
|
|
27
27
|
cmd_info += "filter" + "\n"
|
|
28
|
-
cmd_info += "you could use this method to test the selection results corresponding to the upper and lower limit settings, you could use 'pwact filter -h'\n"
|
|
28
|
+
cmd_info += "you could use this method to test the selection results corresponding to the upper and lower limit settings, you could use 'pwact filter -h'\n\n"
|
|
29
29
|
|
|
30
30
|
cmd_info += "to_pwdata".lower() + "\n"
|
|
31
31
|
cmd_info += "(This method has been abandoned, new conversion methods refer to the pwdata documentation http://doc.lonxun.com/PWMLFF/Appendix-2/)\n\n"
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
# import numpy as np
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
|
|
7
|
+
mark_list = ["o", "^", "v", "X", "|", "*", "v", "+", '*', ' ']
|
|
8
|
+
color_list = ["#006400", "#FF8C00", "#B22222", "#FF8C00" ,"#ff0099" ,\
|
|
9
|
+
"#000000" , "#BDB76B", "#999900" ,"#009999" ,"#000099" ,"#990099", "#ff9900" ]
|
|
10
|
+
linestyle_list = ["--", "--", "--", "-", "-", "-"]
|
|
11
|
+
|
|
12
|
+
def draw_hists_2(data, save_path, min, max, legend_label):
|
|
13
|
+
bins = np.linspace(0, max, 100) # 根据需要调整bin的数量和范围
|
|
14
|
+
alpha = 0.5 # 透明度设置
|
|
15
|
+
plt.figure(figsize=(10, 6)) # 设置图形的大小
|
|
16
|
+
|
|
17
|
+
for i, _data in enumerate(data):
|
|
18
|
+
plt.hist(_data, bins=bins, alpha=alpha, label=legend_label[i], density=True)
|
|
19
|
+
|
|
20
|
+
# 设置坐标轴范围
|
|
21
|
+
plt.xlim(min, max)
|
|
22
|
+
|
|
23
|
+
# 添加标题、标签、图例
|
|
24
|
+
plt.title('Distribution of model deviation', fontsize=18, fontweight='bold', family='serif')
|
|
25
|
+
plt.xlabel('Model Deviation', fontsize=14, fontweight='bold', family='serif')
|
|
26
|
+
plt.ylabel('Frequency', fontsize=14, fontweight='bold', family='serif')
|
|
27
|
+
|
|
28
|
+
# 设置图例
|
|
29
|
+
plt.legend(loc='upper right', fontsize=15, title_fontsize='large')
|
|
30
|
+
|
|
31
|
+
# 调整坐标轴的字体大小
|
|
32
|
+
plt.tick_params(axis='both', labelsize=15)
|
|
33
|
+
|
|
34
|
+
# 添加网格
|
|
35
|
+
plt.grid(True, linestyle='--', alpha=0.7)
|
|
36
|
+
|
|
37
|
+
# 保存图像
|
|
38
|
+
plt.savefig(save_path, dpi=300, bbox_inches='tight')
|
|
39
|
+
plt.close()
|
|
40
|
+
|
|
41
|
+
def read_model_devi(file_path, low=None, high=None):
|
|
42
|
+
devi_files = []
|
|
43
|
+
for path, dirList, fileList in os.walk(file_path):
|
|
44
|
+
for _ in fileList:
|
|
45
|
+
if "model_devi.out" in _:
|
|
46
|
+
devi_files.append(os.path.join(path, _))
|
|
47
|
+
data = []
|
|
48
|
+
for file in devi_files:
|
|
49
|
+
_data = np.loadtxt(file, skiprows=0)
|
|
50
|
+
if _data.shape[0] > 1:
|
|
51
|
+
data.extend(list(_data[:, 1])) # force
|
|
52
|
+
|
|
53
|
+
right = 0
|
|
54
|
+
mid = 0
|
|
55
|
+
error = 0
|
|
56
|
+
if low is not None:
|
|
57
|
+
for d in data:
|
|
58
|
+
if d <= low:
|
|
59
|
+
right += 1
|
|
60
|
+
elif d > low and d <= high:
|
|
61
|
+
mid += 1
|
|
62
|
+
else:
|
|
63
|
+
error += 1
|
|
64
|
+
return data, devi_files, right, mid, error
|
|
65
|
+
|
|
66
|
+
def draw_hist_list(file_path:list[str], legend_label, save_path:str, low=None, high=None) :
|
|
67
|
+
data = []
|
|
68
|
+
min = None
|
|
69
|
+
max = None
|
|
70
|
+
abs_mean = []
|
|
71
|
+
abs_max = []
|
|
72
|
+
mid = 0
|
|
73
|
+
error = 0
|
|
74
|
+
right = 0
|
|
75
|
+
for file in file_path:
|
|
76
|
+
_data, devi_files, _right, _mid, _error = read_model_devi(file, low, high)
|
|
77
|
+
right += _right
|
|
78
|
+
mid += _mid
|
|
79
|
+
error += _error
|
|
80
|
+
_min = np.min(_data)
|
|
81
|
+
_max = np.max(_data)
|
|
82
|
+
min = _min if (min is None or _min < min) else min
|
|
83
|
+
max = _max if (max is None or _max > max) else max
|
|
84
|
+
data.append(_data)
|
|
85
|
+
abs_mean.append(np.mean(_data))
|
|
86
|
+
abs_max.append(np.max(_data))
|
|
87
|
+
|
|
88
|
+
for i in range(0, len(legend_label)):
|
|
89
|
+
if low is not None:
|
|
90
|
+
legend_label[i] = "{}\nmean {} max {} right {} candidate {} error {}".format(legend_label[i], round(abs_mean[i], 3), round(abs_max[i], 3), right, mid, error)
|
|
91
|
+
else:
|
|
92
|
+
legend_label[i] = "{}\nmean {} max {}".format(legend_label[i], round(abs_mean[i], 5), round(abs_max[i], 5))
|
|
93
|
+
# print(legend_label)
|
|
94
|
+
new_data = []
|
|
95
|
+
for id, d in enumerate(data):
|
|
96
|
+
tmp = []
|
|
97
|
+
for _d in d:
|
|
98
|
+
if _d > 1.0:
|
|
99
|
+
tmp.append(1.0)
|
|
100
|
+
else:
|
|
101
|
+
tmp.append(_d)
|
|
102
|
+
new_data.append(tmp)
|
|
103
|
+
max = 1.0 if max > 1.0 else max
|
|
104
|
+
draw_hists_2(new_data, save_path, min, max, legend_label)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
legend_label = ["iter.0006/md/md.000.sys.000"]
|
|
111
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.002"
|
|
112
|
+
draw_hist_list([
|
|
113
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.002"
|
|
114
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.002.png"))
|
|
115
|
+
|
|
116
|
+
legend_label = ["iter.0006/md/md.000.sys.001"]
|
|
117
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.000"
|
|
118
|
+
draw_hist_list([
|
|
119
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.000"
|
|
120
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.000.png"))
|
|
121
|
+
|
|
122
|
+
legend_label = ["iter.0006/md/md.000.sys.002"]
|
|
123
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.001"
|
|
124
|
+
draw_hist_list([
|
|
125
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.001"
|
|
126
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.001.png"))
|
|
127
|
+
|
|
128
|
+
legend_label = ["iter.0006/md/md.000.sys.003"]
|
|
129
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.003"
|
|
130
|
+
draw_hist_list([
|
|
131
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.003"
|
|
132
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.003.png"), low=0.1, high=0.2)
|
|
@@ -65,7 +65,12 @@ def file_read_lines(file_path, data_type="float"):
|
|
|
65
65
|
|
|
66
66
|
'''
|
|
67
67
|
description:
|
|
68
|
-
load txt data
|
|
68
|
+
load txt data: the content as :
|
|
69
|
+
# step avg_devi_f min_devi_f max_devi_f avg_devi_e min_devi_e max_devi_e
|
|
70
|
+
0 0.016176053 0.000004773 0.023921006 0.494110683 0.007786004 0.680908664
|
|
71
|
+
10 0.020843630 0.000576891 0.033193308 0.481147298 0.001424875 0.696843965
|
|
72
|
+
20 0.020738273 0.001127881 0.031809715 0.478043120 0.001433802 0.703810561
|
|
73
|
+
...
|
|
69
74
|
param {str} file_path
|
|
70
75
|
param {*} skiprows
|
|
71
76
|
return {*}
|
|
@@ -2,8 +2,8 @@ from pwdata import Config
|
|
|
2
2
|
import os, sys, glob
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
def count_pwdata():
|
|
6
|
-
|
|
5
|
+
def count_pwdata(work_dir):
|
|
6
|
+
|
|
7
7
|
dir_list = glob.glob(os.path.join(work_dir, "*"))
|
|
8
8
|
res = []
|
|
9
9
|
for dir in dir_list:
|
|
@@ -58,6 +58,6 @@ def save_mlmd():
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
if __name__=="__main__":
|
|
61
|
-
count_pwdata()
|
|
61
|
+
count_pwdata(work_dir = "/data/home/wuxingxing/datas/debugs/dengjiapei/run_iter/mlmd_pwdata")
|
|
62
62
|
# count_outmlmd()
|
|
63
63
|
# save_mlmd()
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="pwact",
|
|
8
|
-
version="0.1.
|
|
8
|
+
version="0.1.27",
|
|
9
9
|
author="LonxunQuantum",
|
|
10
10
|
author_email="lonxun@pwmat.com",
|
|
11
11
|
description="PWACT is an open-source automated active learning platform based on PWMLFF for efficient data sampling.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/nn_feature_type.py
RENAMED
|
File without changes
|
{pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/optimizer_param.py
RENAMED
|
File without changes
|
|
File without changes
|
{pwact-0.1.25 → pwact-0.1.27}/pwact/active_learning/user_input/train_param/work_file_param.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|