-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from AnguseZhang/master
Update Readme and provide test case with methane.
- Loading branch information
Showing
26 changed files
with
3,143 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
PREC=A | ||
ENCUT=400.000000 | ||
ISYM=0 | ||
ALGO=fast | ||
EDIFF=1E-6 | ||
LREAL=F | ||
NPAR=1 | ||
KPAR=1 | ||
|
||
ISTART=0 | ||
ICHARG=2 | ||
ISIF=2 | ||
ISMEAR=1 | ||
SIGMA=0.200000 | ||
IBRION=0 | ||
MAXMIX=50 | ||
NBLOCK=1 | ||
KBLOCK=100 | ||
|
||
SMASS=0 | ||
POTIM=2 | ||
TEBEG=50 | ||
TEEND=50 | ||
|
||
NSW=10 | ||
|
||
LWAVE=F | ||
LCHARG=F | ||
PSTRESS=0 | ||
|
||
KSPACING=2 | ||
KGAMMA=F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PREC=A | ||
ENCUT=400.000000 | ||
# ISYM=0 | ||
ALGO=fast | ||
EDIFF=1.000000e-06 | ||
LREAL=T | ||
NPAR=1 | ||
KPAR=1 | ||
|
||
NELMIN=4 | ||
ISIF=2 | ||
ISMEAR=0 | ||
SIGMA=0.05 | ||
IBRION=2 | ||
|
||
NSW=1000 | ||
|
||
LWAVE=F | ||
LCHARG=F | ||
PSTRESS=0 | ||
|
||
KSPACING=2 | ||
KGAMMA=F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
POSCAR file written by OVITO | ||
1.0000000000000000 | ||
10.0000000000000000 0.0000000000000000 0.0000000000000000 | ||
0.0000000000000000 10.0000000000000000 0.0000000000000000 | ||
0.0000000000000000 0.0000000000000000 10.0000000000000000 | ||
H C | ||
4 1 | ||
Direct | ||
0.5381543385532134 0.4068608007477559 0.3605730142093164 | ||
0.3945396557300829 0.4803205689390709 0.4384688400135213 | ||
0.5520924283424902 0.5654502852627673 0.4427087377775140 | ||
0.5281853047372259 0.4164147551778533 0.5391826568442692 | ||
0.5032505926369848 0.4672551598725561 0.4452323411553799 | ||
|
||
0.00000000E+00 0.00000000E+00 0.00000000E+00 | ||
0.00000000E+00 0.00000000E+00 0.00000000E+00 | ||
0.00000000E+00 0.00000000E+00 0.00000000E+00 | ||
0.00000000E+00 0.00000000E+00 0.00000000E+00 | ||
0.00000000E+00 0.00000000E+00 0.00000000E+00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"cell_type": "diamond", | ||
"super_cell": [1, 1, 1], | ||
"elements": ["H","C"], | ||
"from_poscar": true, | ||
"from_poscar_path": "example/POSCAR", | ||
"potcars": ["example/POTCAR" | ||
], | ||
"relax_incar": "example/INCAR.rlx", | ||
"md_incar" : "example/INCAR.md", | ||
"scale": [1.00], | ||
"skip_relax": false, | ||
"pert_numb": 30, | ||
"md_nstep" : 10, | ||
"pert_box": 0.03, | ||
"pert_atom": 0.01, | ||
"deepgen_templ": "../generator/template/", | ||
"coll_ndata": 5000, | ||
"_comment": "that's all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
from enum import Enum | ||
from subprocess import Popen, PIPE | ||
|
||
class JobStatus (Enum) : | ||
unsubmitted = 1 | ||
waiting = 2 | ||
running = 3 | ||
terminated = 4 | ||
finished = 5 | ||
unknow = 100 | ||
|
||
class BatchJob (object): | ||
""" | ||
Abstract class of a batch job | ||
It submit a job (leave the id in file tag_jobid) | ||
It check the status of the job (return JobStatus) | ||
NOTICE: I assume that when a job finishes, a tag file named tag_finished should be touched by the user. | ||
TYPICAL USAGE: | ||
job = DERIVED_BatchJob (dir, script) | ||
job.submit () | ||
stat = job.check_status () | ||
""" | ||
def __init__ (self, | ||
job_dir = "", # dir of the job | ||
job_script = "", # name of the job script | ||
job_finish_tag = "tag_finished", # name of the tag for finished job | ||
job_id_file = "tag_jobid") : # job id if making an existing job | ||
self.job_dir = job_dir | ||
self.job_script = job_script | ||
self.job_id_file = job_dir + "/" + job_id_file | ||
self.job_finish_tag = job_dir + "/" + job_finish_tag | ||
self.cwd = os.getcwd() | ||
self.submit_cmd = str(self.submit_command()) | ||
def get_job_id (self) : | ||
if True == os.path.exists (self.job_id_file) : | ||
fp = open (self.job_id_file, 'r') | ||
job_id = fp.read () | ||
return str(job_id) | ||
else : | ||
return "" | ||
def submit_command (self) : | ||
""" | ||
submission is | ||
$ [command] [script] | ||
""" | ||
raise RuntimeError ("submit_command not implemented") | ||
def check_status (self): | ||
raise RuntimeError ("check_status not implemented") | ||
def submit (self) : | ||
if self.get_job_id () != "" : | ||
stat = self.check_status() | ||
if stat != JobStatus.terminated : | ||
if stat == JobStatus.unknow : | ||
raise RuntimeError ("unknown job status, terminate!") | ||
print ("# job %s, dir %s already submitted (waiting, running or finished), would not submit again" % | ||
(self.get_job_id(), self.job_dir)) | ||
return self.get_job_id() | ||
else : | ||
print ("# find terminated job " + self.get_job_id() + ", submit again") | ||
if (False == os.path.isdir (self.job_dir) ) : | ||
raise RuntimeError ("cannot find job dir " + self.job_dir) | ||
abs_job_script = self.job_dir + "/" + self.job_script | ||
if False == os.path.exists (abs_job_script) : | ||
raise RuntimeError ("cannot find job script " + abs_job_script) | ||
cwd = os.getcwd() | ||
os.chdir (self.job_dir) | ||
ret = Popen([self.submit_cmd + " " + self.job_script], stdout=PIPE, stderr=PIPE, shell = True) | ||
stdout, stderr = ret.communicate() | ||
if str(stderr, encoding='ascii') != "": | ||
raise RuntimeError (stderr) | ||
job_id = str(stdout, encoding='ascii').replace('\n','').split()[-1] | ||
print ("# job %s submitted, dir %s " % (job_id, self.job_dir)) | ||
fp = open (self.job_id_file, 'w') | ||
fp.write (job_id) | ||
fp.close() | ||
os.chdir (cwd) | ||
return self.get_job_id() |
Oops, something went wrong.