예제 #1
0
    def find_directions(self, directions, miller):
        """Find missing directions and miller indices from the specified ones.

        Also handles the conversion of hexagonal-style 4-index notation to
        the normal 3-index notation.
        """
        directions = list(directions)
        miller = list(miller)
        if miller != [None, None, None]:
            raise NotImplementedError(
                'Specifying Miller indices of surfaces currently '
                'broken for hexagonal crystals.')
        for obj in (directions, miller):
            for i in range(3):
                if obj[i] is not None:
                    (a, b, c, d) = obj[i]
                    if a + b + c != 0:
                        raise ValueError(
                            ("(%d,%d,%d,%d) is not a valid hexagonal Miller " +
                             "index, as the sum of the first three numbers " +
                             "should be zero.") % (a, b, c, d))
                    x = 4 * a + 2 * b
                    y = 2 * a + 4 * b
                    z = 3 * d
                    obj[i] = (x, y, z)
        TriclinicFactory.find_directions(self, directions, miller)
예제 #2
0
 def __init__(self, latticeconstant=(1, 60), e_base=0.25, **kwargs):
     a = latticeconstant[0]
     alpha = latticeconstant[1]
     TriclinicFactory.__init__(latticeconstant={
         'a': a,
         'b': a,
         'c': a,
         'alpha': alpha,
         'beta': alpha,
         'gamma': alpha
     })
     raise Exception("Not implemented yet, don't want to do that")
예제 #3
0
    def make_crystal_basis(self):
        "Make the basis matrix for the crystal unit cell and the system unit cell."
        # First convert the basis specification to a triclinic one
        if type(self.latticeconstant) == type({}):
            self.latticeconstant['beta'] = 90
            self.latticeconstant['gamma'] = 90
        else:
            if len(self.latticeconstant) == 4:
                self.latticeconstant = self.latticeconstant + (90, 90)
            else:
                raise ValueError, "Improper lattice constants for monoclinic crystal."

        TriclinicFactory.make_crystal_basis(self)
예제 #4
0
파일: monoclinic.py 프로젝트: jboes/ase
    def make_crystal_basis(self):
        "Make the basis matrix for the crystal unit cell and the system unit cell."
        # First convert the basis specification to a triclinic one
        if isinstance(self.latticeconstant, type({})):
            self.latticeconstant['beta'] = 90
            self.latticeconstant['gamma'] = 90
        else:
            if len(self.latticeconstant) == 4:
                self.latticeconstant = self.latticeconstant + (90,90)
            else:
                raise ValueError("Improper lattice constants for monoclinic crystal.")

        TriclinicFactory.make_crystal_basis(self)
예제 #5
0
 def make_crystal_basis(self):
     "Make the basis matrix for the crystal unit cell and the system unit cell."
     # First convert the basis specification to a triclinic one
     if type(self.latticeconstant) == type({}):
         self.latticeconstant['alpha'] = 90
         self.latticeconstant['beta'] = 90
         self.latticeconstant['gamma'] = 120
         self.latticeconstant['b/a'] = 1.0
     else:
         if len(self.latticeconstant) == 2:
             a,c = self.latticeconstant
             self.latticeconstant = (a,a,c,90,90,120)
         else:
             raise ValueError, "Improper lattice constants for hexagonal crystal."
     TriclinicFactory.make_crystal_basis(self)
예제 #6
0
파일: hexagonal.py 프로젝트: uu1477/MyAse
 def make_crystal_basis(self):
     "Make the basis matrix for the crystal unit cell and the system unit cell."
     # First convert the basis specification to a triclinic one
     if isinstance(self.latticeconstant, type({})):
         self.latticeconstant['alpha'] = 90
         self.latticeconstant['beta'] = 90
         self.latticeconstant['gamma'] = 120
         self.latticeconstant['b/a'] = 1.0
     else:
         if len(self.latticeconstant) == 2:
             a,c = self.latticeconstant
             self.latticeconstant = (a,a,c,90,90,120)
         else:
             raise ValueError("Improper lattice constants for hexagonal crystal.")
     TriclinicFactory.make_crystal_basis(self)
예제 #7
0
    def find_directions(self, directions, miller):
        """Find missing directions and miller indices from the specified ones.

        Also handles the conversion of hexagonal-style 4-index notation to
        the normal 3-index notation.
        """
        directions = list(directions)
        miller = list(miller)
        for obj in (directions,miller):
            for i in range(3):
                if obj[i] is not None:
                    (a,b,c,d) = obj[i]
                    x = 4*a + 2*b
                    y = 2*a + 4*b
                    z = 3*d
                    obj[i] = (x,y,z)
        TriclinicFactory.find_directions(self, directions, miller)
예제 #8
0
    def find_directions(self, directions, miller):
        """Find missing directions and miller indices from the specified ones.

        Also handles the conversion of hexagonal-style 4-index notation to
        the normal 3-index notation.
        """
        directions = list(directions)
        miller = list(miller)
        for obj in (directions,miller):
            for i in range(3):
                if obj[i] is not None:
                    (a,b,c,d) = obj[i]
                    if a + b + c != 0:
                        raise ValueError(
                            ("(%d,%d,%d,%d) is not a valid hexagonal Miller " +
                             "index, as the sum of the first three numbers " +
                             "should be zero.") % (a,b,c,d))
                    x = 4*a + 2*b
                    y = 2*a + 4*b
                    z = 3*d
                    obj[i] = (x,y,z)
        TriclinicFactory.find_directions(self, directions, miller)