Update pwmat.py

fix  a bug
This commit is contained in:
Liang Jianxin 2024-05-11 17:42:58 +08:00 committed by GitHub
parent 7f9c12593f
commit 50906515ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -165,12 +165,12 @@ def get_pwmat_structure(cell):
)
if mag_mom is not None and len(mag_mom) == len(cell.numbers):
if len(mag_mom[0]) == 1:
if np.size(mag_mom[0]) == 1:
line.append("magnetic")
for number, mag in zip(numbers, mag_mom):
line.append(f" {number} {mag:.16f}")
if len(mag_mom[0]) == 3:
if np.size(mag_mom[0]) == 3:
line.append("magnetic_xyz")
for number, mag in zip(numbers, mag_mom):
line.append(f" {number} {mag[0]:.6f} {mag[1]:.6f} {mag[2]:.6f}")