Skip to content

Commit 332d926

Browse files
authored
Merge pull request #721 from JaGeo/main
Add additional optimization to Lobster
2 parents 813ab08 + d72c627 commit 332d926

File tree

368 files changed

+155309
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+155309
-74
lines changed

atomate/vasp/firetasks/lobster_tasks.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
import shutil
99
import warnings
1010

11-
from fireworks import FiretaskBase, explicit_serialize, FWAction
12-
from fireworks.utilities.fw_serializers import DATETIME_HANDLER
13-
from monty.json import jsanitize
14-
from monty.os.path import zpath
15-
from monty.serialization import loadfn
16-
1711
from atomate.common.firetasks.glue_tasks import get_calc_loc
1812
from atomate.utils.utils import env_chk, get_meta_from_structure
1913
from atomate.vasp.config import VASP_OUTPUT_FILES
@@ -25,6 +19,11 @@
2519
LobsterFilesValidator,
2620
)
2721
from custodian.lobster.jobs import LobsterJob
22+
from fireworks import FiretaskBase, explicit_serialize, FWAction
23+
from fireworks.utilities.fw_serializers import DATETIME_HANDLER
24+
from monty.json import jsanitize
25+
from monty.os.path import zpath
26+
from monty.serialization import loadfn
2827
from pymatgen.core.structure import Structure
2928
from pymatgen.io.lobster import Lobsterout, Lobsterin
3029

@@ -163,7 +162,12 @@ def run_task(self, fw_spec):
163162
c.run()
164163

165164
if os.path.exists(zpath("custodian.json")):
166-
stored_custodian_data = {"custodian": loadfn(zpath("custodian.json"))}
165+
if os.path.exists(zpath("FW_offline.json")):
166+
import json
167+
with open(zpath("custodian.json")) as f:
168+
stored_custodian_data = {"custodian": json.load(f)}
169+
else:
170+
stored_custodian_data = {"custodian": loadfn(zpath("custodian.json"))}
167171
return FWAction(stored_data=stored_custodian_data)
168172

169173

@@ -200,11 +204,14 @@ class LobsterRunToDb(FiretaskBase):
200204
std_additional_outputs = [
201205
"ICOHPLIST.lobster",
202206
"ICOOPLIST.lobster",
207+
"ICOBILIST.lobster",
203208
"COHPCAR.lobster",
204209
"COOPCAR.lobster",
205210
"GROSSPOP.lobster",
206211
"CHARGE.lobster",
207212
"DOSCAR.lobster",
213+
"MadelungEnergies.lobster",
214+
"SitePotentials.lobster"
208215
]
209216

210217
def __init__(self, *args, **kwargs):
@@ -281,7 +288,7 @@ def run_task(self, fw_spec):
281288
db_file = env_chk(self.get("db_file"), fw_spec)
282289

283290
# db insertion or taskdoc dump
284-
if not db_file:
291+
if not db_file or os.path.exists(zpath("FW_offline.json")):
285292
with open("task_lobster.json", "w") as f:
286293
f.write(json.dumps(task_doc, default=DATETIME_HANDLER))
287294
else:
@@ -339,7 +346,7 @@ def _verify_inputs(self):
339346
# Check lobsterin
340347
if self.get("check_lobsterin", True):
341348
ref_lobsterin = Lobsterin.from_file(
342-
os.path.join(self["ref_dir"], "inputs", "lobsterin")
349+
os.path.join(self["ref_dir"], "inputs", "lobsterin.gz")
343350
)
344351
params_to_check = self.get("params_to_check", [])
345352
for p in params_to_check:

atomate/vasp/firetasks/parse_outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88

99
from monty.json import MontyEncoder, jsanitize
10+
from monty.os.path import zpath
1011
from pydash.objects import has, get
1112

1213
from atomate.vasp.config import DEFUSE_UNSUCCESSFUL
@@ -135,7 +136,7 @@ def run_task(self, fw_spec):
135136
db_file = env_chk(self.get("db_file"), fw_spec)
136137

137138
# db insertion or taskdoc dump
138-
if not db_file:
139+
if not db_file or os.path.exists(zpath("FW_offline.json")):
139140
with open("task.json", "w") as f:
140141
f.write(json.dumps(task_doc, default=DATETIME_HANDLER))
141142
else:

atomate/vasp/firetasks/run_calc.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
from atomate.vasp.config import HALF_KPOINTS_FIRST_RELAX
12
from monty.os.path import zpath
23
from monty.serialization import loadfn
34

4-
from atomate.vasp.config import HALF_KPOINTS_FIRST_RELAX
5-
65
"""
76
This module defines tasks that support running vasp in various ways.
87
"""
@@ -299,7 +298,12 @@ def run_task(self, fw_spec):
299298
c.run()
300299

301300
if os.path.exists(zpath("custodian.json")):
302-
stored_custodian_data = {"custodian": loadfn(zpath("custodian.json"))}
301+
if os.path.exists(zpath("FW_offline.json")):
302+
import json
303+
with open(zpath("custodian.json")) as f:
304+
stored_custodian_data = {"custodian": json.load(f)}
305+
else:
306+
stored_custodian_data = {"custodian": loadfn(zpath("custodian.json"))}
303307
return FWAction(stored_data=stored_custodian_data)
304308

305309

@@ -396,7 +400,7 @@ def _verify_inputs(self):
396400
defaults = {"ISPIN": 1, "ISMEAR": 1, "SIGMA": 0.2}
397401
for p in params_to_check:
398402
if user_incar.get(p, defaults.get(p)) != ref_incar.get(
399-
p, defaults.get(p)
403+
p, defaults.get(p)
400404
):
401405
raise ValueError(f"INCAR value of {p} is inconsistent!")
402406

@@ -407,8 +411,8 @@ def _verify_inputs(self):
407411
os.path.join(self["ref_dir"], "inputs", "KPOINTS")
408412
)
409413
if (
410-
user_kpoints.style != ref_kpoints.style
411-
or user_kpoints.num_kpts != ref_kpoints.num_kpts
414+
user_kpoints.style != ref_kpoints.style
415+
or user_kpoints.num_kpts != ref_kpoints.num_kpts
412416
):
413417
raise ValueError(
414418
"KPOINT files are inconsistent! Paths are:\n{}\n{} with kpoints {} and {}".format(
@@ -426,8 +430,8 @@ def _verify_inputs(self):
426430
os.path.join(self["ref_dir"], "inputs", "POSCAR")
427431
)
428432
if (
429-
user_poscar.natoms != ref_poscar.natoms
430-
or user_poscar.site_symbols != ref_poscar.site_symbols
433+
user_poscar.natoms != ref_poscar.natoms
434+
or user_poscar.site_symbols != ref_poscar.site_symbols
431435
):
432436
raise ValueError(
433437
"POSCAR files are inconsistent! Paths are:\n{}\n{}".format(
-1 Bytes
Binary file not shown.
-1 Bytes
Binary file not shown.
133 Bytes
Binary file not shown.
15.8 KB
Binary file not shown.
1.36 KB
Binary file not shown.
599 Bytes
Binary file not shown.
162 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)