예제 #1
0
    def test_tricky_structure(self):
        tricky_structure = Structure(
            [5.79, 0.0, 0.0, 0, 5.79, 0.0, 0.0, 0.0, 5.79],
            ["B", "C", "C", "C", "C", "N", "N", "N", "N", "Ag"],
            [
                [0.0, 0.0, 0.0],
                [0.842, 0.842, 0.842],
                [0.158, 0.842, 0.158],
                [0.158, 0.158, 0.842],
                [0.842, 0.158, 0.158],
                [0.726, 0.726, 0.726],
                [0.274, 0.726, 0.274],
                [0.274, 0.274, 0.726],
                [0.726, 0.274, 0.274],
                [0.5, 0.5, 0.5],
            ],
        )

        # cheon dimensionality gets wrong structure using default parameters
        self.assertEqual(get_dimensionality_cheon(tricky_structure), "2D")
        # cheon dimensionality gets tricky structure right using a
        # bigger supercell
        self.assertEqual(
            get_dimensionality_cheon(tricky_structure, larger_cell=True), "3D"
        )
예제 #2
0
 def test_get_dimensionality_with_bonds(self):
     s = self.get_structure('CsCl')
     self.assertEqual(get_dimensionality_cheon(s), 'intercalated ion')
     self.assertEqual(
         get_dimensionality_cheon(s, ldict={
             "Cs": 3.7,
             "Cl": 3
         }), '3D')
예제 #3
0
    def test_tricky_structure(self):
        tricky_structure = Structure(
            [5.79, 0., 0., 0, 5.79, 0., 0., 0., 5.79],
            ['B', 'C', 'C', 'C', 'C', 'N', 'N', 'N', 'N', 'Ag'],
            [[0.0, 0.0, 0.0], [0.842, 0.842, 0.842], [0.158, 0.842, 0.158],
             [0.158, 0.158, 0.842], [0.842, 0.158, 0.158],
             [0.726, 0.726, 0.726], [0.274, 0.726, 0.274],
             [0.274, 0.274, 0.726], [0.726, 0.274, 0.274], [0.5, 0.5, 0.5]])

        # cheon dimensionality gets wrong structure using default parameters
        self.assertEqual(get_dimensionality_cheon(tricky_structure), '2D')
        # cheon dimensionality gets tricky structure right using a
        # bigger supercell
        self.assertEqual(get_dimensionality_cheon(tricky_structure, larger_cell=True), '3D')
예제 #4
0
    def test_tricky_structure(self):
        tricky_structure = Structure(
            [5.79, 0., 0., 0, 5.79, 0., 0., 0., 5.79],
            ['B', 'C', 'C', 'C', 'C', 'N', 'N', 'N', 'N', 'Ag'],
            [[0.0, 0.0, 0.0], [0.842, 0.842, 0.842], [0.158, 0.842, 0.158],
             [0.158, 0.158, 0.842], [0.842, 0.158, 0.158],
             [0.726, 0.726, 0.726], [0.274, 0.726, 0.274],
             [0.274, 0.274, 0.726], [0.726, 0.274, 0.274], [0.5, 0.5, 0.5]])

        # cheon dimensionality gets wrong structure using default parameters
        self.assertEqual(get_dimensionality_cheon(tricky_structure), '2D')
        # cheon dimensionality gets tricky structure right using a
        # bigger supercell
        self.assertEqual(
            get_dimensionality_cheon(tricky_structure, larger_cell=True), '3D')
예제 #5
0
    def test_tricky_structure(self):
        tricky_structure = Structure(
            [5.79, 0., 0., 0, 5.79, 0., 0., 0., 5.79],
            ['B', 'C', 'C', 'C', 'C', 'N', 'N', 'N', 'N', 'Ag'],
            [[0.0, 0.0, 0.0], [0.842, 0.842, 0.842], [0.158, 0.842, 0.158],
             [0.158, 0.158, 0.842], [0.842, 0.158, 0.158],
             [0.726, 0.726, 0.726], [0.274, 0.726, 0.274],
             [0.274, 0.274, 0.726], [0.726, 0.274, 0.274], [0.5, 0.5, 0.5]])

        # cheon dimensionality gets wrong structure
        self.assertEqual(get_dimensionality_cheon(tricky_structure), '2D')
예제 #6
0
    def test_tricky_structure(self):
        tricky_structure = Structure(
            [5.79, 0., 0., 0, 5.79, 0., 0., 0., 5.79],
            ['B', 'C', 'C', 'C', 'C', 'N', 'N', 'N', 'N', 'Ag'],
            [[0.0, 0.0, 0.0], [0.842, 0.842, 0.842], [0.158, 0.842, 0.158],
             [0.158, 0.158, 0.842], [0.842, 0.158, 0.158],
             [0.726, 0.726, 0.726], [0.274, 0.726, 0.274],
             [0.274, 0.274, 0.726], [0.726, 0.274, 0.274], [0.5, 0.5, 0.5]])

        # cheon dimensionality gets wrong structure
        self.assertEqual(get_dimensionality_cheon(tricky_structure), '2D')
예제 #7
0
    def get_cheon_gorai_dim(self):
        """Convenience method for getting Cheon and Gorai dims. These algorithms take some time.

        Returns:
            None: (sets instance variables).

        """
        cheon_dim_str = get_dimensionality_cheon(self.structure)

        if cheon_dim_str == "0D":
            cheon_dim = 0
        elif cheon_dim_str == "1D":
            cheon_dim = 1
        elif cheon_dim_str == "2D":
            cheon_dim = 2
        elif cheon_dim_str == "3D":
            cheon_dim = 3
        else:
            cheon_dim = None

        self.cheon_dim = cheon_dim

        self.gorai_dim = get_dimensionality_gorai(self.structure)
예제 #8
0
    def test_get_dimensionality(self):
        s = self.get_structure('LiFePO4')
        self.assertEqual(get_dimensionality_cheon(s), 'intercalated ion')

        s = self.get_structure('Graphite')
        self.assertEqual(get_dimensionality_cheon(s), '2D')
예제 #9
0
    def test_get_dimensionality(self):
        s = self.get_structure("LiFePO4")
        self.assertEqual(get_dimensionality_cheon(s), "intercalated ion")

        s = self.get_structure("Graphite")
        self.assertEqual(get_dimensionality_cheon(s), "2D")
예제 #10
0
 def test_get_dimensionality_with_bonds(self):
     s = self.get_structure('CsCl')
     self.assertEqual(get_dimensionality_cheon(s), 'intercalated ion')
     self.assertEqual(
         get_dimensionality_cheon(s, ldict={"Cs": 3.7, "Cl": 3}), '3D')
예제 #11
0
    def test_get_dimensionality(self):
        s = self.get_structure('LiFePO4')
        self.assertEqual(get_dimensionality_cheon(s), 'intercalated ion')

        s = self.get_structure('Graphite')
        self.assertEqual(get_dimensionality_cheon(s), '2D')
예제 #12
0
def plug_in(symbol_values):
    structure = symbol_values['structure']
    return {
        'dimensionality': get_dimensionality_cheon(structure),
    }