Skip to content

Commit

Permalink
new method for assigning potcar
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Jun 28, 2018
1 parent e1b9172 commit 8a78d09
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 18 additions & 3 deletions data/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def place_element (jdata) :

def make_vasp_relax (jdata) :
out_dir = jdata['out_dir']
potcars = jdata['potcars']
encut = jdata['encut']
kspacing = jdata['kspacing']
kgamma = jdata['kgamma']
Expand All @@ -226,7 +227,11 @@ def make_vasp_relax (jdata) :
os.remove(os.path.join(work_dir, 'POTCAR'))
shutil.copy2(os.path.join(vasp_dir, 'INCAR.rlx' ),
os.path.join(work_dir, 'INCAR'))
shutil.copy2(os.path.join(vasp_dir, 'POTCAR'), work_dir)
out_potcar = os.path.join(work_dir, 'POTCAR')
with open(out_potcar, 'w') as outfile:
for fname in potcars:
with open(fname) as infile:
outfile.write(infile.read())

os.chdir(work_dir)
replace('INCAR', 'ENCUT=.*', 'ENCUT=%f' % encut)
Expand All @@ -250,6 +255,7 @@ def make_vasp_relax (jdata) :
def make_scale(jdata):
out_dir = jdata['out_dir']
scale = jdata['scale']
skip_relax = jdata['skip_relax']

cwd = os.getcwd()
init_path = os.path.join(out_dir, global_dirname_02)
Expand All @@ -265,7 +271,11 @@ def make_scale(jdata):
for jj in scale :
pos_src = os.path.join(os.path.join(init_path, ii), 'CONTCAR')
if not os.path.isfile(pos_src):
raise RuntimeError("not file %s, vasp relaxation should be run before scale poscar")
if skip_relax :
pos_src = os.path.join(os.path.join(init_path, ii), 'POSCAR')
assert(os.path.isfile(pos_src))
else :
raise RuntimeError("not file %s, vasp relaxation should be run before scale poscar")
scale_path = os.path.join(work_path, ii)
scale_path = os.path.join(scale_path, "sys-%.3f" % jj)
create_path(scale_path)
Expand Down Expand Up @@ -317,6 +327,7 @@ def pert_scaled(jdata) :

def make_vasp_md(jdata) :
out_dir = jdata['out_dir']
potcars = jdata['potcars']
scale = jdata['scale']
encut = jdata['encut']
kspacing = jdata['kspacing']
Expand All @@ -340,7 +351,11 @@ def make_vasp_md(jdata) :
create_path(path_md)
shutil.copy2(os.path.join(vasp_dir, 'INCAR.md'),
os.path.join(path_md, 'INCAR'))
shutil.copy2(os.path.join(vasp_dir, 'POTCAR'), path_md)
out_potcar = os.path.join(path_md, 'POTCAR')
with open(out_potcar, 'w') as outfile:
for fname in potcars:
with open(fname) as infile:
outfile.write(infile.read())
os.chdir(path_md)
replace('INCAR', 'ENCUT=.*', 'ENCUT=%f' % encut)
replace('INCAR', 'ISIF=.*', 'ISIF=2')
Expand Down
4 changes: 4 additions & 0 deletions data/param.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"latt": 4.03,
"super_cell": [2, 1, 1],
"elements": ["Al", "Mg"],
"potcars": ["/home/wanghan/Soft/vasp/potcar.54/potpaw_PBE.54/Al/POTCAR",
"/home/wanghan/Soft/vasp/potcar.54/potpaw_PBE.54/Mg/POTCAR"
],
"encut": 600,
"kspacing": 0.06,
"kgamma": false,
"scale": [0.96, 0.98, 1.00, 1.02, 1.04, 1.06],
"skip_relax": false,
"pert_numb": 100,
"pert_box": 0.03,
"pert_atom": 0.01,
Expand Down

0 comments on commit 8a78d09

Please sign in to comment.