Skip to content

[Code scan] POSCAR utilities drop standard unlabeled coordinate lines #142

Description

@njzjz

Source: Codex global repository scan of deepmodeling/dpti at commit b719828.
Project: DeepModeling Agent Code Scan

Problem
regulate_poscar() and sort_poscar() infer each coordinate line's element from the last token of the coordinate line. Normal POSCAR coordinate lines usually do not include element labels, because species and counts are already in the header. For those standard files, the utilities can drop all positions while still writing a header.

Code references

posis = lines[8:8+natoms]

ele_name = ii.split()[-1]

posis = lines[8:8+natoms]

ele_name = ii.split()[-1]

Reproduction
Use a POSCAR with species O H O, counts 1 2 1, and four unlabeled Direct coordinate lines. The output should retain four positions, but the current filtering expects the last coordinate token to be an element name.

Expected result
The utilities should derive element ownership from the header counts, or clearly require and validate labeled coordinate lines.

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