deepmodeling / deepmodeling/tbplas

[Code scan] Replace np.ndarray constructors used for coordinate data conversion

Open Beginner friendly
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
19
Forks
6
PR merge metrics
No merged PRs in 30d

Description

This issue comes from a Codex global scan of deepmodeling/tbplas at commit 4d3652b3dba8eb930e4869a6d41074f62d703692.

Severity: Medium

Two input-conversion branches use `np.ndarray(...)` where they should use `np.array(...)`. `np.ndarray` treats the argument as a shape, not data: list inputs raise `TypeError`, while tuple inputs can allocate uninitialized coordinates. That breaks normal list/tuple inputs and can silently produce invalid results.

Code references:
https://github.com/deepmodeling/tbplas/blob/4d3652b3dba8eb930e4869a6d41074f62d703692/tbplas/base/lattice.py#L116-L120
https://github.com/deepmodeling/tbplas/blob/4d3652b3dba8eb930e4869a6d41074f62d703692/tbplas/diagonal/lindhard.py#L541-L542

Suggested fix: replace both constructors with `np.array(..., dtype=...)`, matching the surrounding conversion helpers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at tbplas/base/lattice.py lines 116-120 and tbplas/diagonal/lindhard.py lines 541-542, then compare the surrounding conversion helpers. Verify list and tuple coordinate inputs in both branches convert as data with the intended dtype, without raising errors or producing uninitialized values.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.