This issue is from a Codex global scan of the repository.
init_surf loses the directory component of from_poscar_path.
Evidence:
|
from_poscar = jdata.get("from_poscar", False) |
|
|
|
if from_poscar: |
|
from_poscar_path = jdata["from_poscar_path"] |
|
poscar_name = os.path.basename(from_poscar_path) |
|
ss = Structure.from_file(poscar_name) |
When from_poscar is true, the code reads from_poscar_path, takes only os.path.basename(from_poscar_path), and then calls Structure.from_file(poscar_name). A valid POSCAR path outside the current working directory fails because the directory part has been discarded.
Expected behavior: pass from_poscar_path itself to Structure.from_file() or resolve it to an absolute path before changing directories.
This issue is from a Codex global scan of the repository.
init_surfloses the directory component offrom_poscar_path.Evidence:
dpgen/dpgen/data/surf.py
Lines 228 to 233 in 7af5246
When
from_poscaris true, the code readsfrom_poscar_path, takes onlyos.path.basename(from_poscar_path), and then callsStructure.from_file(poscar_name). A valid POSCAR path outside the current working directory fails because the directory part has been discarded.Expected behavior: pass
from_poscar_pathitself toStructure.from_file()or resolve it to an absolute path before changing directories.