Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abacus: fix bug in reading nspin2 results #758

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,20 @@ def get_mag_force(outlines):
j = i + 2
mag = []
while "-------------------------" not in outlines[j]:
mag.append([float(ii) for ii in outlines[j].split()[1:]])
imag = [float(ii) for ii in outlines[j].split()[1:]]
if len(imag) == 1:
imag = [0, 0, imag[0]]
mag.append(imag)
j += 1
mags.append(mag)
if "Magnetic force (eV/uB)" in line:
j = i + 2
magforce = []
while "-------------------------" not in outlines[j]:
magforce.append([float(ii) for ii in outlines[j].split()[1:]])
imagforce = [float(ii) for ii in outlines[j].split()[1:]]
if len(imagforce) == 1:
imagforce = [0, 0, imagforce[0]]
magforce.append(imagforce)
j += 1
magforces.append(magforce)
return np.array(mags), np.array(magforces)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INPUT_PARAMETERS
suffix ABACUS
suffix ABACUS-nspin2
calculation scf
ecutwfc 100
scf_thr 1e-07
Expand All @@ -14,7 +14,7 @@ basis_type lcao
symmetry 0
noncolin 1
lspinorb 0
nspin 4
nspin 2
out_mul true
sc_mag_switch 1
decay_grad_switch 1
Expand Down
Loading