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)
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")
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)
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)
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)
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)
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)
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)