Esempio n. 1
0
File: run.py Progetto: obaica/dpgen
def gen_elastic(task_type, jdata, mdata):
    conf_dir = jdata['conf_dir']
    cwd = os.getcwd()
    #vasp
    if task_type == "vasp":
        gen_02_elastic.make_vasp(jdata, conf_dir)
    #lammps
    elif task_type in lammps_task_type:
        gen_02_elastic.make_lammps(jdata, conf_dir, task_type)
    else:
        raise RuntimeError("unknow task %s, something wrong" % task_type)
    os.chdir(cwd)
Esempio n. 2
0
def gen_elastic(task_type, jdata, mdata):
    conf_dir = jdata['conf_dir']
    cwd = os.getcwd()
    #vasp
    if task_type == "vasp":
        gen_02_elastic.make_vasp(jdata, conf_dir)
    #deepmd
    elif task_type == "deepmd":
        gen_02_elastic.make_deepmd_lammps(jdata, conf_dir)
    #meam
    elif task_type == "meam":
        gen_02_elastic.make_meam_lammps(jdata, conf_dir)
    else:
        raise RuntimeError("unknow task %s, something wrong" % task_type)
    os.chdir(cwd)
Esempio n. 3
0
    def test_make_vasp(self):
        jdata = {
            'relax_incar': 'vasp_input/INCAR.rlx',
            'potcar_map': {
                'Si': 'vasp_input/POTCAR'
            },
        }
        make_vasp(jdata, 'confs/si/mp-149')

        target_path = '02.elastic/si/mp-149/vasp-relax_incar'
        equi_path = '00.equi/si/mp-149/vasp-relax_incar'
        dfm_dirs = glob.glob(os.path.join(target_path, 'dfm*'))

        # check root INCAR
        incar0 = Incar.from_file(os.path.join('vasp_input', 'INCAR.rlx'))
        incar1 = Incar.from_file(os.path.join(target_path, 'INCAR'))
        self.assertFalse(incar0 == incar1)
        incar0['ISIF'] = 2
        self.assertTrue(incar0 == incar1)
        # check root POTCAR
        with open(os.path.join('vasp_input', 'POTCAR')) as fp:
            pot0 = fp.read()
        with open(os.path.join(target_path, 'POTCAR')) as fp:
            pot1 = fp.read()
        self.assertEqual(pot0, pot1)
        # check root POSCAR
        self.assertEqual(os.path.realpath(os.path.join(target_path, 'POSCAR')),
                         os.path.realpath(os.path.join(equi_path, 'CONTCAR')))
        # check subdir
        for ii in dfm_dirs:
            self.assertEqual(
                os.path.realpath(os.path.join(ii, 'INCAR')),
                os.path.realpath(os.path.join(target_path, 'INCAR')))
            self.assertEqual(
                os.path.realpath(os.path.join(ii, 'KPOINTS')),
                os.path.realpath(os.path.join(target_path, 'KPOINTS')))
            self.assertEqual(
                os.path.realpath(os.path.join(ii, 'POTCAR')),
                os.path.realpath(os.path.join(target_path, 'POTCAR')))