示例#1
0
    def test_meam_three_step(self, patch_random):
        patch_random.randint = MagicMock(return_value=7858)
        test_name = 'three_step_meam'
        benchmark_dir = os.path.join(self.benchmark_dir, test_name)
        test_dir = os.path.join(self.test_dir, test_name)

        json_file = os.path.join(benchmark_dir, 'jdata.json')
        with open(json_file) as f:
            jdata = json.load(f)
        # print(dpti.ti)
        # print(dir(dpti.ti))
        dpti.hti.make_tasks(iter_name=test_dir, jdata=jdata, switch='three-step')
        check_file_list = [ 
            'conf.lmp', 
            '00.lj_on/task.000004/conf.lmp',
            '00.lj_on/task.000004/in.lammps',
            '01.deep_on/task.000005/library_18Metals.meam',
            '01.deep_on/task.000005/in.lammps',
            '02.spring_off/task.000006/Sn_18Metals.meam',
            '02.spring_off/task.000006/in.lammps'
        ]
        for file in check_file_list:
            f1 = os.path.join(benchmark_dir, file)
            f2 = os.path.join(test_dir, file)
            self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1,f2))
 def test_get_npt_avg_conf(self):
     npt_name = os.path.join(self.benchmark_dir, 'npt')
     # test_dir = os.path.join(self.test_dir, 'get_npt_avg_conf')
     npt_avg_conf_lmp = dpti.equi.npt_equi_conf(npt_name)
     f2 = os.path.join(self.test_dir, 'npt_avg.lmp')
     with open(f2, 'w') as f:
         f.write(npt_avg_conf_lmp)
     f1 = os.path.join(npt_name, 'npt_avg.lmp')
     self.assertEqual(get_file_md5(f1), get_file_md5(f2))
 def test_ti_water_old_json_gen_tasks(self, patch_random):
     patch_random.randint = MagicMock(return_value=7858)
     args = MagicMock(output='tmp_ti_water/old_json_job/',
                      command='gen',
                      PARAM='benchmark_ti_water/ti_water.json.old')
     ti_water.exec_args(args=args, parser=None)
     check_file_list = [
         'conf.lmp', 'task.000003/in.lammps', 'task.000003/graph.pb',
         'task.000003/thermo.out'
     ]
     for file in check_file_list:
         f1 = os.path.join('benchmark_ti_water/new_job/', file)
         f2 = os.path.join('tmp_ti_water/old_json_job/', file)
         self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1, f2))
示例#4
0
    def test_nvt(self, patch_random):
        patch_random.randint = MagicMock(return_value=7858)
        test_name = 'nvt'
        benchmark_dir = os.path.join(self.benchmark_dir, test_name)
        test_dir = os.path.join(self.test_dir, test_name)

        json_file = os.path.join(benchmark_dir, 'jdata.json')
        with open(json_file) as f:
            jdata = json.load(f)
        dpti.equi.make_task(iter_name=test_dir, jdata=jdata)
        check_file_list = ['in.lammps', 'conf.lmp', 'graph.pb']
        for file in check_file_list:
            f1 = os.path.join(benchmark_dir, file)
            f2 = os.path.join(test_dir, file)
            self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1, f2))
示例#5
0
 def test_hti_ice_old_json_tasks(self, patch_random):
     patch_random.randint = MagicMock(return_value=7858)
     args = MagicMock(output='tmp_hti_ice/old_json_job/',
                      switch='three-step',
                      command='gen',
                      PARAM='benchmark_hti_ice/hti_ice.json.old')
     hti_ice.exec_args(args=args, parser=None)
     check_file_list = [
         'conf.lmp', '00.lj_on/task.000003/conf.lmp',
         '00.lj_on/task.000003/in.lammps',
         '01.deep_on/task.000004/in.lammps',
         '02.spring_off/task.000005/in.lammps'
     ]
     for file in check_file_list:
         f1 = os.path.join('benchmark_hti_ice/new_job/', file)
         f2 = os.path.join('tmp_hti_ice/old_json_job/', file)
         self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1, f2))
示例#6
0
 def test_hti_water_gen_tasks(self, patch_random):
     patch_random.randint = MagicMock(return_value=7858)
     args = MagicMock(output='tmp_hti_water/new_job/',  
         command='gen',
         PARAM='benchmark_hti_water/hti_water.json'
     )
     hti_water.exec_args(args=args, parser=None)
     check_file_list = [
         'conf.lmp', 
         '00.angle_on/task.000002/conf.lmp',
         '00.angle_on/task.000002/in.lammps',
         '01.deep_on/task.000003/in.lammps',
         '02.bond_angle_off/task.000004/in.lammps'
     ]
     for file in check_file_list:
         f1 = os.path.join('benchmark_hti_water/new_job/', file)
         f2 = os.path.join('tmp_hti_water/new_job/', file)
         self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1,f2))
    def test_npt(self, patch_print):
        test_name = 'npt'
        benchmark_dir = os.path.join(self.benchmark_dir, test_name)
        test_dir = os.path.join(self.test_dir, test_name)
        os.mkdir(test_dir)
        link_file_list = ['log.lammps', 'equi_settings.json', 'conf.lmp']
        for file in link_file_list:
            src = os.path.join(benchmark_dir, file)
            relative_link_file(file_path=src, target_dir=test_dir)

        post_task(test_dir)
        patch_print.assert_called_once()
        check_file_list = [
            'result',
        ]
        for file in check_file_list:
            f1 = os.path.join(benchmark_dir, file)
            f2 = os.path.join(test_dir, file)
            self.assertEqual(get_file_md5(f1), get_file_md5(f2))
示例#8
0
    def test_deepmd_one_step(self, patch_random):
        patch_random.randint = MagicMock(return_value=7858)
        test_name = 'one_step'
        benchmark_dir = os.path.join(self.benchmark_dir, test_name)
        test_dir = os.path.join(self.test_dir, test_name)

        json_file = os.path.join(benchmark_dir, 'jdata.json')
        with open(json_file) as f:
            jdata = json.load(f)
        dpti.hti.make_tasks(iter_name=test_dir, jdata=jdata, switch='one-step')
        check_file_list = [ 
            'conf.lmp', 
            'graph.pb',
            'task.000006/graph.pb',
            'task.000006/in.lammps',
        ]
        for file in check_file_list:
            f1 = os.path.join(benchmark_dir, file)
            f2 = os.path.join(test_dir, file)
            self.assertEqual(get_file_md5(f1), get_file_md5(f2), msg=(f1,f2))