Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Function-like objects creating tetragonal lattices.
3The following lattice creators are defined:
4 SimleTetragonal
5 CenteredTetragonal
6"""
8from ase.lattice.orthorhombic import (SimpleOrthorhombicFactory,
9 BodyCenteredOrthorhombicFactory)
12class _Tetragonalize:
13 "A mixin class for implementing tetragonal crystals as orthorhombic ones."
15 # The name of the crystal structure in ChemicalElements
16 xtal_name = "tetragonal"
18 def make_crystal_basis(self):
19 lattice = self.latticeconstant
20 if isinstance(lattice, type({})):
21 lattice['b/a'] = 1.0
22 else:
23 if len(lattice) == 2:
24 lattice = (lattice[0], lattice[0], lattice[1])
25 else:
26 raise ValueError(
27 'Improper lattice constants for tetragonal crystal.')
28 self.latticeconstant = lattice
29 self.orthobase.make_crystal_basis(self)
32class SimpleTetragonalFactory(_Tetragonalize, SimpleOrthorhombicFactory):
33 "A factory for creating simple tetragonal lattices."
34 orthobase = SimpleOrthorhombicFactory
37SimpleTetragonal = SimpleTetragonalFactory()
40class CenteredTetragonalFactory(_Tetragonalize,
41 BodyCenteredOrthorhombicFactory):
42 "A factory for creating centered tetragonal lattices."
43 orthobase = BodyCenteredOrthorhombicFactory
46CenteredTetragonal = CenteredTetragonalFactory()