-
Notifications
You must be signed in to change notification settings - Fork 1
/
vasp_slurm.py
68 lines (58 loc) · 1.38 KB
/
vasp_slurm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import json
from typing import List
from dflow import (
Workflow,
Step,
argo_range,
SlurmRemoteExecutor,
upload_artifact,
download_artifact,
InputArtifact,
OutputArtifact,
ShellOPTemplate
)
from dflow.python import (
PythonOPTemplate,
OP,
OPIO,
OPIOSign,
Artifact,
Slices
)
import subprocess, os, shutil, glob
from pathlib import Path
from typing import List
class VASPCal(OP):
def __init__(self):
pass
@classmethod
def get_input_sign(cls):
return OPIOSign({
"input": Artifact(Path)
})
@classmethod
def get_output_sign(cls):
return OPIOSign({
"OUTCAR": Artifact(Path)
})
@OP.exec_sign_check
def execute(self, op_in: OPIO) -> OPIO:
os.chdir(op_in["input"])
# call vasp_std
os.system("your VASP execute environment, such as intel env.")
return OPIO({
"OUTCAR": op_in["input"]/"OUTCAR"
})
def main():
slurm_remote_executor = <your slurm set up>
VASP_Calculation = Step(
"VASP-Calculation",
PythonOPTemplate(VASPCal, image="your image"),
artifacts={"input": upload_artifact(["./VASP_test"])},
executor=slurm_remote_executor,
)
wf = Workflow("vasp-task")
wf.add(VASP_Calculation)
wf.submit()
if __name__ == '__main__':
main()