Skip to content

Commit

Permalink
temporarily enable and disable --unsafe-fixes (#71)
Browse files Browse the repository at this point in the history
* enable --unsafe-fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* NPY002 Replace legacy  call with

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Yi-FanLi and pre-commit-ci[bot] authored Aug 4, 2024
1 parent 9658ab1 commit 7268a9e
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 126 deletions.
16 changes: 8 additions & 8 deletions dpti/equi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ def gen_equi_header(
ret += "variable THERMO_FREQ equal %d\n" % thermo_freq
ret += "variable DUMP_FREQ equal %d\n" % dump_freq
ret += "variable NREPEAT equal ${NSTEPS}/${DUMP_FREQ}\n"
ret += "variable TEMP equal %.6f\n" % temp
ret += f"variable TEMP equal {temp:.6f}\n"

Check warning on line 47 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L47

Added line #L47 was not covered by tests
# if equi_settings['pres'] is not None :
if pres is not None:
ret += "variable PRES equal %.6f\n" % pres
ret += "variable TAU_T equal %.6f\n" % tau_t
ret += "variable TAU_P equal %.6f\n" % tau_p
ret += f"variable PRES equal {pres:.6f}\n"
ret += f"variable TAU_T equal {tau_t:.6f}\n"
ret += f"variable TAU_P equal {tau_p:.6f}\n"

Check warning on line 52 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L50-L52

Added lines #L50 - L52 were not covered by tests
ret += "# ---------------------- INITIALIZAITION ------------------\n"
ret += "units metal\n"
ret += "boundary p p p\n"
ret += "atom_style atomic\n"
ret += "# --------------------- ATOM DEFINITION ------------------\n"
ret += "box tilt large\n"
ret += "read_data %s\n" % equi_conf
ret += f"read_data {equi_conf}\n"

Check warning on line 59 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L59

Added line #L59 was not covered by tests
ret += "change_box all triclinic\n"
for jj in range(len(mass_map)):
ret += "mass %d %.6f\n" % (jj + 1, mass_map[jj])
Expand All @@ -82,7 +82,7 @@ def gen_equi_force_field(model, if_meam=False, meam_model=None):
ret = ""
ret += "# --------------------- FORCE FIELDS ---------------------\n"
if not if_meam:
ret += "pair_style deepmd %s\n" % model
ret += f"pair_style deepmd {model}\n"

Check warning on line 85 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L85

Added line #L85 was not covered by tests
ret += "pair_coeff * *\n"
else:
meam_library = meam_model["library"]
Expand All @@ -97,7 +97,7 @@ def gen_equi_thermo_settings(timestep):
ret = ""
ret += "# --------------------- MD SETTINGS ----------------------\n"
ret += "neighbor 1.0 bin\n"
ret += "timestep %.6f\n" % timestep
ret += f"timestep {timestep:.6f}\n"

Check warning on line 100 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L100

Added line #L100 was not covered by tests
ret += "thermo ${THERMO_FREQ}\n"
ret += "compute allmsd all msd\n"
ret += "thermo_style custom step ke pe etotal enthalpy temp press vol lx ly lz xy xz yz pxx pyy pzz pxy pxz pyz c_allmsd[*]\n"
Expand Down Expand Up @@ -132,7 +132,7 @@ def gen_equi_ensemble_settings(ens):
elif ens == "nve":
ret += "fix 1 all nve\n"
else:
raise RuntimeError("unknow ensemble %s\n" % ens)
raise RuntimeError(f"unknow ensemble {ens}\n")

Check warning on line 135 in dpti/equi.py

View check run for this annotation

Codecov / codecov/patch

dpti/equi.py#L135

Added line #L135 was not covered by tests
ret += "fix mzero all momentum 10 linear 1 1 1\n"
ret += "# --------------------- INITIALIZE -----------------------\n"
ret += "velocity all create ${TEMP} %d\n" % (
Expand Down
32 changes: 16 additions & 16 deletions dpti/hti.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _ff_lj_on(lamb, model, sparam):
# sigma_hh = sparam['sigma_hh']
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 46 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L46

Added line #L46 was not covered by tests
ret += f"pair_style lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"

element_num = sparam.get("element_num", 1)
Expand Down Expand Up @@ -79,7 +79,7 @@ def _ff_deep_on(lamb, model, sparam, if_meam=False, meam_model=None):
# sigma_hh = sparam['sigma_hh']
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 82 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L82

Added line #L82 was not covered by tests
ret += "variable ONE equal 1\n"
# if if_meam:
# ret += 'pair_style hybrid/overlay meam lj/cut/soft %f %f %f \n' % (nn, alpha_lj, rcut)
Expand Down Expand Up @@ -166,7 +166,7 @@ def _ff_lj_off(lamb, model, sparam, if_meam=False, meam_model=None):
# sigma_hh = sparam['sigma_hh']
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 169 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L169

Added line #L169 was not covered by tests
ret += "variable INV_EPSILON equal -${EPSILON}\n"
# if if_meam:
# ret += 'pair_style hybrid/overlay meam lj/cut/soft %f %f %f \n' % (nn, alpha_lj, rcut)
Expand Down Expand Up @@ -248,7 +248,7 @@ def _ff_spring(lamb, m_spring_k, var_spring):
sum_str = "f_l_spring_1"
for ii in range(1, ntypes):
sum_str += "+f_l_spring_%s" % (ii + 1)
ret += "variable l_spring equal %s\n" % (sum_str)
ret += f"variable l_spring equal {sum_str}\n"

Check warning on line 251 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L251

Added line #L251 was not covered by tests
return ret


Expand Down Expand Up @@ -277,7 +277,7 @@ def _ff_soft_lj(lamb, model, m_spring_k, step, sparam, if_meam=False, meam_model
def _ff_two_steps(lamb, model, m_spring_k, step):
ret = ""
ret += "# --------------------- FORCE FIELDS ---------------------\n"
ret += "pair_style deepmd %s\n" % model
ret += f"pair_style deepmd {model}\n"

Check warning on line 280 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L280

Added line #L280 was not covered by tests
ret += "pair_coeff * *\n"

if step == "both" or step == "spring_off":
Expand Down Expand Up @@ -330,19 +330,19 @@ def _gen_lammps_input(
ret += "variable NSTEPS equal %d\n" % nsteps
ret += "variable THERMO_FREQ equal %d\n" % thermo_freq
ret += "variable DUMP_FREQ equal %d\n" % dump_freq
ret += "variable TEMP equal %f\n" % temp
ret += "variable PRES equal %f\n" % pres
ret += "variable TAU_T equal %f\n" % tau_t
ret += "variable TAU_P equal %f\n" % tau_p
ret += "variable LAMBDA equal %.10e\n" % lamb
ret += f"variable TEMP equal {temp:f}\n"
ret += f"variable PRES equal {pres:f}\n"
ret += f"variable TAU_T equal {tau_t:f}\n"
ret += f"variable TAU_P equal {tau_p:f}\n"
ret += f"variable LAMBDA equal {lamb:.10e}\n"

Check warning on line 337 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L333-L337

Added lines #L333 - L337 were not covered by tests
ret += "variable INV_LAMBDA equal %.10e\n" % (1 - lamb)
ret += "# ---------------------- INITIALIZAITION ------------------\n"
ret += "units metal\n"
ret += "boundary p p p\n"
ret += "atom_style atomic\n"
ret += "# --------------------- ATOM DEFINITION ------------------\n"
ret += "box tilt large\n"
ret += "read_data %s\n" % conf_file
ret += f"read_data {conf_file}\n"

Check warning on line 345 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L345

Added line #L345 was not covered by tests
if copies is not None:
ret += "replicate %d %d %d\n" % (copies[0], copies[1], copies[2])
ret += "change_box all triclinic\n"
Expand All @@ -367,7 +367,7 @@ def _gen_lammps_input(

ret += "# --------------------- MD SETTINGS ----------------------\n"
ret += "neighbor 1.0 bin\n"
ret += "timestep %s\n" % timestep
ret += f"timestep {timestep}\n"

Check warning on line 370 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L370

Added line #L370 was not covered by tests
ret += "thermo ${THERMO_FREQ}\n"
ret += "compute allmsd all msd\n"
if 1 - lamb != 0:
Expand Down Expand Up @@ -405,7 +405,7 @@ def _gen_lammps_input(
elif ens == "nve":
ret += "fix 1 all nve\n"
else:
raise RuntimeError("unknow ensemble %s\n" % ens)
raise RuntimeError(f"unknow ensemble {ens}\n")

Check warning on line 408 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L408

Added line #L408 was not covered by tests
ret += "# --------------------- INITIALIZE -----------------------\n"
ret += "velocity all create ${TEMP} %d\n" % (
np.random.default_rng().integers(1, 2**16)
Expand Down Expand Up @@ -806,7 +806,7 @@ def refine_task(
from_ti = os.path.join(from_task, "hti.out")
if not os.path.isfile(from_ti):
raise RuntimeError(
"cannot find file %s, task should be computed befor refined" % from_ti
f"cannot find file {from_ti}, task should be computed befor refined"
)
tmp_array = np.loadtxt(from_ti)
all_t = tmp_array[:, 0]
Expand Down Expand Up @@ -1276,9 +1276,9 @@ def compute_task(
info = thermo_info.copy()

if jdata["reference"] == "einstein":
print("# free ener of Einstein Mole: %20.8f" % e0)
print(f"# free ener of Einstein Mole: {e0:20.8f}")

Check warning on line 1279 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L1279

Added line #L1279 was not covered by tests
else:
print("# free ener of ideal gas: %20.8f" % e0)
print(f"# free ener of ideal gas: {e0:20.8f}")

Check warning on line 1281 in dpti/hti.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti.py#L1281

Added line #L1281 was not covered by tests

print(
("# fe contrib due to integration " + print_format) % (de, de_err[0], de_err[1])
Expand Down
6 changes: 3 additions & 3 deletions dpti/hti_ice.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ def handle_compute(args):
print_format = "%20.12f %10.3e %10.3e"
hti.print_thermo_info(thermo_info)
if crystal == "vega":
print("# free ener of Einstein Mole: %20.8f" % (e0))
print(f"# free ener of Einstein Mole: {e0:20.8f}")

Check warning on line 226 in dpti/hti_ice.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_ice.py#L226

Added line #L226 was not covered by tests
else:
print("# free ener of Einstein Crys: %20.8f" % (e0))
print(f"# free ener of Einstein Crys: {e0:20.8f}")

Check warning on line 228 in dpti/hti_ice.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_ice.py#L228

Added line #L228 was not covered by tests
print(f"# Pauling corr {note_pauling}: {pauling_corr:20.8f}")
print(
("# fe integration " + print_format) % (de, de_err[0], de_err[1])
)
print("# fe const shift %20.12f" % args.shift)
print(f"# fe const shift {args.shift:20.12f}")

Check warning on line 233 in dpti/hti_ice.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_ice.py#L233

Added line #L233 was not covered by tests
# if args.type == 'helmholtz' :
print("# Helmholtz free ener per mol (stat_err inte_err) [eV]:")
print(print_format % (e0 + de - args.shift, de_err[0], de_err[1]))
Expand Down
22 changes: 11 additions & 11 deletions dpti/hti_liq.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _ff_soft_on(lamb, sparam):
# sigma = sparam['sigma']
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 39 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L39

Added line #L39 was not covered by tests
ret += f"pair_style lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"

element_num = sparam.get("element_num", 1)
Expand Down Expand Up @@ -66,7 +66,7 @@ def _ff_deep_on(lamb, sparam, model, if_meam=False, meam_model=None):
# sigma = sparam['sigma']
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 69 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L69

Added line #L69 was not covered by tests
ret += "variable ONE equal 1\n"
if if_meam:
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"

Check warning on line 72 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L72

Added line #L72 was not covered by tests
Expand Down Expand Up @@ -110,7 +110,7 @@ def _ff_soft_off(lamb, sparam, model, if_meam=False, meam_model=None):
activation = sparam["activation"]
ret = ""
ret += "variable INV_LAMBDA equal 1-${LAMBDA}\n"
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 113 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L113

Added line #L113 was not covered by tests
ret += "variable INV_EPSILON equal -${EPSILON}\n"
if if_meam:
ret += f"pair_style hybrid/overlay meam lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f}\n"

Check warning on line 116 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L116

Added line #L116 was not covered by tests
Expand Down Expand Up @@ -166,19 +166,19 @@ def _gen_lammps_input_ideal(
ret += "variable NSTEPS equal %d\n" % nsteps
ret += "variable THERMO_FREQ equal %d\n" % thermo_freq
ret += "variable DUMP_FREQ equal %d\n" % dump_freq
ret += "variable TEMP equal %f\n" % temp
ret += "variable PRES equal %f\n" % pres
ret += "variable TAU_T equal %f\n" % tau_t
ret += "variable TAU_P equal %f\n" % tau_p
ret += "variable LAMBDA equal %.10e\n" % lamb
ret += f"variable TEMP equal {temp:f}\n"
ret += f"variable PRES equal {pres:f}\n"
ret += f"variable TAU_T equal {tau_t:f}\n"
ret += f"variable TAU_P equal {tau_p:f}\n"
ret += f"variable LAMBDA equal {lamb:.10e}\n"

Check warning on line 173 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L169-L173

Added lines #L169 - L173 were not covered by tests
ret += "variable ZERO equal 0\n"
ret += "# ---------------------- INITIALIZAITION ------------------\n"
ret += "units metal\n"
ret += "boundary p p p\n"
ret += "atom_style atomic\n"
ret += "# --------------------- ATOM DEFINITION ------------------\n"
ret += "box tilt large\n"
ret += "read_data %s\n" % conf_file
ret += f"read_data {conf_file}\n"

Check warning on line 181 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L181

Added line #L181 was not covered by tests
if copies is not None:
ret += "replicate %d %d %d\n" % (copies[0], copies[1], copies[2])
ret += "change_box all triclinic\n"
Expand All @@ -199,7 +199,7 @@ def _gen_lammps_input_ideal(
raise RuntimeError("unknown step")
ret += "# --------------------- MD SETTINGS ----------------------\n"
ret += "neighbor 1.0 bin\n"
ret += "timestep %s\n" % timestep
ret += f"timestep {timestep}\n"

Check warning on line 202 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L202

Added line #L202 was not covered by tests
ret += "compute allmsd all msd\n"
ret += "thermo ${THERMO_FREQ}\n"
ret += "thermo_style custom step ke pe etotal enthalpy temp press vol c_e_diff[1] c_allmsd[*]\n"
Expand All @@ -212,7 +212,7 @@ def _gen_lammps_input_ideal(
elif ens == "nve":
ret += "fix 1 all nve\n"
else:
raise RuntimeError("unknow ensemble %s\n" % ens)
raise RuntimeError(f"unknow ensemble {ens}\n")

Check warning on line 215 in dpti/hti_liq.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_liq.py#L215

Added line #L215 was not covered by tests
ret += "fix mzero all momentum 10 linear 1 1 1\n"
ret += "# --------------------- INITIALIZE -----------------------\n"
ret += "velocity all create ${TEMP} %d\n" % (
Expand Down
34 changes: 17 additions & 17 deletions dpti/hti_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ def _ff_angle_on(lamb, model, bparam, sparam):
sigma_hh = sparam["sigma_hh"]
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 43 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L43

Added line #L43 was not covered by tests
ret += f"pair_style lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f} \n"
ret += f"pair_coeff 1 1 ${{EPSILON}} {sigma_oo:f} {activation:f}\n"
ret += f"pair_coeff 1 2 ${{EPSILON}} {sigma_oh:f} {activation:f}\n"
ret += f"pair_coeff 2 2 ${{EPSILON}} {sigma_hh:f} {activation:f}\n"
ret += "bond_style harmonic\n"
ret += f"bond_coeff 1 {bond_k:f} {bond_l:f}\n"
ret += "variable ANGLE_K equal ${LAMBDA}*%.16e\n" % angle_k
ret += f"variable ANGLE_K equal ${{LAMBDA}}*{angle_k:.16e}\n"

Check warning on line 50 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L50

Added line #L50 was not covered by tests
ret += "angle_style harmonic\n"
ret += "angle_coeff 1 ${ANGLE_K} %f\n" % (angle_t)
ret += f"angle_coeff 1 ${{ANGLE_K}} {angle_t:f}\n"

Check warning on line 52 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L52

Added line #L52 was not covered by tests
ret += "fix tot_pot all adapt/fep 0 pair lj/cut/soft epsilon * * v_LAMBDA scale yes\n"
ret += "compute e_diff all fep ${TEMP} pair lj/cut/soft epsilon * * v_EPSILON\n"
return ret
Expand All @@ -69,7 +69,7 @@ def _ff_deep_on(lamb, model, bparam, sparam):
sigma_hh = sparam["sigma_hh"]
activation = sparam["activation"]
ret = ""
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 72 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L72

Added line #L72 was not covered by tests
ret += "variable ONE equal 1\n"
ret += f"pair_style hybrid/overlay deepmd {model} lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f} \n"

Check warning on line 74 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L74

Added line #L74 was not covered by tests
ret += "pair_coeff * * deepmd\n"
Expand Down Expand Up @@ -100,7 +100,7 @@ def _ff_bond_angle_off(lamb, model, bparam, sparam):
activation = sparam["activation"]
ret = ""
ret += "variable INV_LAMBDA equal 1-${LAMBDA}\n"
ret += "variable EPSILON equal %f\n" % epsilon
ret += f"variable EPSILON equal {epsilon:f}\n"

Check warning on line 103 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L103

Added line #L103 was not covered by tests
ret += "variable INV_EPSILON equal -${EPSILON}\n"
ret += f"pair_style hybrid/overlay deepmd {model} lj/cut/soft {nn:f} {alpha_lj:f} {rcut:f} \n"

Check warning on line 105 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L105

Added line #L105 was not covered by tests
ret += "pair_coeff * * deepmd\n"
Expand All @@ -109,10 +109,10 @@ def _ff_bond_angle_off(lamb, model, bparam, sparam):
ret += f"pair_coeff 2 2 lj/cut/soft ${{EPSILON}} {sigma_hh:f} {activation:f}\n"
ret += "variable BOND_K equal %.16e\n" % (bond_k * (1 - lamb))
ret += "bond_style harmonic\n"
ret += "bond_coeff 1 ${BOND_K} %f\n" % (bond_l)
ret += f"bond_coeff 1 ${{BOND_K}} {bond_l:f}\n"

Check warning on line 112 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L112

Added line #L112 was not covered by tests
ret += "variable ANGLE_K equal %.16e\n" % (angle_k * (1 - lamb))
ret += "angle_style harmonic\n"
ret += "angle_coeff 1 ${ANGLE_K} %f\n" % (angle_t)
ret += f"angle_coeff 1 ${{ANGLE_K}} {angle_t:f}\n"

Check warning on line 115 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L115

Added line #L115 was not covered by tests
ret += "fix tot_pot all adapt/fep 0 pair lj/cut/soft epsilon * * v_INV_LAMBDA scale yes\n"
ret += "compute e_diff all fep ${TEMP} pair lj/cut/soft epsilon * * v_INV_EPSILON\n"
return ret
Expand Down Expand Up @@ -143,18 +143,18 @@ def _gen_lammps_input(
ret += "variable NSTEPS equal %d\n" % nsteps
ret += "variable THERMO_FREQ equal %d\n" % prt_freq
ret += "variable DUMP_FREQ equal %d\n" % dump_freq
ret += "variable TEMP equal %f\n" % temp
ret += "variable PRES equal %f\n" % pres
ret += "variable TAU_T equal %f\n" % tau_t
ret += "variable TAU_P equal %f\n" % tau_p
ret += "variable LAMBDA equal %.10e\n" % lamb
ret += f"variable TEMP equal {temp:f}\n"
ret += f"variable PRES equal {pres:f}\n"
ret += f"variable TAU_T equal {tau_t:f}\n"
ret += f"variable TAU_P equal {tau_p:f}\n"
ret += f"variable LAMBDA equal {lamb:.10e}\n"

Check warning on line 150 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L146-L150

Added lines #L146 - L150 were not covered by tests
ret += "# ---------------------- INITIALIZAITION ------------------\n"
ret += "units metal\n"
ret += "boundary p p p\n"
ret += "atom_style angle\n"
ret += "# --------------------- ATOM DEFINITION ------------------\n"
ret += "box tilt large\n"
ret += "read_data %s\n" % conf_file
ret += f"read_data {conf_file}\n"

Check warning on line 157 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L157

Added line #L157 was not covered by tests
if copies is not None:
ret += "replicate %d %d %d\n" % (copies[0], copies[1], copies[2])
ret += "change_box all triclinic\n"
Expand All @@ -170,7 +170,7 @@ def _gen_lammps_input(
ret += "special_bonds lj/coul 1 1 1 angle no\n"
ret += "# --------------------- MD SETTINGS ----------------------\n"
ret += "neighbor 1.0 bin\n"
ret += "timestep %s\n" % dt
ret += f"timestep {dt}\n"

Check warning on line 173 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L173

Added line #L173 was not covered by tests
ret += "thermo ${THERMO_FREQ}\n"
ret += "thermo_style custom step ke pe etotal enthalpy temp press vol ebond eangle c_e_diff[1]\n"
ret += "thermo_modify format 9 %.16e\n"
Expand All @@ -184,7 +184,7 @@ def _gen_lammps_input(
elif ens == "nve":
ret += "fix 1 all nve\n"
else:
raise RuntimeError("unknow ensemble %s\n" % ens)
raise RuntimeError(f"unknow ensemble {ens}\n")

Check warning on line 187 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L187

Added line #L187 was not covered by tests
ret += "fix mzero all momentum 10 linear 1 1 1\n"
ret += "# --------------------- INITIALIZE -----------------------\n"
ret += "velocity all create ${TEMP} %d\n" % (
Expand Down Expand Up @@ -291,7 +291,7 @@ def _refine_tasks(from_task, to_task, err, step):
from_ti = os.path.join(from_task, "hti.out")
if not os.path.isfile(from_ti):
raise RuntimeError(
"cannot find file %s, task should be computed befor refined" % from_ti
f"cannot find file {from_ti}, task should be computed befor refined"
)
tmp_array = np.loadtxt(from_ti)
all_t = tmp_array[:, 0]
Expand Down Expand Up @@ -667,7 +667,7 @@ def compute_ideal_mol(iter_name):
def post_tasks(iter_name, natoms, method="inte", scheme="s"):
subtask_name = os.path.join(iter_name, "00.angle_on")
fe = compute_ideal_mol(subtask_name)
print("# fe of ideal mol: %20.12f" % fe)
print(f"# fe of ideal mol: {fe:20.12f}")

Check warning on line 670 in dpti/hti_water.py

View check run for this annotation

Codecov / codecov/patch

dpti/hti_water.py#L670

Added line #L670 was not covered by tests
# print('# fe of ideal gas: %20.12f' % (einstein.ideal_gas_fe(subtask_name) * 3))
if method == "inte":
e0, err0, tinfo0 = _post_tasks(subtask_name, "angle_on", natoms, scheme=scheme)
Expand Down
Loading

0 comments on commit 7268a9e

Please sign in to comment.