Skip to content

fix(abacus): get ION step by searching "ION=" in relax job #1169

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

Merged
merged 2 commits into from
Mar 25, 2023
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
13 changes: 10 additions & 3 deletions dpgen/auto_test/lib/abacus.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,17 @@ def final_stru(abacus_path):
with open(logf) as f1:
lines = f1.readlines()
for i in range(1, len(lines)):
if lines[-i][36:41] == "istep":
max_step = int(lines[-i].split()[-1])
max_step = ""
if "ALGORITHM --------------- ION=" in lines[-i]:
index_ben = lines[-i].index("ION=") + 4
index_end = lines[-i].index("ELEC")
max_step = int(lines[-i][index_ben:index_end])
if max_step < 2:
max_step = ""
else:
max_step -= 2
break
return "OUT.%s/STRU_ION%d_D" % (suffix, max_step)
return "OUT.%s/STRU_ION%s_D" % (suffix, str(max_step))
elif calculation == "md":
with open(logf) as f1:
lines = f1.readlines()
Expand Down
21 changes: 21 additions & 0 deletions tests/auto_test/equi/abacus/INPUT.outstru
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
INPUT_PARAMETERS
#Parameters (5.Mixing)
suffix ABACUS
calculation cell-relax
symmetry 1
pseudo_type upf201
ecutwfc 60
scf_thr 1e-7
scf_nmax 100
basis_type pw
smearing_method gauss
smearing_sigma 0.002
mixing_type pulay
mixing_beta 0.3
ks_solver cg
cal_stress 1
kspacing 0.2
relax_nmax 100
force_thr_ev 0.01
stress_thr 0.1
out_stru 1
21 changes: 21 additions & 0 deletions tests/auto_test/equi/abacus/STRU_ION47_D
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ATOMIC_SPECIES
Al 26.9815 ./pp_orb/Al_ONCV_PBE-1.0.upf

LATTICE_CONSTANT
1.88972612546

LATTICE_VECTORS
4.01993427025 7.2584598854e-31 7.13301566977e-30 #latvec1
7.2584598854e-31 4.01993427025 1.22599728095e-29 #latvec2
7.13301566977e-30 1.22599728095e-29 4.01993427025 #latvec3

ATOMIC_POSITIONS
Direct

Al #label
0 #magnetism
4 #number of atoms
0 0 0 m 1 1 1
0 0.5 0.5 m 1 1 1
0.5 0 0.5 m 1 1 1
0.5 0.5 0 m 1 1 1
29 changes: 29 additions & 0 deletions tests/auto_test/test_abacus_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,35 @@ def test_make_property(self):
),
)

def test_make_property_outstru(self):
os.remove(os.path.join(self.equi_path, "INPUT"))
shutil.copy(
os.path.join(self.source_path, "INPUT.outstru"),
os.path.join(self.equi_path, "INPUT"),
)
shutil.copy(
os.path.join(self.source_path, "STRU_ION47_D"),
os.path.join(self.equi_path, "OUT.ABACUS/STRU_ION47_D"),
)
property = {"type": "eos", "vol_start": 0.85, "vol_end": 1.15, "vol_step": 0.01}
make_property(self.jdata["structures"], self.jdata["interaction"], [property])
self.assertTrue(os.path.exists(os.path.join(self.conf_path, "eos_00")))
self.assertTrue(os.path.exists(os.path.join(self.conf_path, "eos_00", "INPUT")))
for ii in glob.glob(os.path.join(self.conf_path, "eos_00", "task.*")):
self.assertTrue(os.path.exists(os.path.join(ii, "INPUT")))
self.assertTrue(os.path.exists(os.path.join(ii, "pp_orb")))
self.assertTrue(os.path.exists(os.path.join(ii, "KPT")))
self.assertTrue(os.path.exists(os.path.join(ii, "STRU")))
self.assertEqual(
os.path.realpath(os.path.join(ii, "pp_orb", "Al_ONCV_PBE-1.0.upf")),
os.path.realpath(
os.path.join(
self.jdata["interaction"]["potcar_prefix"],
"Al_ONCV_PBE-1.0.upf",
)
),
)

def test_make_property_eos(self):
property = {"type": "eos", "vol_start": 0.85, "vol_end": 1.15, "vol_step": 0.01}
work_path = os.path.join(self.conf_path, "eos_00")
Expand Down