root / ase / lattice / tetragonal.py @ 18
Historique | Voir | Annoter | Télécharger (1,42 ko)
1 |
"""Function-like objects creating tetragonal lattices.
|
---|---|
2 |
|
3 |
The following lattice creators are defined:
|
4 |
SimleTetragonal
|
5 |
CenteredTetragonal
|
6 |
"""
|
7 |
|
8 |
from ase.lattice.orthorhombic import SimpleOrthorhombicFactory,\ |
9 |
BodyCenteredOrthorhombicFactory
|
10 |
import numpy as np |
11 |
from ase.data import reference_states as _refstate |
12 |
|
13 |
|
14 |
class _Tetragonalize: |
15 |
"A mixin class for implementing tetragonal crystals as orthorhombic ones."
|
16 |
|
17 |
# The name of the crystal structure in ChemicalElements
|
18 |
xtal_name = "tetragonal"
|
19 |
|
20 |
def make_crystal_basis(self): |
21 |
lattice = self.latticeconstant
|
22 |
if type(lattice) == type({}): |
23 |
lattice['b/a'] = 1.0 |
24 |
else:
|
25 |
if len(lattice) == 2: |
26 |
lattice = (lattice[0], lattice[0], lattice[1]) |
27 |
else:
|
28 |
raise ValueError, "Improper lattice constants for tetragonal crystal." |
29 |
self.latticeconstant = lattice
|
30 |
self.orthobase.make_crystal_basis(self) |
31 |
|
32 |
class SimpleTetragonalFactory(_Tetragonalize, SimpleOrthorhombicFactory): |
33 |
"A factory for creating simple tetragonal lattices."
|
34 |
orthobase = SimpleOrthorhombicFactory |
35 |
|
36 |
SimpleTetragonal = SimpleTetragonalFactory() |
37 |
|
38 |
|
39 |
class CenteredTetragonalFactory(_Tetragonalize, |
40 |
BodyCenteredOrthorhombicFactory): |
41 |
"A factory for creating centered tetragonal lattices."
|
42 |
orthobase = BodyCenteredOrthorhombicFactory |
43 |
|
44 |
CenteredTetragonal = CenteredTetragonalFactory() |