Exemplo n.º 1
0
    def test_post_fp_vasp_1(self):

        with open(param_file, 'r') as fp:
            jdata = json.load(fp)
        post_fp_vasp(0, jdata, rfailed=0.3)

        sys = dpdata.LabeledSystem('iter.000000/02.fp/data.001/',
                                   fmt='deepmd/raw')
        self.assertEqual(sys.get_nframes(), 1)

        # if sys.data['coords'][0][1][0] < sys.data['coords'][1][1][0]:
        #     idx = [0]
        # else :
        idx = [1]
        ref_coord = self.ref_coord[idx]
        ref_cell = self.ref_cell[idx]
        ref_e = self.ref_e[idx]
        ref_f = self.ref_f[idx]
        ref_v = self.ref_v[idx]
        ref_at = self.ref_at

        for ff in range(1):
            self.assertAlmostEqual(ref_e[ff], sys.data['energies'][ff])
        for ii in range(2):
            self.assertEqual(ref_at[ff], sys.data['atom_types'][ff])
        for ff in range(1):
            for ii in range(2):
                for dd in range(3):
                    self.assertAlmostEqual(ref_coord[ff][ii][dd],
                                           sys.data['coords'][ff][ii][dd])
                    self.assertAlmostEqual(ref_f[ff][ii][dd],
                                           sys.data['forces'][ff][ii][dd])
        for ff in range(1):
            for ii in range(3):
                for jj in range(3):
                    self.assertAlmostEqual(ref_v[ff][ii][jj],
                                           sys.data['virials'][ff][ii][jj],
                                           places=5)
                    self.assertAlmostEqual(ref_cell[ff][ii][jj],
                                           sys.data['cells'][ff][ii][jj])
Exemplo n.º 2
0
 def test_post_fp_vasp_2(self):
     with open(param_file, 'r') as fp:
         jdata = json.load(fp)
     with self.assertRaises(RuntimeError):
         post_fp_vasp(0, jdata)