Beispiel #1
0
    def test_as_dict(self):
        slabs = generate_all_slabs(
            self.ti,
            1,
            10,
            10,
            bonds=None,
            tol=1e-3,
            max_broken_bonds=0,
            lll_reduce=False,
            center_slab=False,
            primitive=True,
        )
        slab = slabs[0]
        s = json.dumps(slab.as_dict())
        d = json.loads(s)
        self.assertEqual(slab, Slab.from_dict(d))

        # test initialising with a list scale_factor
        slab = Slab(
            self.zno55.lattice,
            self.zno55.species,
            self.zno55.frac_coords,
            self.zno55.miller_index,
            self.zno55.oriented_unit_cell,
            0,
            self.zno55.scale_factor.tolist(),
        )
        s = json.dumps(slab.as_dict())
        d = json.loads(s)
        self.assertEqual(slab, Slab.from_dict(d))
Beispiel #2
0
 def test_as_dict(self):
     slabs = generate_all_slabs(self.ti, 1, 10, 10, bonds=None,
                                tol=1e-3, max_broken_bonds=0, lll_reduce=False, center_slab=False,
                                primitive=True)
     slab = slabs[0]
     s = json.dumps(slab.as_dict())
     d = json.loads(s)
     self.assertEqual(slab, Slab.from_dict(d))
Beispiel #3
0
 def test_as_from_dict(self):
     d = self.zno55.as_dict()
     obj = Slab.from_dict(d)
     self.assertEqual(obj.miller_index, (1, 0, 0))
Beispiel #4
0
 def set_slab(self):
     """ set the slab on to which the ligand is adsorbed"""
     self.slab = Slab.from_dict(super(Interface, self).as_dict())
Beispiel #5
0
 def set_slab(self):
     """ set the slab on to which the ligand is adsorbed"""
     self.slab = Slab.from_dict(super(Interface, self).as_dict())
Beispiel #6
0
 def test_as_from_dict(self):
     d = self.zno55.as_dict()
     obj = Slab.from_dict(d)
     self.assertEqual(obj.miller_index, (1, 0, 0))