Skip to content
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
24 changes: 14 additions & 10 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,11 @@ def get_energy(outlines):
Etot = float(line.split()[1]) # in eV
break
if not Etot:
not_converge = False
for line in outlines:
if "convergence has NOT been achieved!" in line:
not_converge = True
raise RuntimeError("convergence has NOT been achieved in scf!")
break
if not not_converge:
raise RuntimeError("Final total energy cannot be found in output. Unknown problem.")
return Etot
raise RuntimeError("Final total energy cannot be found in output. Unknown problem.")
for line in outlines:
if "convergence has NOT been achieved!" in line:
return Etot,False
return Etot,True

def get_force (outlines, natoms):
force = []
Expand Down Expand Up @@ -156,7 +152,15 @@ def get_frame (fname):
celldm, cell = get_cell(geometry_inlines)
atom_names, natoms, types, coords = get_coords(celldm, cell, geometry_inlines, inlines)

energy = get_energy(outlines)
energy,converge = get_energy(outlines)
if not converge:
return {'atom_names':atom_names,\
'atom_numbs':natoms,\
'atom_types':types,\
'cells':[],\
'coords':[],\
'energies':[],\
'forces':[]}
force = get_force (outlines, natoms)
stress = get_stress(outlines)
if stress is not None:
Expand Down
18 changes: 18 additions & 0 deletions tests/abacus.scf/INPUT.fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
INPUT_PARAMETERS
#Parameters (General)
suffix ch4fail
stru_file STRU.ch4 #the filename of file containing atom positions
kpoint_file KPT.ch4 #the name of file containing k points
pseudo_dir ./
ntype 2
nbands 8
#Parameters (Accuracy)
ecutwfc 100
symmetry 1
scf_nmax 50
smearing_method gauss #type of smearing: gauss; fd; fixed; mp; mp2; mv
smearing_sigma 0.01
mixing_type plain
mixing_beta 0.5
cal_force 1
cal_stress 1
File renamed without changes.
Loading