Skip to content

Commit

Permalink
Fix: widen the range of support on STRU file of Molden interface (#5388)
Browse files Browse the repository at this point in the history
* Fix: widen the range of support on STRU file of Molden interface

* minor fix
  • Loading branch information
kirk0830 authored Nov 1, 2024
1 parent 137235d commit 0f44046
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/molden/molden.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,8 @@ def moldengen(folder: str, ndigits=3, ngto=7, rel_r=2, fmolden="ABACUS.molden"):
import numpy as np

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

0 comments on commit 0f44046

Please sign in to comment.