Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
or (task_type == 'surface' and not static):
fc = lammps.make_lammps_equi('conf.lmp', ntypes, lammps.inter_meam, model_param,
etol, ftol, maxiter, maxeval, change_box)
if task_type == 'static' \
or (task_type == 'surface' and static):
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_meam, model_param)
if task_type == 'elastic':
fc = lammps.make_lammps_elastic('conf.lmp', ntypes, lammps.inter_meam, model_param,
etol, ftol, maxiter, maxeval)
if task_type == 'vacancy' \
or (task_type == 'eos' and change_box) \
or (task_type == 'interstitial'):
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale2equi, lammps.inter_meam,
model_param, B0, bp, etol, ftol, maxiter, maxeval)
if reprod_opt:
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_meam, model_param)
with open(os.path.join(output_dir, 'in.lammps'), 'w') as fp:
fp.write(fc)
os.symlink(os.path.relpath(equi_contcar), 'POSCAR')
#lammps.poscar_from_last_dump(equi_dump, task_poscar, type_map)
os.chdir(cwd)
# gen structure from equi poscar
print("task poscar: ", task_poscar)
ss = Structure.from_file(task_poscar)
# gen defects
vds = InterstitialGenerator(ss, insert_ele)
dss = []
for jj in vds :
dss.append(jj.generate_defect_structure(supercell))
# gen tasks
cwd = os.getcwd()
# make lammps.in, relax at 0 bar (scale = 1)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_deepmd,
model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_meam,
model_param)
f_lammps_in = os.path.join(task_path, 'lammps.in')
with open(f_lammps_in, 'w') as fp :
fp.write(fc)
# gen tasks
copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
cwd = os.getcwd()
# gen defects
vds = VacancyGenerator(ss)
dss = []
for jj in vds :
dss.append(jj.generate_defect_structure(supercell))
# gen tasks
cwd = os.getcwd()
# make lammps.in, relax at 0 bar (scale = 1)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_deepmd,
model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_meam,
model_param)
f_lammps_in = os.path.join(task_path, 'lammps.in')
with open(f_lammps_in, 'w') as fp :
fp.write(fc)
# gen tasks
copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
cwd = os.getcwd()
os.chdir(task_path)
for ii in model_name :
if os.path.exists(ii) :
os.remove(ii)
for (ii,jj) in zip(models, model_name) :
# gen defects
vds = InterstitialGenerator(ss, insert_ele)
dss = []
for jj in vds :
dss.append(jj.generate_defect_structure(supercell))
# gen tasks
cwd = os.getcwd()
# make lammps.in, relax at 0 bar (scale = 1)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_deepmd,
model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_meam,
model_param)
f_lammps_in = os.path.join(task_path, 'lammps.in')
with open(f_lammps_in, 'w') as fp :
fp.write(fc)
# gen tasks
copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
cwd = os.getcwd()
os.chdir(task_path)
for ii in model_name :
if os.path.exists(ii) :
os.remove(ii)
for (ii,jj) in zip(models, model_name) :
# # link conf
# os.symlink(os.path.relpath(conf_file), 'conf.lmp')
# make conf
scale_ss = ss.copy()
scale_ss.scale_lattice(vol * natoms)
scale_ss.to('POSCAR', 'POSCAR')
lammps.cvt_lammps_conf('POSCAR', 'conf.lmp')
ptypes = vasp.get_poscar_types('POSCAR')
lammps.apply_type_map('conf.lmp', type_map, ptypes)
# link models
for (ii,jj) in zip(share_models, model_name) :
os.symlink(os.path.relpath(ii), jj)
# make lammps input
scale = (vol / vpa) ** (1./3.)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale,lammps.inter_deepmd, model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale,lammps.inter_meam, model_param)
with open(os.path.join(vol_path, 'lammps.in'), 'w') as fp :
fp.write(fc)
os.chdir(cwd)
if os.path.isfile('POSCAR') :
os.remove('POSCAR')
os.symlink(os.path.relpath(equi_contcar), 'POSCAR')
os.chdir(cwd)
# gen structure from equi poscar
ss = Structure.from_file(task_poscar)
# gen defects
vds = VacancyGenerator(ss)
dss = []
for jj in vds :
dss.append(jj.generate_defect_structure(supercell))
# gen tasks
cwd = os.getcwd()
# make lammps.in, relax at 0 bar (scale = 1)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_deepmd,
model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp',
ntypes,
1,
lammps.inter_meam,
model_param)
f_lammps_in = os.path.join(task_path, 'lammps.in')
with open(f_lammps_in, 'w') as fp :
fp.write(fc)
# gen tasks
copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
cwd = os.getcwd()
or (task_type == 'surface' and not static):
fc = lammps.make_lammps_equi('conf.lmp', ntypes, lammps.inter_deepmd, model_param,
etol, ftol, maxiter, maxeval, change_box)
if task_type == 'static' \
or (task_type == 'surface' and static):
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_deepmd, model_param)
if task_type == 'elastic':
fc = lammps.make_lammps_elastic('conf.lmp', ntypes, lammps.inter_deepmd, model_param,
etol, ftol, maxiter, maxeval)
if task_type == 'vacancy' \
or (task_type == 'eos' and change_box) \
or (task_type == 'interstitial'):
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale2equi, lammps.inter_deepmd,
model_param, B0, bp, etol, ftol, maxiter, maxeval)
if reprod_opt:
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_deepmd, model_param)
with open(os.path.join(output_dir, 'in.lammps'), 'w') as fp:
fp.write(fc)
# make conf
scale_ss = ss.copy()
scale_ss.scale_lattice(vol * natoms)
scale_ss.to('POSCAR', 'POSCAR')
lammps.cvt_lammps_conf('POSCAR', 'conf.lmp')
ptypes = vasp.get_poscar_types('POSCAR')
lammps.apply_type_map('conf.lmp', type_map, ptypes)
# link models
for (ii,jj) in zip(share_models, model_name) :
os.symlink(os.path.relpath(ii), jj)
# make lammps input
scale = (vol / vpa) ** (1./3.)
if task_type=='deepmd':
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale,lammps.inter_deepmd, model_name)
elif task_type =='meam':
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale,lammps.inter_meam, model_param)
with open(os.path.join(vol_path, 'lammps.in'), 'w') as fp :
fp.write(fc)
os.chdir(cwd)
or (task_type == 'surface' and not static):
fc = lammps.make_lammps_equi('conf.lmp', ntypes, lammps.inter_eam_alloy, model_param,
etol, ftol, maxiter, maxeval, change_box)
if task_type == 'static' \
or (task_type == 'surface' and static):
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_eam_alloy, model_param)
if task_type == 'elastic':
fc = lammps.make_lammps_elastic('conf.lmp', ntypes, lammps.inter_eam_alloy, model_param,
etol, ftol, maxiter, maxeval)
if task_type == 'vacancy' \
or (task_type == 'eos' and change_box) \
or (task_type == 'interstitial' and not reprod_opt):
fc = lammps.make_lammps_press_relax('conf.lmp', ntypes, scale2equi, lammps.inter_eam_alloy,
model_param, B0, bp, etol, ftol, maxiter, maxeval)
if reprod_opt:
fc = lammps.make_lammps_eval('conf.lmp', ntypes, lammps.inter_eam_alloy, model_param)
with open(os.path.join(output_dir, 'in.lammps'), 'w') as fp:
fp.write(fc)