Skip to content

Commit 0f44046

Browse files
authored
Fix: widen the range of support on STRU file of Molden interface (#5388)
* Fix: widen the range of support on STRU file of Molden interface * minor fix
1 parent 137235d commit 0f44046

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/molden/molden.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,8 @@ def moldengen(folder: str, ndigits=3, ngto=7, rel_r=2, fmolden="ABACUS.molden"):
905905
import numpy as np
906906

907907
files = os.listdir(folder)
908-
assert ("STRU" in files) and ("INPUT" in files) and ("KPT" in files)
908+
assert ("STRU" in files) and ("INPUT" in files) and ("KPT" in files),\
909+
"STRU, INPUT, KPT files are required in the folder."
909910
cwd = os.path.abspath(os.getcwd())
910911
os.chdir(folder)
911912
####################
@@ -938,7 +939,8 @@ def moldengen(folder: str, ndigits=3, ngto=7, rel_r=2, fmolden="ABACUS.molden"):
938939
elif stru['coord_type'] == "Direct": # in fractional coordinates
939940
vec = np.array(stru['lat']['vec']) * stru['lat']['const']
940941
coords = np.dot(coords, vec)
941-
elif stru['coord_type'] == "Cartesian_Angstrom":
942+
elif stru['coord_type'].startswith("Cartesian_angstrom"):
943+
# including *_center_xy, *_center_z, *_center_xyz, ... cases
942944
coords *= 0.529177249
943945
else:
944946
raise NotImplementedError(f"Unknown coordinate type {stru['coord_type']}")

0 commit comments

Comments
 (0)