pwact 0.1.5__py3-none-any.whl → 0.1.9__py3-none-any.whl
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/active_learning/explore/run_model_md.py +11 -10
- pwact/active_learning/init_bulk/aimd.py +2 -1
- pwact/active_learning/init_bulk/init_bulk_run.py +45 -4
- pwact/active_learning/init_bulk/relabel.py +200 -0
- pwact/active_learning/init_bulk/relax.py +2 -1
- pwact/active_learning/label/labeling.py +2 -1
- pwact/active_learning/test/test.py +60 -21
- pwact/active_learning/train/dp_kpu.py +0 -1
- pwact/active_learning/user_input/init_bulk_input.py +19 -3
- pwact/active_learning/user_input/iter_input.py +53 -20
- pwact/active_learning/user_input/resource.py +28 -2
- pwact/active_learning/user_input/scf_param.py +39 -34
- pwact/active_learning/user_input/train_param/train_param.py +1 -0
- pwact/data_format/configop.py +35 -9
- pwact/main.py +8 -4
- pwact/utils/app_lib/common.py +3 -1
- pwact/utils/app_lib/lammps.py +21 -10
- pwact/utils/app_lib/pwmat.py +4 -3
- pwact/utils/constant.py +5 -0
- pwact/utils/file_operation.py +4 -2
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/METADATA +1 -1
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/RECORD +26 -25
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/LICENSE +0 -0
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/WHEEL +0 -0
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/entry_points.txt +0 -0
- {pwact-0.1.5.dist-info → pwact-0.1.9.dist-info}/top_level.txt +0 -0
|
@@ -48,7 +48,7 @@ class Explore(object):
|
|
|
48
48
|
self.iter = get_iter_from_iter_name(self.itername)
|
|
49
49
|
self.resource = resource
|
|
50
50
|
self.input_param = input_param
|
|
51
|
-
self.sys_paths = self.input_param.explore.sys_configs
|
|
51
|
+
# self.sys_paths = self.input_param.explore.sys_configs
|
|
52
52
|
self.md_job = self.input_param.explore.md_job_list[self.iter]
|
|
53
53
|
# train work dir
|
|
54
54
|
self.train_dir = os.path.join(self.input_param.root_dir, self.itername, TEMP_STRUCTURE.tmp_run_iter_dir, AL_STRUCTURE.train)
|
|
@@ -116,8 +116,6 @@ class Explore(object):
|
|
|
116
116
|
jobname = "md{}".format(g_index)
|
|
117
117
|
tag_name = "{}-{}".format(g_index, EXPLORE_FILE_STRUCTURE.md_tag)
|
|
118
118
|
tag = os.path.join(self.md_dir, tag_name)
|
|
119
|
-
gpu_per_node = None
|
|
120
|
-
cpu_per_node = 1
|
|
121
119
|
|
|
122
120
|
# if self.resource.explore_resource.gpu_per_node > 0:
|
|
123
121
|
# if self.input_param.strategy.uncertainty.upper() == UNCERTAINTY.committee.upper():
|
|
@@ -135,9 +133,9 @@ class Explore(object):
|
|
|
135
133
|
run_cmd = self.resource.explore_resource.command
|
|
136
134
|
|
|
137
135
|
group_slurm_script = set_slurm_script_content(
|
|
138
|
-
gpu_per_node=gpu_per_node,
|
|
136
|
+
gpu_per_node=self.resource.explore_resource.gpu_per_node,
|
|
139
137
|
number_node = self.resource.explore_resource.number_node, #1
|
|
140
|
-
cpu_per_node = cpu_per_node,
|
|
138
|
+
cpu_per_node = self.resource.explore_resource.cpu_per_node,
|
|
141
139
|
queue_name = self.resource.explore_resource.queue_name,
|
|
142
140
|
custom_flags = self.resource.explore_resource.custom_flags,
|
|
143
141
|
env_script = self.resource.explore_resource.env_script,
|
|
@@ -188,15 +186,18 @@ class Explore(object):
|
|
|
188
186
|
|
|
189
187
|
|
|
190
188
|
def set_md_files(self, md_index:int, md_dir:str, sys_index:int, temp_index:int, press_index:int, md_detail:MdDetail):
|
|
191
|
-
target_config = save_config(config=
|
|
192
|
-
input_format=
|
|
189
|
+
target_config = save_config(config=md_detail.config_file_list[sys_index],
|
|
190
|
+
input_format=md_detail.config_file_format[sys_index],
|
|
193
191
|
wrap = False,
|
|
194
192
|
direct = True,
|
|
195
|
-
sort =
|
|
193
|
+
sort = False,
|
|
196
194
|
save_format=PWDATA.lammps_lmp,
|
|
197
195
|
save_path=md_dir,
|
|
198
196
|
save_name=LAMMPS.lammps_sys_config)
|
|
199
|
-
|
|
197
|
+
# import dpdata
|
|
198
|
+
# _config = dpdata.System(md_detail.config_file_list[sys_index], fmt=md_detail.config_file_format[sys_index])
|
|
199
|
+
# target_config = os.path.join(md_dir, LAMMPS.lammps_sys_config)
|
|
200
|
+
# _config.to("lammps/lmp", target_config, frame_idx=0)
|
|
200
201
|
#2. set forcefiled file
|
|
201
202
|
md_model_paths = self.set_forcefiled_file(md_dir)
|
|
202
203
|
|
|
@@ -204,7 +205,7 @@ class Explore(object):
|
|
|
204
205
|
input_lammps_file = os.path.join(md_dir, LAMMPS.input_lammps)
|
|
205
206
|
press=md_detail.press_list[press_index] if press_index is not None else None
|
|
206
207
|
# get atom type
|
|
207
|
-
atom_type_list, atomic_number_list = get_atom_type(
|
|
208
|
+
atom_type_list, atomic_number_list = get_atom_type(md_detail.config_file_list[sys_index], md_detail.config_file_format[sys_index])
|
|
208
209
|
atom_type_file = os.path.join(md_dir, LAMMPS.atom_type_file)
|
|
209
210
|
write_to_file(atom_type_file, " ".join(atom_type_list), "w")
|
|
210
211
|
restart_file = search_files(md_dir, "lmps.restart.*")
|
|
@@ -150,7 +150,8 @@ class AIMD(object):
|
|
|
150
150
|
# link in.skf path to aimd dir
|
|
151
151
|
pseudo_names = []
|
|
152
152
|
target_dir = os.path.join(aimd_dir, PWMAT.in_skf)
|
|
153
|
-
|
|
153
|
+
if in_skf is not None:
|
|
154
|
+
link_file(in_skf, target_dir)
|
|
154
155
|
#3. make dft input file
|
|
155
156
|
set_input_script(
|
|
156
157
|
input_file=input_file,
|
|
@@ -4,6 +4,7 @@ from pwact.active_learning.init_bulk.relax import Relax
|
|
|
4
4
|
from pwact.active_learning.init_bulk.duplicate_scale import do_pertub_work, do_post_pertub, pertub_done, \
|
|
5
5
|
duplicate_scale_done, duplicate_scale, do_post_duplicate_scale
|
|
6
6
|
from pwact.active_learning.init_bulk.aimd import AIMD
|
|
7
|
+
from pwact.active_learning.init_bulk.relabel import Relabel
|
|
7
8
|
from pwact.active_learning.user_input.init_bulk_input import InitBulkParam
|
|
8
9
|
from pwact.active_learning.user_input.resource import Resource
|
|
9
10
|
|
|
@@ -39,7 +40,14 @@ def init_bulk_run(resource: Resource, input_param:InitBulkParam):
|
|
|
39
40
|
aimd.make_aimd_work()
|
|
40
41
|
aimd.do_aimd_jobs()
|
|
41
42
|
aimd.do_post_process()
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
# do relabel
|
|
45
|
+
if input_param.is_scf:
|
|
46
|
+
relabel = Relabel(resource, input_param)
|
|
47
|
+
if not relabel.check_work_done():
|
|
48
|
+
relabel.make_scf_work()
|
|
49
|
+
relabel.do_scf_jobs()
|
|
50
|
+
relabel.do_post_process()
|
|
43
51
|
do_collection(resource, input_param)
|
|
44
52
|
|
|
45
53
|
def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
@@ -56,7 +64,11 @@ def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
|
56
64
|
real_duplicate_scale_dir = os.path.join(input_param.root_dir, INIT_BULK.super_cell_scale)
|
|
57
65
|
real_pertub_dir = os.path.join(input_param.root_dir, INIT_BULK.pertub)
|
|
58
66
|
real_aimd_dir = os.path.join(input_param.root_dir, INIT_BULK.aimd)
|
|
67
|
+
|
|
68
|
+
relabel_dir = os.path.join(input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.scf)
|
|
69
|
+
real_relabel_dir = os.path.join(input_param.root_dir, INIT_BULK.scf)
|
|
59
70
|
|
|
71
|
+
|
|
60
72
|
for init_config in init_configs:
|
|
61
73
|
init_config_name = "init_config_{}".format(init_config.config_index)
|
|
62
74
|
|
|
@@ -97,7 +109,25 @@ def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
|
97
109
|
train_valid_ratio=input_param.train_valid_ratio,
|
|
98
110
|
data_shuffle=input_param.data_shuffle,
|
|
99
111
|
merge_data=True,
|
|
100
|
-
interval=
|
|
112
|
+
interval=1
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
#6 convert relabel datas
|
|
116
|
+
if init_config.scf:
|
|
117
|
+
source_scf = search_files(os.path.join(relabel_dir, init_config_name),\
|
|
118
|
+
"*/*/*/{}".format(DFT_STYLE.get_aimd_config(resource.scf_style)))
|
|
119
|
+
# init/0-aimd/0-scf/OUTCAR
|
|
120
|
+
if len(source_aimd) == 0:
|
|
121
|
+
continue
|
|
122
|
+
source_scf = sorted(source_scf, key=lambda x:int(os.path.basename(os.path.dirname(x)).split('-')[0]), reverse=False)
|
|
123
|
+
#5. convert the aimd files (for vasp is outcar, for pwmat is movement) to npy format
|
|
124
|
+
extract_pwdata(data_list=source_scf,
|
|
125
|
+
data_format=DFT_STYLE.get_format_by_postfix(os.path.basename(source_scf[0])),
|
|
126
|
+
datasets_path=os.path.join(collection_dir, init_config_name, "scf_pwdata"),
|
|
127
|
+
train_valid_ratio=input_param.train_valid_ratio,
|
|
128
|
+
data_shuffle=input_param.data_shuffle,
|
|
129
|
+
merge_data=True,
|
|
130
|
+
interval=1
|
|
101
131
|
)
|
|
102
132
|
|
|
103
133
|
# delete link files
|
|
@@ -105,6 +135,7 @@ def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
|
105
135
|
del_file(real_duplicate_scale_dir)
|
|
106
136
|
del_file(real_pertub_dir)
|
|
107
137
|
del_file(real_aimd_dir)
|
|
138
|
+
del_file(real_relabel_dir)
|
|
108
139
|
|
|
109
140
|
# copy collection file to target
|
|
110
141
|
copy_dir(collection_dir, real_collection_dir)
|
|
@@ -113,7 +144,7 @@ def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
|
113
144
|
temp_work_dir = os.path.join(input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir)
|
|
114
145
|
del_file_list([temp_work_dir])
|
|
115
146
|
|
|
116
|
-
# print the dir of pwdatas
|
|
147
|
+
# print the dir of pwdatas from aimd
|
|
117
148
|
pwdatas = search_files(real_collection_dir, "*/{}".format(INIT_BULK.npy_format_save_dir))
|
|
118
149
|
if len(pwdatas) > 0:
|
|
119
150
|
pwdatas = sorted(pwdatas)
|
|
@@ -122,4 +153,14 @@ def do_collection(resource: Resource, input_param:InitBulkParam):
|
|
|
122
153
|
# result_lines = result_lines[:-1] # Filter the last ','
|
|
123
154
|
result_save_path = os.path.join(real_collection_dir, INIT_BULK.npy_format_name)
|
|
124
155
|
write_to_file(result_save_path, result_lines, mode='w')
|
|
125
|
-
|
|
156
|
+
|
|
157
|
+
# print the dir of relabel_pwdatas from relabel
|
|
158
|
+
relebel_datas = search_files(real_collection_dir, "*/{}".format("scf_pwdata"))
|
|
159
|
+
if len(relebel_datas) > 0:
|
|
160
|
+
pwdatas = sorted(relebel_datas)
|
|
161
|
+
result_lines = ["\"{}\",".format(_) for _ in pwdatas]
|
|
162
|
+
result_lines = "\n".join(result_lines)
|
|
163
|
+
# result_lines = result_lines[:-1] # Filter the last ','
|
|
164
|
+
result_save_path = os.path.join(real_collection_dir, "scf_pwdata")
|
|
165
|
+
write_to_file(result_save_path, result_lines, mode='w')
|
|
166
|
+
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""
|
|
2
|
+
realx dor strcuture
|
|
3
|
+
--/work_path/
|
|
4
|
+
------------/relax
|
|
5
|
+
-----------------/*_init_config/*_init_.config, etot.input, pseudo files, final.config, mvms_relax
|
|
6
|
+
------------/super_cell_scale
|
|
7
|
+
-----------------/*_init_config/scale.config, from final.config or *_init_.config
|
|
8
|
+
------------/perturb
|
|
9
|
+
--------------------/*_init_config/scale.config or final.config
|
|
10
|
+
----------------------------------/structures/*.config_perturb
|
|
11
|
+
------------/AIMD
|
|
12
|
+
-----------------/*_init_config/*_config_dir the config file from pertub or *_init_.config
|
|
13
|
+
-------------------------------/etot.input, atom.config, ...
|
|
14
|
+
-----------/result
|
|
15
|
+
-----------------/*_init_config/relax_mvm_*_init_config if need; aimd_mvm_*_init_config if need
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
import os
|
|
19
|
+
|
|
20
|
+
from pwact.active_learning.user_input.resource import Resource
|
|
21
|
+
from pwact.active_learning.user_input.init_bulk_input import InitBulkParam
|
|
22
|
+
from pwact.active_learning.init_bulk.duplicate_scale import get_config_files_with_order
|
|
23
|
+
|
|
24
|
+
from pwact.utils.constant import PWMAT, INIT_BULK, TEMP_STRUCTURE, SLURM_OUT, DFT_STYLE
|
|
25
|
+
from pwact.active_learning.slurm import SlurmJob, Mission
|
|
26
|
+
from pwact.utils.slurm_script import get_slurm_job_run_info, split_job_for_group, set_slurm_script_content
|
|
27
|
+
|
|
28
|
+
from pwact.utils.file_operation import write_to_file, link_file, search_files
|
|
29
|
+
from pwact.utils.app_lib.common import link_pseudo_by_atom, set_input_script
|
|
30
|
+
from pwact.data_format.configop import save_config, get_atom_type, load_config
|
|
31
|
+
|
|
32
|
+
class Relabel(object):
|
|
33
|
+
def __init__(self, resource: Resource, input_param:InitBulkParam):
|
|
34
|
+
self.resource = resource
|
|
35
|
+
self.input_param = input_param
|
|
36
|
+
self.init_configs = self.input_param.sys_config
|
|
37
|
+
self.relax_dir = os.path.join(self.input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.relax)
|
|
38
|
+
self.super_cell_scale_dir = os.path.join(self.input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.super_cell_scale)
|
|
39
|
+
self.pertub_dir = os.path.join(self.input_param.root_dir,TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.pertub)
|
|
40
|
+
self.aimd_dir = os.path.join(self.input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.aimd)
|
|
41
|
+
self.real_aimd_dir = os.path.join(self.input_param.root_dir, INIT_BULK.aimd)
|
|
42
|
+
|
|
43
|
+
self.scf_dir = os.path.join(self.input_param.root_dir, TEMP_STRUCTURE.tmp_init_bulk_dir, INIT_BULK.scf)
|
|
44
|
+
self.real_scf_dir = os.path.join(self.input_param.root_dir, INIT_BULK.scf)
|
|
45
|
+
|
|
46
|
+
def make_scf_work(self):
|
|
47
|
+
scf_paths = []
|
|
48
|
+
use_dftb = False
|
|
49
|
+
for init_config in self.init_configs:
|
|
50
|
+
if init_config.scf is False:
|
|
51
|
+
continue
|
|
52
|
+
init_config_name = "init_config_{}".format(init_config.config_index)
|
|
53
|
+
#1. read construtures from aimd dir
|
|
54
|
+
|
|
55
|
+
#2. set relabel dir
|
|
56
|
+
# read trajs from ./aimd/init_config_0/relax/0_aimd/
|
|
57
|
+
# make scf dir ./relabel/init_config_0/relax/0_aimd/10-scf/files
|
|
58
|
+
traj_list = search_files(os.path.join(self.aimd_dir, init_config_name), "*/*aimd")
|
|
59
|
+
for traj_dir in traj_list:
|
|
60
|
+
scf_dir = os.path.join(self.scf_dir, init_config_name, \
|
|
61
|
+
os.path.basename(os.path.dirname(traj_dir)),\
|
|
62
|
+
os.path.basename(traj_dir))
|
|
63
|
+
|
|
64
|
+
traj_file_name = DFT_STYLE.get_aimd_config(self.resource.dft_style)
|
|
65
|
+
|
|
66
|
+
scf_lsit = self.make_scf_file(
|
|
67
|
+
scf_dir =scf_dir,
|
|
68
|
+
traj_file =os.path.join(traj_dir, traj_file_name),
|
|
69
|
+
traj_format =DFT_STYLE.get_format_by_postfix(traj_file_name),
|
|
70
|
+
interval = self.input_param.interval,
|
|
71
|
+
target_format=DFT_STYLE.get_pwdata_format(self.input_param.scf_style, is_cp2k_coord=True),
|
|
72
|
+
input_file =init_config.scf_input_file,
|
|
73
|
+
kspacing =init_config.scf_kspacing,
|
|
74
|
+
flag_symm =init_config.scf_flag_symm,
|
|
75
|
+
is_dftb = False,
|
|
76
|
+
in_skf =None)
|
|
77
|
+
|
|
78
|
+
scf_paths.extend(scf_lsit)
|
|
79
|
+
# make slurm script and slurm job
|
|
80
|
+
self.make_scf_slurm_job_files(scf_paths, use_dftb)
|
|
81
|
+
|
|
82
|
+
def check_work_done(self):
|
|
83
|
+
slurm_remain, slurm_success = get_slurm_job_run_info(self.scf_dir, \
|
|
84
|
+
job_patten="*-{}".format(INIT_BULK.scf_job), \
|
|
85
|
+
tag_patten="*-{}".format(INIT_BULK.scf_tag))
|
|
86
|
+
slurm_done = True if len(slurm_remain) == 0 and len(slurm_success) > 0 else False # len(slurm_remain) > 0 exist slurm jobs need to do
|
|
87
|
+
return slurm_done
|
|
88
|
+
|
|
89
|
+
def do_scf_jobs(self):
|
|
90
|
+
mission = Mission()
|
|
91
|
+
slurm_remain, slurm_success = get_slurm_job_run_info(self.scf_dir, \
|
|
92
|
+
job_patten="*-{}".format(INIT_BULK.scf_job), \
|
|
93
|
+
tag_patten="*-{}".format(INIT_BULK.scf_tag))
|
|
94
|
+
slurm_done = True if len(slurm_remain) == 0 and len(slurm_success) > 0 else False # len(slurm_remain) > 0 exist slurm jobs need to do
|
|
95
|
+
if slurm_done is False:
|
|
96
|
+
#recover slurm jobs
|
|
97
|
+
if len(slurm_remain) > 0:
|
|
98
|
+
print("Run these relabel Jobs:\n")
|
|
99
|
+
print(slurm_remain)
|
|
100
|
+
for i, script_path in enumerate(slurm_remain):
|
|
101
|
+
slurm_job = SlurmJob()
|
|
102
|
+
tag_name = "{}-{}".format(os.path.basename(script_path).split('-')[0].strip(), INIT_BULK.scf_tag)
|
|
103
|
+
tag = os.path.join(os.path.dirname(script_path),tag_name)
|
|
104
|
+
slurm_job.set_tag(tag)
|
|
105
|
+
slurm_job.set_cmd(script_path)
|
|
106
|
+
mission.add_job(slurm_job)
|
|
107
|
+
|
|
108
|
+
if len(mission.job_list) > 0:
|
|
109
|
+
mission.commit_jobs()
|
|
110
|
+
mission.check_running_job()
|
|
111
|
+
mission.all_job_finished(error_type=SLURM_OUT.dft_out)
|
|
112
|
+
# mission.move_slurm_log_to_slurm_work_dir()
|
|
113
|
+
|
|
114
|
+
'''
|
|
115
|
+
description:
|
|
116
|
+
input_file is scf input control file, for vasp is incar, for pwmat is etot.input
|
|
117
|
+
return {*}
|
|
118
|
+
author: wuxingxing
|
|
119
|
+
'''
|
|
120
|
+
def make_scf_file(self, scf_dir:str, traj_file:str, traj_format:str, interval:int, target_format:str, \
|
|
121
|
+
input_file:str, kspacing:float=None, flag_symm:int=None, is_dftb:bool=False, in_skf:str=None):
|
|
122
|
+
config = load_config(format=traj_format, config=traj_file)
|
|
123
|
+
index_list = list(range(0, len(config), interval))
|
|
124
|
+
scf_lsit = []
|
|
125
|
+
for index in index_list:
|
|
126
|
+
save_dir = os.path.join(scf_dir, "{}-{}".format(index, INIT_BULK.scf))
|
|
127
|
+
if not os.path.exists(save_dir):
|
|
128
|
+
os.makedirs(save_dir)
|
|
129
|
+
#1. set config file
|
|
130
|
+
target_config = save_config(config=config[index],
|
|
131
|
+
input_format=traj_format,# or None, the same
|
|
132
|
+
wrap = False,
|
|
133
|
+
direct = True,
|
|
134
|
+
sort = True,
|
|
135
|
+
save_format=target_format,
|
|
136
|
+
save_path=save_dir,
|
|
137
|
+
save_name=DFT_STYLE.get_normal_config(self.input_param.scf_style))
|
|
138
|
+
|
|
139
|
+
atom_type_list, _ = get_atom_type(config[index])
|
|
140
|
+
#2. set pseudo files
|
|
141
|
+
# if not is_dftb:
|
|
142
|
+
pseudo_names = link_pseudo_by_atom(
|
|
143
|
+
pseudo_list = self.input_param.dft_input.scf_pseudo,
|
|
144
|
+
target_dir = save_dir,
|
|
145
|
+
atom_order = atom_type_list,
|
|
146
|
+
dft_style = self.resource.scf_style,
|
|
147
|
+
basis_set_file =self.input_param.dft_input.basis_set_file,
|
|
148
|
+
potential_file =self.input_param.dft_input.potential_file
|
|
149
|
+
)
|
|
150
|
+
# else:
|
|
151
|
+
# # link in.skf path to aimd dir
|
|
152
|
+
# pseudo_names = []
|
|
153
|
+
# target_dir = os.path.join(aimd_dir, PWMAT.in_skf)
|
|
154
|
+
# link_file(in_skf, target_dir)
|
|
155
|
+
#3. make dft input file
|
|
156
|
+
set_input_script(
|
|
157
|
+
input_file=input_file,
|
|
158
|
+
config=target_config,
|
|
159
|
+
dft_style=self.resource.scf_style,
|
|
160
|
+
kspacing=kspacing,
|
|
161
|
+
flag_symm=flag_symm,
|
|
162
|
+
save_dir = save_dir,
|
|
163
|
+
pseudo_names=pseudo_names,
|
|
164
|
+
basis_set_file_name=self.input_param.dft_input.basis_set_file,# these for cp2k
|
|
165
|
+
potential_file_name=self.input_param.dft_input.potential_file
|
|
166
|
+
)
|
|
167
|
+
scf_lsit.append(save_dir)
|
|
168
|
+
return scf_lsit
|
|
169
|
+
|
|
170
|
+
def make_scf_slurm_job_files(self, scf_dir_list:list[str],use_dftb: bool=False):
|
|
171
|
+
group_list = split_job_for_group(self.resource.scf_resource.group_size, scf_dir_list, self.resource.scf_resource.parallel_num)
|
|
172
|
+
for group_index, group in enumerate(group_list):
|
|
173
|
+
if group[0] == "NONE":
|
|
174
|
+
continue
|
|
175
|
+
jobname = "scf{}".format(group_index)
|
|
176
|
+
tag_name = "{}-{}".format(group_index, INIT_BULK.scf_tag)
|
|
177
|
+
tag = os.path.join(self.scf_dir, tag_name)
|
|
178
|
+
run_cmd = self.resource.scf_resource.command
|
|
179
|
+
group_slurm_script = set_slurm_script_content(gpu_per_node=self.resource.scf_resource.gpu_per_node,
|
|
180
|
+
number_node = self.resource.scf_resource.number_node,
|
|
181
|
+
cpu_per_node = self.resource.scf_resource.cpu_per_node,
|
|
182
|
+
queue_name = self.resource.scf_resource.queue_name,
|
|
183
|
+
custom_flags = self.resource.scf_resource.custom_flags,
|
|
184
|
+
env_script = self.resource.scf_resource.env_script,
|
|
185
|
+
job_name = jobname,
|
|
186
|
+
run_cmd_template = run_cmd,
|
|
187
|
+
group = group,
|
|
188
|
+
job_tag = tag,
|
|
189
|
+
task_tag = INIT_BULK.scf_tag,
|
|
190
|
+
task_tag_faild = INIT_BULK.scf_tag_failed,
|
|
191
|
+
parallel_num=self.resource.scf_resource.parallel_num,
|
|
192
|
+
check_type=self.resource.scf_style
|
|
193
|
+
)
|
|
194
|
+
slurm_script_name = "{}-{}".format(group_index, INIT_BULK.scf_job)
|
|
195
|
+
slurm_job_file = os.path.join(self.scf_dir, slurm_script_name)
|
|
196
|
+
write_to_file(slurm_job_file, group_slurm_script, "w")
|
|
197
|
+
|
|
198
|
+
def do_post_process(self):
|
|
199
|
+
if os.path.exists(self.scf_dir):
|
|
200
|
+
link_file(self.scf_dir, self.real_scf_dir)
|
|
@@ -105,7 +105,8 @@ class Relax(object):
|
|
|
105
105
|
else:
|
|
106
106
|
# link in.skf path to aimd dir
|
|
107
107
|
target_dir = os.path.join(relax_path, PWMAT.in_skf)
|
|
108
|
-
|
|
108
|
+
if self.input_param.dft_input.in_skf is not None:
|
|
109
|
+
link_file(self.input_param.dft_input.in_skf, target_dir)
|
|
109
110
|
pseudo_names = []
|
|
110
111
|
#3. make input file, for vasp is INCAR, for PWMAT is etot.input, for cp2k is inp file
|
|
111
112
|
set_input_script(
|
|
@@ -173,7 +173,8 @@ class Labeling(object):
|
|
|
173
173
|
else:
|
|
174
174
|
# link in.skf path to aimd dir
|
|
175
175
|
target_dir = os.path.join(scf_dir, PWMAT.in_skf)
|
|
176
|
-
|
|
176
|
+
if self.input_param.scf.in_skf is not None:
|
|
177
|
+
link_file(self.input_param.scf.in_skf, target_dir)
|
|
177
178
|
pseudo_names = []
|
|
178
179
|
#2. make etot.input file
|
|
179
180
|
set_input_script(
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
import argparse
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import glob
|
|
6
|
+
import json
|
|
7
|
+
from pwdata.main import Config
|
|
8
|
+
def make_kspacing_kpoints(config, format, kspacing):
|
|
9
|
+
config = Config(format=format, data_path=config)
|
|
10
|
+
# with open(config, "r") as fp:
|
|
11
|
+
# lines = fp.read().split("\n")
|
|
12
|
+
# box = []
|
|
13
|
+
# for idx, ii in enumerate(lines):
|
|
14
|
+
# if "LATTICE" in ii.upper():
|
|
15
|
+
# for kk in range(idx + 1, idx + 1 + 3):
|
|
16
|
+
# vector = [float(jj) for jj in lines[kk].split()[0:3]]
|
|
17
|
+
# box.append(vector)
|
|
18
|
+
# box = np.array(box)
|
|
19
|
+
# rbox = _reciprocal_box(box)
|
|
20
|
+
box = config.images.lattice
|
|
21
|
+
rbox = _reciprocal_box(box)
|
|
15
22
|
kpoints = [
|
|
16
|
-
round(2 * np.pi * np.linalg.norm(ii) / kspacing) for ii in rbox
|
|
23
|
+
max(1, round(2 * np.pi * np.linalg.norm(ii) / kspacing)) for ii in rbox
|
|
17
24
|
]
|
|
18
|
-
kpoints
|
|
19
|
-
kpoints
|
|
20
|
-
|
|
25
|
+
#DP pwmat multi kpoints will be slow, use round not ceil
|
|
26
|
+
# kpoints = [
|
|
27
|
+
# max(1, (np.ceil(2 * np.pi * np.linalg.norm(ii) / ks).astype(int)))
|
|
28
|
+
# for ii, ks in zip(rbox, [kspacing,kspacing,kspacing])
|
|
29
|
+
# ]
|
|
21
30
|
ret = ""
|
|
22
31
|
ret += "%d %d %d 0 0 0 " % (kpoints[0], kpoints[1], kpoints[2])
|
|
23
32
|
print(ret)
|
|
@@ -27,10 +36,40 @@ def _reciprocal_box(box):
|
|
|
27
36
|
rbox = np.linalg.inv(box)
|
|
28
37
|
rbox = rbox.T
|
|
29
38
|
return rbox
|
|
39
|
+
|
|
40
|
+
def get_energy_dftb_vasp():
|
|
41
|
+
aimd_dir = "/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2/temp_init_bulk_work/aimd"#/init_config_0/init/0_aimd
|
|
42
|
+
scf_dir = "/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2/temp_init_bulk_work/scf"#init_config_0/init/0_aimd/0-scf
|
|
43
|
+
save_file = "/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2/energy_count_xtb.txt"
|
|
44
|
+
aimd_dir = glob.glob(os.path.join(aimd_dir, "init_config_*"))
|
|
45
|
+
aimd_dir = sorted(aimd_dir, key=lambda x: int(os.path.basename(x).split('_')[-1]))
|
|
46
|
+
|
|
47
|
+
save_text = []
|
|
48
|
+
for aimd in aimd_dir:
|
|
49
|
+
mvm_config = Config(format="pwmat/movement", data_path=os.path.join(aimd, "init/0_aimd/MOVEMENT"))
|
|
50
|
+
scf_list = glob.glob(os.path.join(scf_dir, os.path.basename(aimd), "init/0_aimd/*-scf"))
|
|
51
|
+
scf_list = sorted(scf_list, key=lambda x: int(os.path.basename(x).split('-')[0]))
|
|
52
|
+
for scf in scf_list:
|
|
53
|
+
index = int(os.path.basename(scf).split('-')[0])
|
|
54
|
+
scf_config = Config(format="vasp/outcar", data_path=os.path.join(scf, "OUTCAR"))
|
|
55
|
+
if index == 0:
|
|
56
|
+
base = scf_config.images[0].Ep - mvm_config.images[index].Ep
|
|
57
|
+
save_text.append("aimd {} index {} dftb_energy {} vasp_energy {} vasp_just {}"\
|
|
58
|
+
.format(os.path.basename(aimd), index, \
|
|
59
|
+
mvm_config.images[index].Ep, scf_config.images[0].Ep,\
|
|
60
|
+
scf_config.images[0].Ep - base))
|
|
30
61
|
|
|
62
|
+
with open(save_file, 'w') as wf:
|
|
63
|
+
for line in save_text:
|
|
64
|
+
wf.write(line)
|
|
65
|
+
wf.write("\n")
|
|
31
66
|
if __name__=="__main__":
|
|
32
|
-
parser = argparse.ArgumentParser()
|
|
33
|
-
parser.add_argument('-i', '--config', help="specify config file path of
|
|
34
|
-
parser.add_argument('-
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
# parser = argparse.ArgumentParser()
|
|
68
|
+
# parser.add_argument('-i', '--config', help="specify config file path of config", type=str, default='atom.config')
|
|
69
|
+
# parser.add_argument('-f', '--format', help="specify config file format config", type=str, default='pwmat/config')
|
|
70
|
+
# parser.add_argument('-k', '--kspacing', help="specify the kspacing, the default 0.5", type=float, default=0.5)
|
|
71
|
+
# args = parser.parse_args()
|
|
72
|
+
# make_kspacing_kpoints(config=args.config, format=args.format, kspacing=args.kspacing)
|
|
73
|
+
# make_kspacing_kpoints(config="/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2/temp_init_bulk_work/scf/init_config_0/init/0_aimd/0-scf/POSCAR",
|
|
74
|
+
# format="vasp/poscar", kspacing=0.5)
|
|
75
|
+
get_energy_dftb_vasp()
|
|
@@ -58,7 +58,6 @@ class ModelKPU(object):
|
|
|
58
58
|
# md work dir
|
|
59
59
|
self.iter = get_iter_from_iter_name(self.itername)
|
|
60
60
|
self.md_job = self.input_param.explore.md_job_list[self.iter]
|
|
61
|
-
self.sys_paths = self.input_param.explore.sys_configs
|
|
62
61
|
# md work dir
|
|
63
62
|
self.explore_dir = os.path.join(self.input_param.root_dir, itername, TEMP_STRUCTURE.tmp_run_iter_dir, AL_STRUCTURE.explore)
|
|
64
63
|
self.md_dir = os.path.join(self.explore_dir, EXPLORE_FILE_STRUCTURE.md)
|
|
@@ -25,9 +25,12 @@ class InitBulkParam(object):
|
|
|
25
25
|
|
|
26
26
|
# set sys_config detail
|
|
27
27
|
self.dft_style = get_required_parameter("dft_style", json_dict).lower()
|
|
28
|
+
self.scf_style = get_parameter("scf_style", json_dict, None)
|
|
29
|
+
|
|
28
30
|
self.sys_config:list[Stage] = []
|
|
29
31
|
self.is_relax = False
|
|
30
32
|
self.is_aimd = False
|
|
33
|
+
self.is_scf = False
|
|
31
34
|
for index, config in enumerate(sys_configs):
|
|
32
35
|
stage = Stage(config, index, sys_config_prefix, self.dft_style)
|
|
33
36
|
self.sys_config.append(stage)
|
|
@@ -35,16 +38,22 @@ class InitBulkParam(object):
|
|
|
35
38
|
self.is_relax = True
|
|
36
39
|
if stage.aimd:
|
|
37
40
|
self.is_aimd = True
|
|
41
|
+
if stage.scf:
|
|
42
|
+
self.is_scf = True
|
|
38
43
|
|
|
39
44
|
# for PWmat: set etot.input files and persudo files
|
|
40
45
|
# for Vasp: set INCAR files and persudo files
|
|
41
|
-
self.dft_input = SCFParam(json_dict=json_dict, is_relax=self.is_relax, is_aimd=self.is_aimd, root_dir=self.root_dir, dft_style=self.dft_style)
|
|
46
|
+
self.dft_input = SCFParam(json_dict=json_dict, is_scf=self.is_scf, is_relax=self.is_relax, is_aimd=self.is_aimd, root_dir=self.root_dir, dft_style=self.dft_style, scf_style=self.scf_style)
|
|
42
47
|
# check and set relax etot.input file
|
|
43
48
|
for config in self.sys_config:
|
|
44
49
|
if self.is_relax:
|
|
45
50
|
if config.relax_input_idx >= len(self.dft_input.relax_input_list):
|
|
46
51
|
raise Exception("Error! for config '{}' 'relax_input_idx' {} not in 'relax_input'!".format(os.path.basename(config.config_file), config.relax_input_idx))
|
|
47
52
|
config.set_relax_input_file(self.dft_input.relax_input_list[config.relax_input_idx])
|
|
53
|
+
if self.is_scf:
|
|
54
|
+
if not os.path.exists(self.dft_input.scf_input_list[0].input_file):
|
|
55
|
+
raise Exception("Error! relabel dft input file {} not exisit!".format(self.dft_input.scf_input_list[0].input_file))
|
|
56
|
+
config.set_scf_input_file(self.dft_input.scf_input_list[0])
|
|
48
57
|
# check and set aimd etot.input file
|
|
49
58
|
for config in self.sys_config:
|
|
50
59
|
if self.is_aimd:
|
|
@@ -73,7 +82,9 @@ class Stage(object):
|
|
|
73
82
|
self.aimd = get_parameter("aimd", json_dict, True)
|
|
74
83
|
self.aimd_input_idx = get_parameter("aimd_input_idx", json_dict, 0)
|
|
75
84
|
self.aimd_input_file = None
|
|
76
|
-
|
|
85
|
+
|
|
86
|
+
self.scf = get_parameter("scf", json_dict, False)
|
|
87
|
+
|
|
77
88
|
super_cell = get_parameter("super_cell", json_dict, [])
|
|
78
89
|
super_cell = str_list_format(super_cell)
|
|
79
90
|
if len(super_cell) > 0:
|
|
@@ -96,7 +107,7 @@ class Stage(object):
|
|
|
96
107
|
else:
|
|
97
108
|
self.scale = None
|
|
98
109
|
|
|
99
|
-
self.perturb = get_parameter("perturb", json_dict,
|
|
110
|
+
self.perturb = get_parameter("perturb", json_dict, 0)
|
|
100
111
|
if self.perturb == 0:
|
|
101
112
|
self.perturb = None
|
|
102
113
|
self.cell_pert_fraction = get_parameter("cell_pert_fraction", json_dict, 0.03)
|
|
@@ -107,6 +118,11 @@ class Stage(object):
|
|
|
107
118
|
self.relax_kspacing = input_file.kspacing
|
|
108
119
|
self.relax_flag_symm = input_file.flag_symm
|
|
109
120
|
|
|
121
|
+
def set_scf_input_file(self, input_file:DFTInput):
|
|
122
|
+
self.scf_input_file = input_file.input_file
|
|
123
|
+
self.scf_kspacing = input_file.kspacing
|
|
124
|
+
self.scf_flag_symm = input_file.flag_symm
|
|
125
|
+
|
|
110
126
|
def set_aimd_input_file(self, input_file:DFTInput):
|
|
111
127
|
self.aimd_input_file = input_file.input_file
|
|
112
128
|
self.aimd_kspacing = input_file.kspacing
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import glob
|
|
3
|
+
|
|
2
4
|
from pwact.utils.json_operation import get_parameter, get_required_parameter
|
|
3
5
|
from pwact.utils.constant import MODEL_CMD, FORCEFILED, UNCERTAINTY, PWDATA
|
|
4
6
|
from pwact.active_learning.user_input.train_param.train_param import TrainParam
|
|
@@ -96,9 +98,22 @@ class StrategyParam(object):
|
|
|
96
98
|
res["model_num"] = self.model_num
|
|
97
99
|
|
|
98
100
|
class SysConfig(object):
|
|
101
|
+
'''
|
|
102
|
+
description:
|
|
103
|
+
for wildcard such as "scale-1.000/00000*/POSCAR"
|
|
104
|
+
param {*} self
|
|
105
|
+
param {str} sys_config
|
|
106
|
+
param {str} format
|
|
107
|
+
return {*}
|
|
108
|
+
author: wuxingxing
|
|
109
|
+
'''
|
|
99
110
|
def __init__(self, sys_config:str, format:str) -> None:
|
|
100
|
-
self.sys_config = sys_config
|
|
111
|
+
# self.sys_config = sys_config
|
|
101
112
|
self.format = format
|
|
113
|
+
sys_config_list = glob.glob(sys_config)
|
|
114
|
+
self.sys_config = sorted(sys_config_list)
|
|
115
|
+
|
|
116
|
+
|
|
102
117
|
|
|
103
118
|
class ExploreParam(object):
|
|
104
119
|
def __init__(self, json_dict, max_select:int=None) -> None:
|
|
@@ -107,6 +122,7 @@ class ExploreParam(object):
|
|
|
107
122
|
if isinstance(sys_configs, str) or isinstance(sys_configs, dict):
|
|
108
123
|
sys_configs = [sys_configs]
|
|
109
124
|
self.sys_configs:list[SysConfig]=[]
|
|
125
|
+
# self.sys_configs[0] = config files with * and format
|
|
110
126
|
for sys_config in sys_configs:
|
|
111
127
|
if isinstance(sys_config, str):
|
|
112
128
|
config = os.path.join(sys_config_prefix, sys_config) if sys_config_prefix is not None else sys_config
|
|
@@ -129,7 +145,7 @@ class ExploreParam(object):
|
|
|
129
145
|
if not isinstance(md_dict, list):
|
|
130
146
|
md_dict = [md_dict]
|
|
131
147
|
for md_exp_id, md_exp in enumerate(md_dict):
|
|
132
|
-
iter_exp_md.append(MdDetail(md_exp_id, md_exp, max_select))
|
|
148
|
+
iter_exp_md.append(MdDetail(md_exp_id, md_exp, max_select, self.sys_configs))
|
|
133
149
|
iter_md.append(iter_exp_md)
|
|
134
150
|
return iter_md
|
|
135
151
|
|
|
@@ -138,7 +154,7 @@ class ExploreParam(object):
|
|
|
138
154
|
return res
|
|
139
155
|
|
|
140
156
|
class MdDetail(object):
|
|
141
|
-
def __init__(self, md_index: int, json_dict:dict, max_select:int=None) -> None:
|
|
157
|
+
def __init__(self, md_index: int, json_dict:dict, max_select:int=None, sys_configs:list[SysConfig]=None) -> None:
|
|
142
158
|
self.md_index = md_index
|
|
143
159
|
self.nsteps = get_required_parameter("nsteps", json_dict)
|
|
144
160
|
self.md_dt = get_parameter("md_dt", json_dict, 0.001) #fs
|
|
@@ -156,27 +172,44 @@ class MdDetail(object):
|
|
|
156
172
|
if not isinstance(self.temp_list, list):
|
|
157
173
|
self.temp_list = [self.temp_list]
|
|
158
174
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
175
|
+
sys_idx = get_required_parameter("sys_idx", json_dict)
|
|
176
|
+
|
|
177
|
+
if not isinstance(sys_idx, list):
|
|
178
|
+
self.sys_idx = [sys_idx]
|
|
179
|
+
_select_sys = get_parameter("select_sys", json_dict, None)
|
|
180
|
+
if _select_sys is None:
|
|
164
181
|
if max_select is None:
|
|
165
|
-
|
|
182
|
+
_select_sys = 100 # if the max_select and select_sys are all None, set the select_sys to 100 as default
|
|
166
183
|
else:
|
|
167
|
-
|
|
168
|
-
if not isinstance(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
_select_sys = max_select
|
|
185
|
+
if not isinstance(_select_sys, list):
|
|
186
|
+
_select_sys = [_select_sys]
|
|
187
|
+
|
|
188
|
+
select_sys = []
|
|
189
|
+
if len(_select_sys) > 0:
|
|
190
|
+
if len(_select_sys) == 1:
|
|
191
|
+
for i in range(0, len(sys_idx)):
|
|
192
|
+
select_sys.append(_select_sys[0])
|
|
193
|
+
elif len(_select_sys) == len(sys_idx):
|
|
194
|
+
select_sys = _select_sys
|
|
177
195
|
else:
|
|
178
196
|
raise Exception("The length of the 'select_sys' array needs to be consistent with'sys_idx'" )
|
|
179
|
-
|
|
197
|
+
# reset select_sys and sys_idx by sys_configs
|
|
198
|
+
self.sys_idx = []
|
|
199
|
+
self.select_sys = []
|
|
200
|
+
self.config_file_list = []
|
|
201
|
+
self.config_file_format = []
|
|
202
|
+
file_id = 0
|
|
203
|
+
for index, sys_id in enumerate(sys_idx):
|
|
204
|
+
systems = sys_configs[sys_id].sys_config
|
|
205
|
+
system_format = sys_configs[sys_id].format
|
|
206
|
+
for system in systems:
|
|
207
|
+
self.config_file_list.append(system)
|
|
208
|
+
self.config_file_format.append(system_format)
|
|
209
|
+
self.sys_idx.append(file_id)
|
|
210
|
+
self.select_sys.append(select_sys[index])
|
|
211
|
+
file_id += 1
|
|
212
|
+
|
|
180
213
|
self.kspacing = get_parameter("temps", json_dict, None)
|
|
181
214
|
self.neigh_modify = get_parameter("neigh_modify", json_dict, 10)
|
|
182
215
|
self.mass = get_parameter("mass",json_dict, None)
|
|
@@ -3,7 +3,8 @@ from pwact.utils.constant import AL_WORK, DFT_STYLE, SLURM_OUT, CP2K, LAMMPS
|
|
|
3
3
|
|
|
4
4
|
class Resource(object):
|
|
5
5
|
# _instance = None
|
|
6
|
-
|
|
6
|
+
# scf_style for init_bulk relabel
|
|
7
|
+
def __init__(self, json_dict:dict, job_type:str=AL_WORK.run_iter, dft_style:str=None, scf_style:str=None) -> None:
|
|
7
8
|
if job_type == AL_WORK.run_iter:
|
|
8
9
|
self.train_resource = self.get_resource(get_required_parameter("train", json_dict))
|
|
9
10
|
if self.train_resource.number_node > 1:
|
|
@@ -21,16 +22,29 @@ class Resource(object):
|
|
|
21
22
|
# check dft resource
|
|
22
23
|
self.dft_resource = self.get_resource(get_required_parameter("dft", json_dict))
|
|
23
24
|
|
|
25
|
+
if "scf" in json_dict.keys():
|
|
26
|
+
self.scf_resource = self.get_resource(get_parameter("scf", json_dict, None))
|
|
27
|
+
else:
|
|
28
|
+
self.scf_resource = None
|
|
24
29
|
# dftb_command = get_parameter("dftb_command", json_dict["dft"], None)
|
|
25
30
|
# if dftb_command is not None:
|
|
26
31
|
# self.dft_resource.dftb_command = "{} > {}".format(dftb_command, SLURM_OUT.dft_out)
|
|
27
32
|
self.dft_style = dft_style
|
|
33
|
+
self.scf_style = scf_style
|
|
28
34
|
if DFT_STYLE.vasp.lower() == dft_style.lower():
|
|
29
35
|
self.dft_resource.command = "{} > {}".format(self.dft_resource.command, SLURM_OUT.dft_out)
|
|
30
36
|
elif DFT_STYLE.pwmat.lower() == dft_style.lower():
|
|
31
37
|
self.dft_resource.command = "{} > {}".format(self.dft_resource.command, SLURM_OUT.dft_out)
|
|
32
38
|
elif DFT_STYLE.cp2k.lower() == dft_style.lower():
|
|
33
39
|
self.dft_resource.command = "{} {} > {}".format(self.dft_resource.command, CP2K.cp2k_inp, SLURM_OUT.dft_out)
|
|
40
|
+
|
|
41
|
+
if self.scf_resource is not None and scf_style is not None:
|
|
42
|
+
if DFT_STYLE.vasp.lower() == scf_style.lower():
|
|
43
|
+
self.scf_resource.command = "{} > {}".format(self.scf_resource.command, SLURM_OUT.dft_out)
|
|
44
|
+
elif DFT_STYLE.pwmat.lower() == scf_style.lower():
|
|
45
|
+
self.scf_resource.command = "{} > {}".format(self.scf_resource.command, SLURM_OUT.dft_out)
|
|
46
|
+
elif DFT_STYLE.cp2k.lower() == scf_style.lower():
|
|
47
|
+
self.scf_resource.command = "{} {} > {}".format(self.scf_resource.command, CP2K.cp2k_inp, SLURM_OUT.dft_out)
|
|
34
48
|
|
|
35
49
|
# @classmethod
|
|
36
50
|
# def get_instance(cls, json_dict:dict = None):
|
|
@@ -90,4 +104,16 @@ class ResourceDetail(object):
|
|
|
90
104
|
self.env_script = env_script
|
|
91
105
|
|
|
92
106
|
if self.gpu_per_node is None and self.cpu_per_node is None:
|
|
93
|
-
raise Exception("ERROR! Both CPU and GPU resources are not specified!")
|
|
107
|
+
raise Exception("ERROR! Both CPU and GPU resources are not specified!")
|
|
108
|
+
# check param
|
|
109
|
+
if "$SLURM_NTASKS".lower() in command.lower():
|
|
110
|
+
pass
|
|
111
|
+
else:
|
|
112
|
+
if "mpirun -np" in command:
|
|
113
|
+
np_num = command.split()[2]
|
|
114
|
+
try:
|
|
115
|
+
np_num = int(np_num)
|
|
116
|
+
if np_num > cpu_per_node:
|
|
117
|
+
raise Exception("the 'command' in resource.json {} set error! The nums of np can not be bigger than 'cpu_per_node'!".format(command))
|
|
118
|
+
except Exception:
|
|
119
|
+
raise Exception("the 'command' in resource.json {} set error! The nums of np can not be parsed!".format(command))
|
|
@@ -9,7 +9,8 @@ class SCFParam(object):
|
|
|
9
9
|
is_aimd:bool=False,
|
|
10
10
|
is_scf:bool=False,
|
|
11
11
|
root_dir:str=None,
|
|
12
|
-
dft_style:str=None
|
|
12
|
+
dft_style:str=None,
|
|
13
|
+
scf_style:str=None) -> None:# for scf relabel in init_bulk
|
|
13
14
|
|
|
14
15
|
self.dft_style = dft_style
|
|
15
16
|
self.root_dir = root_dir
|
|
@@ -18,11 +19,17 @@ class SCFParam(object):
|
|
|
18
19
|
self.aimd_input_list = []
|
|
19
20
|
self.scf_input_list = []
|
|
20
21
|
self.pseudo = []
|
|
22
|
+
self.scf_pseudo = []
|
|
21
23
|
self.use_dftb = False
|
|
24
|
+
|
|
22
25
|
if is_scf:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
self.
|
|
26
|
+
if "scf_input" in json_dict.keys(): # for init_bulk relabel
|
|
27
|
+
json_scf = get_required_parameter("scf_input", json_dict)
|
|
28
|
+
self.scf_input_list = self.set_input(json_scf, flag_symm=0)
|
|
29
|
+
else: # for run_iter
|
|
30
|
+
self.scf_input_list = self.set_input(json_dict, flag_symm=0)
|
|
31
|
+
if self.scf_input_list[0].use_dftb:
|
|
32
|
+
self.use_dftb = True
|
|
26
33
|
if is_aimd:
|
|
27
34
|
json_aimd = get_required_parameter("aimd_input", json_dict)
|
|
28
35
|
self.aimd_input_list = self.set_input(json_aimd, flag_symm=0)
|
|
@@ -33,20 +40,33 @@ class SCFParam(object):
|
|
|
33
40
|
self.relax_input_list = self.set_input(json_relax, flag_symm=3)
|
|
34
41
|
if self.relax_input_list[0].use_dftb:
|
|
35
42
|
self.use_dftb = True
|
|
36
|
-
|
|
37
|
-
# self.use_dftb = True if self.scf_input_list[0].use_dftb else False
|
|
38
|
-
# set pseudo potential files
|
|
39
|
-
|
|
40
|
-
# for cp2k is some dicts, not used, just read the user input file
|
|
41
|
-
# self.basis_set_file = get_parameter("basis_set_file_name", json_dict, None)
|
|
42
|
-
# self.potential_file = get_parameter("potential_file_name", json_dict, None)
|
|
43
|
-
# self.xc_functional = get_parameter("xc_functional", json_dict, "PBE")
|
|
44
|
-
# self.potential = get_parameter("potential", json_dict, None)
|
|
45
|
-
# self.basis_set = get_parameter("basis_set", json_dict, None)
|
|
46
|
-
|
|
47
43
|
# for pwmat, use 'pseudo' key
|
|
48
44
|
# for vasp is INCAR file, use 'pseudo' key
|
|
49
45
|
pseudo = get_parameter("pseudo", json_dict, [])
|
|
46
|
+
self.pseudo = self._set_pseudo(pseudo, dft_style)
|
|
47
|
+
|
|
48
|
+
if is_scf:
|
|
49
|
+
scf_pseudo = get_parameter("scf_pseudo", json_dict, [])
|
|
50
|
+
self.scf_pseudo = self._set_pseudo(scf_pseudo, scf_style)
|
|
51
|
+
|
|
52
|
+
# for pwmat-dftb is in_skf, a dir string
|
|
53
|
+
in_skf = get_parameter("in_skf", json_dict, None)
|
|
54
|
+
self.in_skf = None
|
|
55
|
+
if self.use_dftb:
|
|
56
|
+
if in_skf is not None:
|
|
57
|
+
self.in_skf = in_skf if os.path.isabs(in_skf) else os.path.abspath(in_skf)
|
|
58
|
+
# if not os.path.exists(self.in_skf):
|
|
59
|
+
# raise Exception("ERROR! The 'in_skf' dir {} not exsit!".format(self.in_skf))
|
|
60
|
+
# else:
|
|
61
|
+
# raise Exception("ERROR! The 'USE_DFTB' is set in scf.input file, but the 'in_skf' dir not set!")
|
|
62
|
+
# else:
|
|
63
|
+
# pass
|
|
64
|
+
# for cp2k
|
|
65
|
+
self.basis_set_file = get_parameter("basis_set_file", json_dict, None)
|
|
66
|
+
self.potential_file = get_parameter("potential_file", json_dict, None)
|
|
67
|
+
|
|
68
|
+
def _set_pseudo(self, pseudo, style:str):
|
|
69
|
+
res_pseudo = []
|
|
50
70
|
if isinstance(pseudo, str):
|
|
51
71
|
pseudo = list(pseudo)
|
|
52
72
|
for pf in pseudo:
|
|
@@ -55,28 +75,13 @@ class SCFParam(object):
|
|
|
55
75
|
if not os.path.isabs(pf):
|
|
56
76
|
pf = os.path.abspath(pf)
|
|
57
77
|
# for vasp pseudo files, read the pseduo files and get the atom type in pseduo
|
|
58
|
-
if
|
|
78
|
+
if style == DFT_STYLE.vasp:
|
|
59
79
|
atom_type = get_vasp_pseudo_atom_type(pf)
|
|
60
80
|
# for pwmat pseudo files, get the atom type from pseudo file name
|
|
61
|
-
elif
|
|
81
|
+
elif style == DFT_STYLE.pwmat:
|
|
62
82
|
atom_type = os.path.basename(pf).split('.')[0]
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# for pwmat-dftb is in_skf, a dir string
|
|
66
|
-
in_skf = get_parameter("in_skf", json_dict, None)
|
|
67
|
-
self.in_skf = None
|
|
68
|
-
if self.use_dftb:
|
|
69
|
-
if in_skf is not None:
|
|
70
|
-
self.in_skf = in_skf if os.path.isabs(in_skf) else os.path.abspath(in_skf)
|
|
71
|
-
if not os.path.exists(self.in_skf):
|
|
72
|
-
raise Exception("ERROR! The 'in_skf' dir {} not exsit!".format(self.in_skf))
|
|
73
|
-
else:
|
|
74
|
-
raise Exception("ERROR! The 'USE_DFTB' is set in scf.input file, but the 'in_skf' dir not set!")
|
|
75
|
-
else:
|
|
76
|
-
pass
|
|
77
|
-
# for cp2k
|
|
78
|
-
self.basis_set_file = get_parameter("basis_set_file", json_dict, None)
|
|
79
|
-
self.potential_file = get_parameter("potential_file", json_dict, None)
|
|
83
|
+
res_pseudo.append([pf, atom_type])
|
|
84
|
+
return res_pseudo
|
|
80
85
|
|
|
81
86
|
'''
|
|
82
87
|
description:
|
|
@@ -239,6 +239,7 @@ class TrainParam(object):
|
|
|
239
239
|
if self.seed is not None:
|
|
240
240
|
params_dict["seed"] = self.seed
|
|
241
241
|
params_dict["model_num"] = self.model_num
|
|
242
|
+
params_dict["chunk_size"] = self.chunk_size
|
|
242
243
|
# params_dict["E_tolerance"] = self.descriptor.E_tolerance
|
|
243
244
|
# params_dict["Rmax"] = self.descriptor.Rmax
|
|
244
245
|
# params_dict["Rmin"] = self.Rmin
|
pwact/data_format/configop.py
CHANGED
|
@@ -12,8 +12,11 @@ param {str} format
|
|
|
12
12
|
return {*}
|
|
13
13
|
author: wuxingxing
|
|
14
14
|
'''
|
|
15
|
-
def get_atom_type(config_path
|
|
16
|
-
|
|
15
|
+
def get_atom_type(config_path, format:str=None):
|
|
16
|
+
if isinstance(config_path, str):
|
|
17
|
+
image = Config.read(format=format, data_path=config_path, atom_names=None)
|
|
18
|
+
else:
|
|
19
|
+
image = config_path
|
|
17
20
|
atomic_number_list = []
|
|
18
21
|
atomic_name_list = []
|
|
19
22
|
for atom in image.atom_type:
|
|
@@ -21,6 +24,10 @@ def get_atom_type(config_path:str, format:str):
|
|
|
21
24
|
atomic_number_list.append(atom)
|
|
22
25
|
return atomic_name_list, atomic_number_list
|
|
23
26
|
|
|
27
|
+
def load_config(config, format, atom_names=None):
|
|
28
|
+
config = Config.read(format=format, data_path=config, atom_names=atom_names)
|
|
29
|
+
return config
|
|
30
|
+
|
|
24
31
|
'''
|
|
25
32
|
description:
|
|
26
33
|
the input config could be vasp/pwmat/cp2k format
|
|
@@ -30,7 +37,8 @@ author: wuxingxing
|
|
|
30
37
|
'''
|
|
31
38
|
def save_config(config, input_format:str = None, wrap = False, direct = True, sort = True, \
|
|
32
39
|
save_format:str=None, save_path:str=None, save_name:str=None, atom_names: list[str] = None):
|
|
33
|
-
|
|
40
|
+
if isinstance(config, str):
|
|
41
|
+
config = Config.read(format=input_format, data_path=config, atom_names=atom_names)
|
|
34
42
|
if isinstance(config, list): # for lammps dump traj, config will be list
|
|
35
43
|
config = config[0]
|
|
36
44
|
if save_format == PWDATA.cp2k_scf:
|
|
@@ -189,11 +197,11 @@ def extract_pwdata(data_list:list[str],
|
|
|
189
197
|
)
|
|
190
198
|
|
|
191
199
|
if __name__ == "__main__":
|
|
192
|
-
in_config = "/data/home/wuxingxing/datas/al_dir/si_exp/init_bulk/collection/init_config_1/0.9_scale_pertub/0_pertub.config"
|
|
193
|
-
save_path = "/data/home/wuxingxing/datas/al_dir/si_exp/init_bulk/collection/init_config_1/0.9_scale_pertub"
|
|
194
|
-
image = Config.read(format="pwmat", data_path=in_config)
|
|
195
|
-
save_config(image, wrap=False, direct=True, sort=True,\
|
|
196
|
-
|
|
200
|
+
# in_config = "/data/home/wuxingxing/datas/al_dir/si_exp/init_bulk/collection/init_config_1/0.9_scale_pertub/0_pertub.config"
|
|
201
|
+
# save_path = "/data/home/wuxingxing/datas/al_dir/si_exp/init_bulk/collection/init_config_1/0.9_scale_pertub"
|
|
202
|
+
# image = Config.read(format="pwmat", data_path=in_config)
|
|
203
|
+
# save_config(image, wrap=False, direct=True, sort=True,\
|
|
204
|
+
# save_format="vasp", save_path=save_path, save_name="temp_poscar")
|
|
197
205
|
# save_config(image, wrap=False, direct=True, sort=True,\
|
|
198
206
|
# save_format="vasp", save_path=save_path, save_name="temp_poscar")
|
|
199
207
|
|
|
@@ -263,4 +271,22 @@ if __name__ == "__main__":
|
|
|
263
271
|
# save_name = "{}.config".format(os.path.basename(traj).split('.')[0])
|
|
264
272
|
# save_config(traj, input_format="dump", wrap=False, direct=True, sort=True,\
|
|
265
273
|
# save_format="pwmat", save_path=save_dir, save_name=save_name)
|
|
266
|
-
# print("{} to {} done!".format(traj, save_name))
|
|
274
|
+
# print("{} to {} done!".format(traj, save_name))
|
|
275
|
+
import glob
|
|
276
|
+
data_dir1 = glob.glob(os.path.join("/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2/temp_init_bulk_work/scf/init_config_*")) #
|
|
277
|
+
data_dir2 = glob.glob(os.path.join("/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_bulk_hfo2_600k/temp_init_bulk_work/scf/init_config_*"))
|
|
278
|
+
data_dir1.extend(data_dir2)
|
|
279
|
+
select_list = ["0-scf", "200-scf", "400-scf", "600-scf", "800-scf", "1000-scf"]
|
|
280
|
+
data_list = []
|
|
281
|
+
for dir in data_dir1:
|
|
282
|
+
_outcars = glob.glob(os.path.join(dir, "*/*/*/OUTCAR"))
|
|
283
|
+
for outcar in _outcars:
|
|
284
|
+
if os.path.basename(os.path.dirname(outcar)) in select_list:
|
|
285
|
+
data_list.append(outcar)
|
|
286
|
+
|
|
287
|
+
datasets_path = "/data/home/wuxingxing/datas/al_dir/HfO2/dftb/init_data_200"
|
|
288
|
+
extract_pwdata(data_list=data_list,
|
|
289
|
+
data_format="vasp/outcar",
|
|
290
|
+
datasets_path=datasets_path,
|
|
291
|
+
merge_data=True
|
|
292
|
+
)
|
pwact/main.py
CHANGED
|
@@ -35,7 +35,7 @@ def run_iter():
|
|
|
35
35
|
resource = Resource(machine_info, dft_style=input_param.dft_style)
|
|
36
36
|
os.chdir(input_param.root_dir)
|
|
37
37
|
print("The work dir change to {}".format(os.getcwd()))
|
|
38
|
-
record = input_param.record_file
|
|
38
|
+
record = os.path.abspath(input_param.record_file)
|
|
39
39
|
iter_rec = [0, -1]
|
|
40
40
|
if os.path.isfile(record):
|
|
41
41
|
with open (record) as frec :
|
|
@@ -145,7 +145,7 @@ def init_bulk():
|
|
|
145
145
|
os.chdir(system_json["work_dir"])
|
|
146
146
|
machine_info = convert_keys_to_lowercase(json.load(open(sys.argv[3])))
|
|
147
147
|
input_param = InitBulkParam(system_info)
|
|
148
|
-
resource = Resource(machine_info, job_type=AL_WORK.init_bulk, dft_style=input_param.dft_style)
|
|
148
|
+
resource = Resource(machine_info, job_type=AL_WORK.init_bulk, dft_style=input_param.dft_style, scf_style=input_param.scf_style)
|
|
149
149
|
|
|
150
150
|
os.chdir(input_param.root_dir)
|
|
151
151
|
|
|
@@ -155,12 +155,16 @@ def init_bulk():
|
|
|
155
155
|
|
|
156
156
|
def to_pwdata(input_cmds:list):
|
|
157
157
|
parser = argparse.ArgumentParser()
|
|
158
|
+
parser.add_argument('-t', '--worktype', help="specify work type, default is 'to_pwdata'", type=str, default='to_pwdata')
|
|
158
159
|
parser.add_argument('-i', '--input', help='specify input outcars or movement files', nargs='+', type=str, default=None)
|
|
159
160
|
parser.add_argument('-f', '--format', help="specify input file format, 'vasp/outcar' or 'pwmat/movement', default is 'pwmat/movement'", type=str, default="pwmat/movement")
|
|
160
161
|
parser.add_argument('-s', '--savepath', help="specify stored directory, default is 'PWdata'", type=str, default='PWdata')
|
|
161
162
|
parser.add_argument('-o', '--train_valid_ratio', help='specify stored directory, default=0.8', type=float, default=0.8)
|
|
162
|
-
parser.add_argument('-r', '--data_shuffle', help='specify stored directory, default is True', type=bool, required=False, default=True)
|
|
163
|
-
parser.add_argument('-
|
|
163
|
+
# parser.add_argument('-r', '--data_shuffle', help='specify stored directory, default is True', type=bool, required=False, default=True)
|
|
164
|
+
# parser.add_argument('-d', '--do_shuffle', help='if -d exits, doing the data shuffling', action='store_false')
|
|
165
|
+
parser.add_argument('-r', '--data_shuffle', help='Specify whether to do data shuffle operation, -r is True', action='store_true')
|
|
166
|
+
parser.add_argument('-m', '--merge', help='Specify whether to merge inputs to one, -m is True', action='store_true')
|
|
167
|
+
# parser.add_argument('-m', '--merge', help='merge inputs to one, default is False', type=bool, required=False, default=False)
|
|
164
168
|
parser.add_argument('-g', '--gap', help='Trail point interval before and after, default is 1', type=int, default=1)
|
|
165
169
|
|
|
166
170
|
parser.add_argument('-w', '--work_dir', help='specify work dir, default is current dir', type=str, default='./')
|
pwact/utils/app_lib/common.py
CHANGED
|
@@ -106,13 +106,15 @@ def set_input_script(
|
|
|
106
106
|
):
|
|
107
107
|
if dft_style == DFT_STYLE.pwmat:
|
|
108
108
|
target_file = os.path.join(save_dir, PWMAT.etot_input)
|
|
109
|
+
is_skf_file = os.path.exists(os.path.join(save_dir, PWMAT.in_skf))
|
|
109
110
|
script = set_etot_input_by_file( #do pwmat etot.input content check
|
|
110
111
|
etot_input_file=input_file,
|
|
111
112
|
atom_config=config,
|
|
112
113
|
kspacing=kspacing,
|
|
113
114
|
flag_symm=flag_symm,
|
|
114
115
|
pseudo_names=pseudo_names,
|
|
115
|
-
is_scf = is_scf
|
|
116
|
+
is_scf = is_scf,
|
|
117
|
+
is_skf_file = is_skf_file
|
|
116
118
|
)
|
|
117
119
|
write_to_file(target_file, script, "w")
|
|
118
120
|
elif dft_style == DFT_STYLE.vasp:
|
pwact/utils/app_lib/lammps.py
CHANGED
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
6
|
from pwact.utils.constant import FORCEFILED
|
|
7
|
-
|
|
7
|
+
from pwdata.calculators.const import ELEMENTMASSTABLE
|
|
8
8
|
def _sample_sphere():
|
|
9
9
|
while True:
|
|
10
10
|
vv = np.array([np.random.normal(), np.random.normal(), np.random.normal()])
|
|
@@ -29,16 +29,27 @@ def make_pair_style(md_type, forcefiled, atom_type:list[int], dump_info:str):
|
|
|
29
29
|
pair_style += "pair_coeff * * {}\n".format(atom_names)
|
|
30
30
|
return pair_style
|
|
31
31
|
|
|
32
|
-
def make_mass(mass):
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
# def make_mass(mass):
|
|
33
|
+
# if mass is None:
|
|
34
|
+
# return ""
|
|
35
35
|
|
|
36
|
+
# mass_str = "\n"
|
|
37
|
+
# if isinstance(mass, str):
|
|
38
|
+
# mass_str += "mass {}\n".format(mass)
|
|
39
|
+
# else:
|
|
40
|
+
# for m in mass:
|
|
41
|
+
# mass_str += "mass {}\n".format(m)
|
|
42
|
+
# return mass_str
|
|
43
|
+
|
|
44
|
+
def make_mass(atom_type:list):
|
|
45
|
+
if isinstance(atom_type, str):
|
|
46
|
+
atom_type = [atom_type]
|
|
47
|
+
if atom_type is None:
|
|
48
|
+
return ""
|
|
36
49
|
mass_str = "\n"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for m in mass:
|
|
41
|
-
mass_str += "mass {}\n".format(m)
|
|
50
|
+
|
|
51
|
+
for i, atom in enumerate(atom_type):
|
|
52
|
+
mass_str += "mass {} {}\n".format(i+1, ELEMENTMASSTABLE[atom])
|
|
42
53
|
return mass_str
|
|
43
54
|
|
|
44
55
|
def set_ensemble(ensemble):
|
|
@@ -104,7 +115,7 @@ def make_lammps_input(
|
|
|
104
115
|
)
|
|
105
116
|
md_script += "change_box all triclinic\n"
|
|
106
117
|
|
|
107
|
-
md_script += make_mass(
|
|
118
|
+
md_script += make_mass(atom_type)
|
|
108
119
|
dump_info = "out_freq ${{DUMP_FREQ}} out_file {} ".format(model_deviation_file)
|
|
109
120
|
md_script += make_pair_style(md_type, forcefiled, atom_type, dump_info)
|
|
110
121
|
#put_freq ${freq} out_file error
|
pwact/utils/app_lib/pwmat.py
CHANGED
|
@@ -320,7 +320,8 @@ def set_etot_input_by_file(
|
|
|
320
320
|
flag_symm:int=None,
|
|
321
321
|
atom_config:str=None,
|
|
322
322
|
pseudo_names:list[str]=None,
|
|
323
|
-
is_scf = False # if True, job is scf, and 'OUT.MLMD = T' to etot.input
|
|
323
|
+
is_scf = False, # if True, job is scf, and 'OUT.MLMD = T' to etot.input
|
|
324
|
+
is_skf_file = False # if True, set in.skf to etot.input file
|
|
324
325
|
):
|
|
325
326
|
key_values, etot_lines = read_and_check_etot_input(etot_input_file)
|
|
326
327
|
is_skf = False
|
|
@@ -343,9 +344,9 @@ def set_etot_input_by_file(
|
|
|
343
344
|
else:
|
|
344
345
|
new_etot_lines.append(etot_lines[index])
|
|
345
346
|
index += 1
|
|
346
|
-
new_etot_lines.append("
|
|
347
|
+
new_etot_lines.append("\nIN.ATOM = {}\n".format(os.path.basename(atom_config)))
|
|
347
348
|
# if dftb and need in_skf
|
|
348
|
-
if is_skf:
|
|
349
|
+
if is_skf and is_skf_file:
|
|
349
350
|
new_etot_lines.append("IN.SKF = ./{}/\n".format(PWMAT.in_skf))
|
|
350
351
|
# is not for dftb, reset the IN.PSP
|
|
351
352
|
if "USE_DFTB" not in key_values.keys() or key_values["USE_DFTB"] is None and key_values["USE_DFTB"] == "F":
|
pwact/utils/constant.py
CHANGED
|
@@ -350,6 +350,11 @@ class INIT_BULK:
|
|
|
350
350
|
aimd_tag = "tag.aimd.success"
|
|
351
351
|
aimd_tag_failed ="tag.aimd.failed"
|
|
352
352
|
|
|
353
|
+
scf = "scf"
|
|
354
|
+
scf_job = "scf.job"
|
|
355
|
+
scf_tag = "tag.scf.success"
|
|
356
|
+
scf_tag_failed ="tag.scf.failed"
|
|
357
|
+
|
|
353
358
|
collection = "collection"
|
|
354
359
|
npy_format_save_dir = "PWdata"
|
|
355
360
|
npy_format_name = "pwdata"
|
pwact/utils/file_operation.py
CHANGED
|
@@ -85,6 +85,8 @@ return {*}
|
|
|
85
85
|
author: wuxingxing
|
|
86
86
|
'''
|
|
87
87
|
def write_to_file(file_path, line, mode='w'):
|
|
88
|
+
if not os.path.exists(os.path.dirname(file_path)):
|
|
89
|
+
os.makedirs(os.path.dirname(file_path))
|
|
88
90
|
with open(file_path, mode) as wf:
|
|
89
91
|
wf.write(line)
|
|
90
92
|
|
|
@@ -102,8 +104,8 @@ def merge_files_to_one(file_list:list[str], save_file:str):
|
|
|
102
104
|
with open(file, 'r') as rf:
|
|
103
105
|
content = rf.read()
|
|
104
106
|
wf.write(content)
|
|
105
|
-
if index < len(file_list) - 1:
|
|
106
|
-
|
|
107
|
+
# if index < len(file_list) - 1:
|
|
108
|
+
# wf.write("\n")
|
|
107
109
|
|
|
108
110
|
'''
|
|
109
111
|
description:
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
pwact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
pwact/main.py,sha256=
|
|
2
|
+
pwact/main.py,sha256=gSh39PCdbAodiAc0vlwNWnf-ZTsjZ6KaH0F9awPN5dQ,12627
|
|
3
3
|
pwact/active_learning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
pwact/active_learning/environment.py,sha256=7jqZcYw5jNtMuW0TYlCIDCD4mUt6a7WdXq3PyXjLuG0,104
|
|
5
5
|
pwact/active_learning/slurm.py,sha256=XVeVIRRQUXWixxbUqR-tJQS4CNhEJV8pvp74O4e5InM,13108
|
|
6
6
|
pwact/active_learning/explore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
pwact/active_learning/explore/run_model_md.py,sha256=
|
|
7
|
+
pwact/active_learning/explore/run_model_md.py,sha256=GfdaT3W70VU0Ke12R0f2wcn92-nvi5yre5pU4lhyCYA,19112
|
|
8
8
|
pwact/active_learning/explore/select_image.py,sha256=QAoD1CxaC5Xn3W5rQHxTNWMN53K2wABLsw03XCJEFPg,10527
|
|
9
9
|
pwact/active_learning/init_bulk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
pwact/active_learning/init_bulk/aimd.py,sha256=
|
|
10
|
+
pwact/active_learning/init_bulk/aimd.py,sha256=J-L83Bj4oJYaJvmd_W76oKamFMJhoImjM5B9FC1Uobw,10437
|
|
11
11
|
pwact/active_learning/init_bulk/duplicate_scale.py,sha256=oVFB6umOhI8xGxNTPowvztxYgJPGAopU2bvV_NaHpdM,9463
|
|
12
|
-
pwact/active_learning/init_bulk/init_bulk_run.py,sha256=
|
|
13
|
-
pwact/active_learning/init_bulk/
|
|
12
|
+
pwact/active_learning/init_bulk/init_bulk_run.py,sha256=0rsGpjIqmlYwJvV2Gai1ZdhkB10T1sbNPTtKgRh_A1w,8298
|
|
13
|
+
pwact/active_learning/init_bulk/relabel.py,sha256=SvHUdzFj4kxiYkZ5v4elhEnAVqGqmaeEB1TN45ZmbTc,10410
|
|
14
|
+
pwact/active_learning/init_bulk/relax.py,sha256=4T7VI1sBmUWDwLbSn3JvPivHTLNcdSil5DoyKI7DEfM,10406
|
|
14
15
|
pwact/active_learning/label/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
pwact/active_learning/label/labeling.py,sha256=
|
|
16
|
+
pwact/active_learning/label/labeling.py,sha256=Qh_f27OxQytVaCtcqLj2eKs4usqSpQlnFPtLApM7adQ,14886
|
|
16
17
|
pwact/active_learning/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
pwact/active_learning/test/test.py,sha256=
|
|
18
|
+
pwact/active_learning/test/test.py,sha256=ZoA4W3VG9-XLQ6onUvCIPq9PkfttEPKdz8GZX46cwIg,3582
|
|
18
19
|
pwact/active_learning/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
pwact/active_learning/train/dp_kpu.py,sha256=
|
|
20
|
+
pwact/active_learning/train/dp_kpu.py,sha256=cdQzzoigwulRfrHP5AfuEVQn6Rw3RVflHHTvgWs1CQM,9197
|
|
20
21
|
pwact/active_learning/train/train_model.py,sha256=n0m-DS2GBelaMHGKRFUy_JACbyjJ8Q3Nw_6FkHIDeo8,9730
|
|
21
22
|
pwact/active_learning/user_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
23
|
pwact/active_learning/user_input/cmd_infos.py,sha256=zWONvAXlpYsRgCxG2q43M7fmWLjVG0mbmeL6JKcJCtk,1468
|
|
23
|
-
pwact/active_learning/user_input/init_bulk_input.py,sha256=
|
|
24
|
-
pwact/active_learning/user_input/iter_input.py,sha256=
|
|
25
|
-
pwact/active_learning/user_input/resource.py,sha256=
|
|
26
|
-
pwact/active_learning/user_input/scf_param.py,sha256=
|
|
24
|
+
pwact/active_learning/user_input/init_bulk_input.py,sha256=NCUAB1xpa67MXHRRWAkmWZjkQbTibE4EjmtlOmr0HdQ,6762
|
|
25
|
+
pwact/active_learning/user_input/iter_input.py,sha256=TLlilMx7oUvXlK-6lbedMXU-FS-IEVnyDsmB14kFd2Y,10657
|
|
26
|
+
pwact/active_learning/user_input/resource.py,sha256=jVahpvdYHXYaeKWxNSLy1YkoZ-QtcUnW-MwJOVbRyD8,6269
|
|
27
|
+
pwact/active_learning/user_input/scf_param.py,sha256=xXS-8bhXF_KdE0Jc9P8UZcbhWb0qKRWRhfBI9t5Rz6M,8883
|
|
27
28
|
pwact/active_learning/user_input/workdir.py,sha256=64J3wBbYzy6ztYHs513YHfEIF5d8zwv_WpF-U9HOEkA,8245
|
|
28
29
|
pwact/active_learning/user_input/train_param/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
30
|
pwact/active_learning/user_input/train_param/model_param.py,sha256=ogP6Th5--X1nWtO_BmQKGIRCi_UYXpQQ-Ki5OslBTfI,4381
|
|
30
31
|
pwact/active_learning/user_input/train_param/nep_param.py,sha256=NZCJtrJ0_W5V4K4c0j_IXwhlRbq_aKeVSpDSO0Qm_u0,10446
|
|
31
32
|
pwact/active_learning/user_input/train_param/nn_feature_type.py,sha256=ytah4nIU1EuuaOYScSPxwhf3tSQv3lpNxva0CUvGvHw,14625
|
|
32
33
|
pwact/active_learning/user_input/train_param/optimizer_param.py,sha256=npyMZn3CcqKn34k4jPBD4oNdN0z14e8F4CVIZkYBrpY,8063
|
|
33
|
-
pwact/active_learning/user_input/train_param/train_param.py,sha256=
|
|
34
|
+
pwact/active_learning/user_input/train_param/train_param.py,sha256=wt_PHDrfk5eOygX0wUKzCIsB2OW0XOWicHQPWUEPKyg,13132
|
|
34
35
|
pwact/active_learning/user_input/train_param/work_file_param.py,sha256=tvvxWto8oH7CZPowLjhbvkUn5kQJLE33b2UBfmK_Kxs,11219
|
|
35
36
|
pwact/bin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
37
|
pwact/data_format/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
-
pwact/data_format/configop.py,sha256=
|
|
38
|
+
pwact/data_format/configop.py,sha256=VN_F7Ckmdty-kUClfvhzTSnNvl7w9iwsBHMY2CHwo8Q,12525
|
|
38
39
|
pwact/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
pwact/utils/constant.py,sha256=
|
|
40
|
-
pwact/utils/file_operation.py,sha256=
|
|
40
|
+
pwact/utils/constant.py,sha256=Lt3KYgtzPxccsTk_qT8RdVWP4xS1awgBAEPJ9Oq16Ug,17455
|
|
41
|
+
pwact/utils/file_operation.py,sha256=3IPXqOxOmh1MfqL_YDKMurw5oyY072y8WTplbLW4rXw,8400
|
|
41
42
|
pwact/utils/format_input_output.py,sha256=oYFydQy3-btXzieO2O2LbHFoeRyhPnLVE4c5TNgS-IQ,1798
|
|
42
43
|
pwact/utils/json_operation.py,sha256=BqBsnIjk1URoMW_s2yu7Gk8IBxlir-oo6ivt8P3RIqg,1794
|
|
43
44
|
pwact/utils/pre_al_data_util.py,sha256=QE-axnVYUIyORFiVs-WK9-UaJlMUFY816_rSyYOOJc8,2542
|
|
44
45
|
pwact/utils/slurm_script.py,sha256=GISYPiMezVg5HiJs9MfcVDyycCh9fLbTQ3lLzAQGOIU,8188
|
|
45
46
|
pwact/utils/app_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
pwact/utils/app_lib/common.py,sha256=
|
|
47
|
+
pwact/utils/app_lib/common.py,sha256=KiKZHrk_SDwP9b8ZORor8rXzZbU-vSSjliqlYvjyvPQ,5552
|
|
47
48
|
pwact/utils/app_lib/cp2k.py,sha256=vPTofDEz8Qd1A3gjMkMxXF8qWQLVz3XDc6-hSjRG7j0,10499
|
|
48
|
-
pwact/utils/app_lib/lammps.py,sha256=
|
|
49
|
-
pwact/utils/app_lib/pwmat.py,sha256=
|
|
50
|
-
pwact-0.1.
|
|
51
|
-
pwact-0.1.
|
|
52
|
-
pwact-0.1.
|
|
53
|
-
pwact-0.1.
|
|
54
|
-
pwact-0.1.
|
|
55
|
-
pwact-0.1.
|
|
49
|
+
pwact/utils/app_lib/lammps.py,sha256=2oxHJHdDxfDDWWmnjo0gMNwgGvxABwuDgDlb8kbhgfk,8037
|
|
50
|
+
pwact/utils/app_lib/pwmat.py,sha256=l3O_AXExy0Sgkz0RQolrvRg0ZfHLLySFteQZ2dhqfhs,16543
|
|
51
|
+
pwact-0.1.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
52
|
+
pwact-0.1.9.dist-info/METADATA,sha256=BGo8wMHO5dDXKeLrjk6NdvCRFjiyl7opgrai1PMZhcE,3658
|
|
53
|
+
pwact-0.1.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
54
|
+
pwact-0.1.9.dist-info/entry_points.txt,sha256=p61auAnpbn8E2WjvHNBA7rb9_NRAOCew4zdcCj33cGc,42
|
|
55
|
+
pwact-0.1.9.dist-info/top_level.txt,sha256=fY1_7sH5Lke4dC9L8MbYM4fT5aat5eCkAmpkIzY1SlM,6
|
|
56
|
+
pwact-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|