Skip to content

Commit 81eda74

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e391f8e commit 81eda74

File tree

9 files changed

+52
-52
lines changed

9 files changed

+52
-52
lines changed

dpti/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"equi",
77
"gdi",
88
"hti",
9-
"hti_liq",
109
"hti_ice",
10+
"hti_liq",
1111
"hti_water",
12+
"lib",
1213
"ti",
1314
"ti_water",
14-
"lib",
1515
]

dpti/dags/dp_ti_gdi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import time
44
from datetime import datetime, timedelta
5-
from typing import ClassVar, Dict
5+
from typing import ClassVar
66

77
from airflow import DAG
88
from airflow.api.client.local_client import Client
@@ -30,12 +30,12 @@
3030

3131

3232
class GDIDAGFactory:
33-
default_args: ClassVar[Dict[str, object]] = {
33+
default_args: ClassVar[dict[str, object]] = {
3434
"owner": "airflow",
3535
"start_date": datetime(2018, 1, 1),
3636
}
3737

38-
dagargs: ClassVar[Dict[str, object]] = {
38+
dagargs: ClassVar[dict[str, object]] = {
3939
"default_args": default_args,
4040
"schedule_interval": None,
4141
}

dpti/hti.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _ff_deep_on(lamb, model, sparam, if_meam=False, meam_model=None, append=None
8686
# ret += 'pair_coeff * * meam /home/fengbo/4_Sn/meam_files/library_18Metal.meam Sn /home/fengbo/4_Sn/meam_files/Sn_18Metal.meam Sn \n'
8787
if if_meam:
8888
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
89-
ret += f'pair_coeff * * meam {meam_model["library"]} {meam_model["element"]} {meam_model["potential"]} {meam_model["element"]}\n'
89+
ret += f"pair_coeff * * meam {meam_model['library']} {meam_model['element']} {meam_model['potential']} {meam_model['element']}\n"
9090
else:
9191
if append:
9292
ret += f"pair_style hybrid/overlay deepmd {model:s} {append:s} lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
@@ -175,7 +175,7 @@ def _ff_lj_off(lamb, model, sparam, if_meam=False, meam_model=None, append=None)
175175
# ret += 'pair_coeff * * meam /home/fengbo/4_Sn/meam_files/library_18Metal.meam Sn /home/fengbo/4_Sn/meam_files/Sn_18Metal.meam Sn\n'
176176
if if_meam:
177177
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
178-
ret += f'pair_coeff * * meam {meam_model["library"]} {meam_model["element"]} {meam_model["potential"]} {meam_model["element"]}\n'
178+
ret += f"pair_coeff * * meam {meam_model['library']} {meam_model['element']} {meam_model['potential']} {meam_model['element']}\n"
179179
# ret += f'pair_coeff * * meam {meam_model[0]} {meam_model[2]} {meam_model[1]} {meam_model[2]}\n'
180180
else:
181181
if append:
@@ -709,9 +709,9 @@ def _make_tasks(
709709
"sigma_" + str(t[0]) + "_" + str(t[1]) for t in sigma_key_index
710710
]
711711
for sigma_key_name in sigma_key_name_list:
712-
assert sparam.get(
713-
sigma_key_name, None
714-
), f"there must be key-value for {sigma_key_name} in soft_param"
712+
assert sparam.get(sigma_key_name, None), (
713+
f"there must be key-value for {sigma_key_name} in soft_param"
714+
)
715715

716716
if crystal == "frenkel":
717717
m_spring_k = []
@@ -1412,9 +1412,9 @@ def hti_phase_trans_analyze(job, jdata=None):
14121412
def run_task(task_dir, machine_file, task_name, no_dp=False):
14131413
if task_name == "00" or task_name == "01" or task_name == "02":
14141414
job_work_dir_ = glob.glob(os.path.join(task_dir, task_name + "*"))
1415-
assert (
1416-
len(job_work_dir_) == 1
1417-
), f"The task_name you entered is {task_name}. It indicates that you want to run tasks for step {task_name} of the two-step or three-step HTI. Please make sure that there is one and only one {task_name}.* directory in the hti task directory."
1415+
assert len(job_work_dir_) == 1, (
1416+
f"The task_name you entered is {task_name}. It indicates that you want to run tasks for step {task_name} of the two-step or three-step HTI. Please make sure that there is one and only one {task_name}.* directory in the hti task directory."
1417+
)
14181418
job_work_dir = job_work_dir_[0]
14191419
elif task_name == "one-step":
14201420
job_work_dir = task_dir

dpti/hti_liq.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def parse_lj_sigma_epsilon(ret, sparam, hybrid=False):
4848
activation_ij = np.zeros((element_num, element_num))
4949

5050
if epsilon is not None:
51-
assert (
52-
epsilon_0_0 is None
53-
), "epsilon and epsilon_0_0 cannot be set at the same time"
51+
assert epsilon_0_0 is None, (
52+
"epsilon and epsilon_0_0 cannot be set at the same time"
53+
)
5454
for i, j in sigma_key_index:
5555
epsilon_ij[i, j] = epsilon
5656
else:
@@ -68,9 +68,9 @@ def parse_lj_sigma_epsilon(ret, sparam, hybrid=False):
6868
sigma_ij[i, j] = sparam["sigma_" + str(i) + "_" + str(j)]
6969

7070
if activation is not None:
71-
assert (
72-
activation_0_0 is None
73-
), "activation and activation_0_0 cannot be set at the same time"
71+
assert activation_0_0 is None, (
72+
"activation and activation_0_0 cannot be set at the same time"
73+
)
7474
for i, j in sigma_key_index:
7575
activation_ij[i, j] = activation
7676
else:
@@ -110,7 +110,7 @@ def _ff_deep_on(lamb, sparam, model, if_meam=False, meam_model=None):
110110
ret += "variable ONE equal 1\n"
111111
if if_meam:
112112
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
113-
ret += f'pair_coeff * * meam {meam_model["library"]} {meam_model["element"]} {meam_model["potential"]} {meam_model["element"]}\n'
113+
ret += f"pair_coeff * * meam {meam_model['library']} {meam_model['element']} {meam_model['potential']} {meam_model['element']}\n"
114114
# ret += f'pair_coeff * * meam {meam_model[0]} {meam_model[2]} {meam_model[1]} {meam_model[2]}\n'
115115
else:
116116
ret += f"pair_style hybrid/overlay deepmd {model} lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
@@ -138,7 +138,7 @@ def _ff_soft_off(lamb, sparam, model, if_meam=False, meam_model=None):
138138
ret += "variable INV_LAMBDA equal 1-${LAMBDA}\n"
139139
if if_meam:
140140
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
141-
ret += f'pair_coeff * * meam {meam_model["library"]} {meam_model["element"]} {meam_model["potential"]} {meam_model["element"]}\n'
141+
ret += f"pair_coeff * * meam {meam_model['library']} {meam_model['element']} {meam_model['potential']} {meam_model['element']}\n"
142142
# ret += f'pair_coeff * * meam {meam_model[0]} {meam_model[2]} {meam_model[1} {meam_model[2]} \n'
143143
else:
144144
ret += f"pair_style hybrid/overlay deepmd {model} lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"
@@ -289,9 +289,9 @@ def _make_tasks(iter_name, jdata, step, if_meam=False, meam_model=None):
289289
"sigma_" + str(t[0]) + "_" + str(t[1]) for t in sigma_key_index
290290
]
291291
for sigma_key_name in sigma_key_name_list:
292-
assert sparam.get(
293-
sigma_key_name, None
294-
), f"there must be key-value for sigma or {sigma_key_name} in soft_param"
292+
assert sparam.get(sigma_key_name, None), (
293+
f"there must be key-value for sigma or {sigma_key_name} in soft_param"
294+
)
295295

296296
job_abs_dir = create_path(iter_name)
297297

dpti/mti.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ def make_tasks(iter_name, jdata):
165165
raise RuntimeError("invalid ens")
166166

167167
job_type = jdata["job_type"]
168-
assert (
169-
job_type == "nbead_convergence" or job_type == "mass_ti"
170-
), "Unknow job_type. Only nbead_convergence and mass_ti are supported."
168+
assert job_type == "nbead_convergence" or job_type == "mass_ti", (
169+
"Unknow job_type. Only nbead_convergence and mass_ti are supported."
170+
)
171171
mass_scale_y_seq = get_first_matched_key_from_dict(jdata, ["mass_scale_y"])
172172
mass_scale_y_list = parse_seq(mass_scale_y_seq)
173173
mass_scales = (1.0 / np.array(mass_scale_y_list)) ** 2
@@ -176,13 +176,13 @@ def make_tasks(iter_name, jdata):
176176
nnode_seq = jdata.get("nnode", None)
177177
if nnode_seq is not None:
178178
nnode_list = parse_seq(nnode_seq)
179-
assert (
180-
len(nbead_list) == len(nnode_list)
181-
), "Lists nbead and nnode should have same length. Please specify one nnode for each nbead."
179+
assert len(nbead_list) == len(nnode_list), (
180+
"Lists nbead and nnode should have same length. Please specify one nnode for each nbead."
181+
)
182182
if job_type == "mass_ti":
183-
assert (
184-
len(mass_scale_y_list) == len(nbead_list)
185-
), "For mass TI tasks, you must provide one value of nbead for each value of mass_scale_y."
183+
assert len(mass_scale_y_list) == len(nbead_list), (
184+
"For mass TI tasks, you must provide one value of nbead for each value of mass_scale_y."
185+
)
186186

187187
job_abs_dir = create_path(iter_name)
188188
ti_settings["equi_conf"] = relative_link_file(equi_conf, job_abs_dir)

dpti/ti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _gen_lammps_input(
9393
# ret += 'pair_coeff * * /home/fengbo/4_Sn/meam_files/library_18Metal.meam Sn /home/fengbo/4_Sn/meam_files/Sn_18Metal.meam Sn\n'
9494
if if_meam:
9595
ret += "pair_style meam\n"
96-
ret += f'pair_coeff * * {meam_model["library"]} {meam_model["element"]} {meam_model["potential"]} {meam_model["element"]}\n'
96+
ret += f"pair_coeff * * {meam_model['library']} {meam_model['element']} {meam_model['potential']} {meam_model['element']}\n"
9797
else:
9898
if append:
9999
ret += f"pair_style deepmd {model:s} {append:s}\n"

workflow/DpFreeEnergy-aiida.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ def all_start_check(dag_run):
4848
)
4949
dag_work_dir = os.path.join(work_base_abs_dir, dag_work_dirname)
5050

51-
assert (
52-
os.path.isdir(work_base_dir) is True
53-
), f"work_base_dir {work_base_dir} must exist "
51+
assert os.path.isdir(work_base_dir) is True, (
52+
f"work_base_dir {work_base_dir} must exist "
53+
)
5454
if os.path.isdir(dag_work_dir) is False:
5555
os.mkdir(dag_work_dir)
5656
else:
5757
pass
5858

5959
conf_lmp_abs_path = os.path.join(work_base_abs_dir, conf_lmp)
60-
assert (
61-
os.path.isfile(conf_lmp_abs_path) is True
62-
), f"structure file {conf_lmp_abs_path} must exist"
60+
assert os.path.isfile(conf_lmp_abs_path) is True, (
61+
f"structure file {conf_lmp_abs_path} must exist"
62+
)
6363
assert str(ti_path) in ["t", "p"], 'value for "path" must be "t" or "p" '
6464
start_info = {
6565
"work_base_dir": work_base_dir,

workflow/DpFreeEnergy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ def all_start_check():
3333
)
3434
dag_work_dir = os.path.join(work_base_abs_dir, dag_work_dirname)
3535

36-
assert (
37-
os.path.isdir(work_base_dir) is True
38-
), f"work_base_dir {work_base_dir} must exist "
36+
assert os.path.isdir(work_base_dir) is True, (
37+
f"work_base_dir {work_base_dir} must exist "
38+
)
3939
if os.path.isdir(dag_work_dir) is False:
4040
os.mkdir(dag_work_dir)
4141
else:
4242
pass
4343

4444
conf_lmp_abs_path = os.path.join(work_base_abs_dir, conf_lmp)
45-
assert (
46-
os.path.isfile(conf_lmp_abs_path) is True
47-
), f"structure file {conf_lmp_abs_path} must exist"
45+
assert os.path.isfile(conf_lmp_abs_path) is True, (
46+
f"structure file {conf_lmp_abs_path} must exist"
47+
)
4848
assert str(ti_path) in ["t", "p"], 'value for "path" must be "t" or "p" '
4949

5050
start_info = {

workflow/DpFreeEnergyWater.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ def all_start_check():
5757
)
5858
dag_work_dir = os.path.join(work_base_abs_dir, dag_work_dirname)
5959

60-
assert (
61-
os.path.isdir(work_base_dir) is True
62-
), f"work_base_dir {work_base_dir} must exist "
60+
assert os.path.isdir(work_base_dir) is True, (
61+
f"work_base_dir {work_base_dir} must exist "
62+
)
6363
if os.path.isdir(dag_work_dir) is False:
6464
os.mkdir(dag_work_dir)
6565
else:
6666
pass
6767

6868
conf_lmp_abs_path = os.path.join(work_base_abs_dir, conf_lmp)
69-
assert (
70-
os.path.isfile(conf_lmp_abs_path) is True
71-
), f"structure file {conf_lmp_abs_path} must exist"
69+
assert os.path.isfile(conf_lmp_abs_path) is True, (
70+
f"structure file {conf_lmp_abs_path} must exist"
71+
)
7272
assert str(ti_path) in ["t", "p"], 'value for "path" must be "t" or "p" '
7373

7474
start_info = {

0 commit comments

Comments
 (0)