How to use the dpgen.auto_test.lib.lammps.make_lammps_eval function in dpgen

To help you get started, we’ve selected a few dpgen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepmodeling / dpgen / dpgen / auto_test / gen_04_interstitial.py View on Github external
lmps_str = task_type + '-reprod-k%.2f' % (kspacing)

    vasp_path = os.path.join(task_path, vasp_str)
    lmps_path = os.path.join(task_path, lmps_str)

    os.makedirs(lmps_path, exist_ok = True)
    copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
    struct_widecard = os.path.join(vasp_path, 'struct-%s-%s-*' % (insert_ele,copy_str))
    vasp_struct = glob.glob(struct_widecard)
    assert len(vasp_struct)>0 ,"Please compute the interstitial defect using vasp first"
    vasp_struct.sort()
    cwd=os.getcwd()

    # make lammps.in
    if task_type =='deepmd':
        fc = lammps.make_lammps_eval('conf.lmp',
                                 ntypes,
                                 lammps.inter_deepmd,
                                 model_name)
    elif task_type =='meam':
        fc = lammps.make_lammps_eval('conf.lmp',
                                 ntypes,
                                 lammps.inter_meam,
                                 model_param)
    f_lammps_in = os.path.join(lmps_path, 'lammps.in')
    with open(f_lammps_in, 'w') as fp :
        fp.write(fc)

    for vs in vasp_struct :
        # get vasp energy
        outcar = os.path.join(vs, 'OUTCAR')
        energies = vasp.get_energies(outcar)
github deepmodeling / dpgen / dpgen / auto_test / EAM_ALLOY_LMP.py View on Github external
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)
github deepmodeling / dpgen / dpgen / auto_test / MEAM_LMP.py View on Github external
model_name = list(map(os.path.basename,self.model))

        model_param = {'model_name': model_name,
                       'param_type': self.type_map}

        fc = ''
        if task_type == 'relaxation' \
                or (task_type == 'eos' and not change_box) \
                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)
github deepmodeling / dpgen / dpgen / auto_test / DEEPMD_LMP.py View on Github external
deepmd_version = self.inter.get("deepmd_version", "0.12")

        model_param = {'model_name': [model_name],
                       'param_type': self.type_map,
                       'deepmd_version': deepmd_version}

        fc = ''
        if task_type == 'relaxation' \
                or (task_type == 'eos' and not change_box) \
                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)
github deepmodeling / dpgen / dpgen / auto_test / gen_04_interstitial.py View on Github external
os.makedirs(lmps_path, exist_ok = True)
    copy_str = "%sx%sx%s" % (supercell[0], supercell[1], supercell[2])
    struct_widecard = os.path.join(vasp_path, 'struct-%s-%s-*' % (insert_ele,copy_str))
    vasp_struct = glob.glob(struct_widecard)
    assert len(vasp_struct)>0 ,"Please compute the interstitial defect using vasp first"
    vasp_struct.sort()
    cwd=os.getcwd()

    # make lammps.in
    if task_type =='deepmd':
        fc = lammps.make_lammps_eval('conf.lmp',
                                 ntypes,
                                 lammps.inter_deepmd,
                                 model_name)
    elif task_type =='meam':
        fc = lammps.make_lammps_eval('conf.lmp',
                                 ntypes,
                                 lammps.inter_meam,
                                 model_param)
    f_lammps_in = os.path.join(lmps_path, 'lammps.in')
    with open(f_lammps_in, 'w') as fp :
        fp.write(fc)

    for vs in vasp_struct :
        # get vasp energy
        outcar = os.path.join(vs, 'OUTCAR')
        energies = vasp.get_energies(outcar)
        # get xdat
        xdatcar = os.path.join(vs, 'XDATCAR')
        struct_basename  = os.path.basename(vs)
        ls = os.path.join(lmps_path, struct_basename)
        print(ls)
github deepmodeling / dpgen / dpgen / auto_test / gen_05_surf.py View on Github external
os.makedirs(task_path, exist_ok=True)
    cwd = os.getcwd()
    os.chdir(task_path)
    if os.path.isfile('POSCAR') :
        os.remove('POSCAR')
    os.symlink(os.path.relpath(equi_contcar), 'POSCAR')
    os.chdir(cwd)
    task_poscar = os.path.join(task_path, 'POSCAR')
    # gen strcture
    ss = Structure.from_file(task_poscar)
    # gen slabs
    all_slabs = generate_all_slabs(ss, max_miller, min_slab_size, min_vacuum_size)
    # make lammps.in
    if task_type =='deepmd':
        if static :
            fc = lammps.make_lammps_eval('conf.lmp',
                                     ntypes,
                                     lammps.inter_deepmd,
                                     model_name)
        else :
            fc = lammps.make_lammps_equi('conf.lmp',
                                     ntypes,
                                     lammps.inter_deepmd,
                                     model_name,
                                     change_box = relax_box)
    elif task_type =='meam':
        if static :
            fc = lammps.make_lammps_eval('conf.lmp',
                                     ntypes,
                                     lammps.inter_meam,
                                     model_param)
        else :
github deepmodeling / dpgen / dpgen / auto_test / gen_05_surf.py View on Github external
# make lammps.in
    if task_type =='deepmd':
        if static :
            fc = lammps.make_lammps_eval('conf.lmp',
                                     ntypes,
                                     lammps.inter_deepmd,
                                     model_name)
        else :
            fc = lammps.make_lammps_equi('conf.lmp',
                                     ntypes,
                                     lammps.inter_deepmd,
                                     model_name,
                                     change_box = relax_box)
    elif task_type =='meam':
        if static :
            fc = lammps.make_lammps_eval('conf.lmp',
                                     ntypes,
                                     lammps.inter_meam,
                                     model_param)
        else :
            fc = lammps.make_lammps_equi('conf.lmp',
                                     ntypes,
                                     lammps.inter_meam,
                                     model_param,
                                     change_box = relax_box)
    f_lammps_in = os.path.join(task_path, 'lammps.in')
    with open(f_lammps_in, 'w') as fp :
        fp.write(fc)
    cwd = os.getcwd()

    os.chdir(task_path)
    for ii in model_name :