Skip to content

[Code scan] Preserve every frame when collecting VASP database entries #1908

Description

@njzjz

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

VASP database collection silently drops all but one frame from multi-frame OUTCAR files.

Evidence:

dpgen/dpgen/database/run.py

Lines 130 to 142 in 7af5246

comp = vi["POSCAR"].structure.composition
ls = LabeledSystem(f_outcar)
lss = ls.to_list()
for ls in lss:
if id_prefix:
eid = id_prefix + "_" + str(icount)
else:
eid = str(uuid4())
entry = Entry(
comp, "vasp", vi.as_dict(), ls.as_dict(), attribute=attrib, entry_id=eid
)
entries.append(entry)
icount += 1

_parsing_vasp() converts the LabeledSystem into lss = ls.to_list() and loops over for ls in lss, but the Entry(...) creation and entries.append(entry) are outside the loop. Only the last ls from the loop is used, so earlier frames are lost without any warning.

Expected behavior: create and append an Entry for every frame in lss, and increment the entry counter per frame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions