Skip to content

[Code scan] Fix relabel first-principles input argument mismatches #1910

Description

@njzjz

This issue is from a Codex global scan of the repository.

dpgen.tools.relabel has multiple argument mismatches in first-principles input generation paths.

Evidence:

def make_vasp_incar(tdir, fp_incar):
cwd = os.getcwd()
os.chdir(tdir)
shutil.copyfile(fp_incar, "INCAR")
os.chdir(cwd)

os.makedirs(output, exist_ok=True)
if fp_style == "vasp":
copy_pp_files(output, fp_pp_path, fp_pp_files)
make_vasp_incar(fp_params, output)

elif fp_style == "pwscf":
try:
fp_params = fp_jdata["user_fp_params"]
user_input = True
except Exception:
fp_params = fp_jdata["fp_params"]
user_input = False
make_pwscf(
".", fp_params, mass_map, fp_pp_files, fp_pp_files, user_input
)
elif fp_style == "siesta":
make_siesta(".", fp_params, mass_map, fp_pp_files, fp_pp_files)

make_vasp_incar(tdir, fp_incar) expects a task/output directory first and an INCAR path second, but create_tasks() calls make_vasp_incar(fp_params, output), reversing the concepts. The Siesta branch also calls make_siesta(".", fp_params, mass_map, fp_pp_files, fp_pp_files) even though make_siesta() accepts four arguments and fp_params is not assigned in that branch.

Expected behavior: relabel should pass the correct directory/file arguments for VASP and initialize/pass the correct parameters for Siesta, with tests covering each fp_style branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions