Skip to content

Update shuffle_poscar feature in run.py #1730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
and iter_index > 0
and _check_skip_train(model_devi_jobs[iter_index - 1])
):
log_task("skip training at step %d " % (iter_index - 1)) # noqa: UP031

Check warning on line 341 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L341

Added line #L341 was not covered by tests
copy_model(numb_models, iter_index - 1, iter_index, suffix)
return
else:
Expand Down Expand Up @@ -522,7 +522,7 @@
1.0 - training_reuse_old_ratio,
)
)
elif Version("2") <= Version(mdata["deepmd_version"]) < Version("4"):

Check warning on line 525 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L525

Added line #L525 was not covered by tests
jinput["training"]["training_data"]["auto_prob"] = (
"prob_sys_size; 0:%d:%f; %d:%d:%f" # noqa: UP031
% (
Expand Down Expand Up @@ -953,7 +953,7 @@
if jdata.get("dp_compress", False):
model_name = f"frozen_model_compressed{suffix}"

ofile = os.path.join(work_path, "graph.%03d%s" % (ii, suffix)) # noqa: UP031

Check warning on line 956 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L956

Added line #L956 was not covered by tests
task_file = os.path.join(train_task_fmt % ii, model_name)
if os.path.isfile(ofile):
os.remove(ofile)
Expand Down Expand Up @@ -1239,7 +1239,7 @@
"%s.%03d" % (_calypso_run_opt_path, temp_idx) # noqa: UP031
)
elif not jdata.get("vsc", False):
calypso_run_opt_path.append("%s.%03d" % (_calypso_run_opt_path, 0)) # noqa: UP031

Check warning on line 1242 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L1242

Added line #L1242 was not covered by tests

# mode 2: control each iteration to generate structures in specific way
# by providing model_devi_jobs key
Expand Down Expand Up @@ -1305,7 +1305,7 @@
type_map=jdata["type_map"],
)
if shuffle_poscar:
system.data["coords"] = rng.permuted(system.data["coords"], axis=1)
rng.shuffle(system.data["coords"], axis=1)

Check warning on line 1308 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L1308

Added line #L1308 was not covered by tests
if jdata.get("model_devi_nopbc", False):
system.remove_pbc()
system.to_lammps_lmp(os.path.join(conf_path, lmp_name))
Expand Down Expand Up @@ -2074,7 +2074,7 @@
grp_name = gromacs_settings.get("group_name", "Other")
trj_freq = cur_job.get("trj_freq", 10)

command = "%s grompp -f %s -p %s -c %s -o %s -maxwarn %d" % ( # noqa: UP031

Check warning on line 2077 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L2077

Added line #L2077 was not covered by tests
model_devi_exec,
mdp_filename,
topol_filename,
Expand Down Expand Up @@ -3323,7 +3323,7 @@
if orb_files_stru:
assert "fp_orb_files" in jdata, "need to define fp_orb_files in jdata"
if descriptor_file_stru:
assert "fp_dpks_descriptor" in jdata, (

Check warning on line 3326 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L3326

Added line #L3326 was not covered by tests
"need to define fp_dpks_descriptor in jdata"
)

Expand All @@ -3341,13 +3341,13 @@
os.symlink(src_file, pp_files_stru[idx])
if orb_files_stru:
src_file = os.path.join(fp_pp_path, jdata["fp_orb_files"][type_map_idx])
assert os.path.isfile(src_file), (

Check warning on line 3344 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L3344

Added line #L3344 was not covered by tests
f"Can not find the orbital file {src_file}"
)
os.symlink(src_file, orb_files_stru[idx])
if descriptor_file_stru:
src_file = os.path.join(fp_pp_path, jdata["fp_dpks_descriptor"])
assert os.path.isfile(src_file), (

Check warning on line 3350 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L3350

Added line #L3350 was not covered by tests
f"Can not find the descriptor file {src_file}"
)
os.symlink(src_file, descriptor_file_stru)
Expand Down Expand Up @@ -4295,7 +4295,7 @@

if tcount == 0:
rfail = 0.0
dlog.info("failed frame: %6d in %6d " % (icount, tcount)) # noqa: UP031

Check warning on line 4298 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L4298

Added line #L4298 was not covered by tests
else:
rfail = float(icount) / float(tcount)
dlog.info(
Expand Down Expand Up @@ -4534,7 +4534,7 @@

if tcount == 0:
rfail = 0.0
dlog.info("failed frame: %6d in %6d " % (tcount - icount, tcount)) # noqa: UP031

Check warning on line 4537 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L4537

Added line #L4537 was not covered by tests
else:
rfail = float(tcount - icount) / float(tcount)
dlog.info(
Expand Down Expand Up @@ -4782,7 +4782,7 @@
iter_rec = [int(x) for x in line.split()]
if len(iter_rec) == 0:
raise ValueError("There should not be blank lines in record.dpgen.")
dlog.info("continue from iter %03d task %02d" % (iter_rec[0], iter_rec[1])) # noqa: UP031

Check warning on line 4785 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L4785

Added line #L4785 was not covered by tests

cont = True
ii = -1
Expand All @@ -4795,7 +4795,7 @@
for jj in range(numb_task):
if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1]:
continue
task_name = "task %02d" % jj # noqa: UP031

Check warning on line 4798 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L4798

Added line #L4798 was not covered by tests
sepline(f"{iter_name} {task_name}", "-")
if jj == 0:
log_iter("make_train", ii, jj)
Expand Down Expand Up @@ -4828,7 +4828,7 @@
log_iter("post_fp", ii, jj)
post_fp(ii, jdata)
else:
raise RuntimeError("unknown task %d, something wrong" % jj) # noqa: UP031

Check warning on line 4831 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L4831

Added line #L4831 was not covered by tests
record_iter(record, ii, jj)


Expand Down
Loading