Statistiques
| Révision :

root / ase / lattice / monoclinic.py @ 12

Historique | Voir | Annoter | Télécharger (1,64 ko)

1
"""Function-like object creating monoclinic lattices.
2

3
The following lattice creator is defined:
4
    SimpleMonoclinic
5
    BaseCenteredMonoclinic
6
"""
7

    
8
from ase.lattice.triclinic import TriclinicFactory
9
import numpy as np
10
from ase.data import reference_states as _refstate
11

    
12

    
13
class SimpleMonoclinicFactory(TriclinicFactory):
14
    "A factory for creating simple monoclinic lattices."
15
    # The name of the crystal structure in ChemicalElements
16
    xtal_name = "monoclinic"
17

    
18
    def make_crystal_basis(self):
19
        "Make the basis matrix for the crystal unit cell and the system unit cell."
20
        # First convert the basis specification to a triclinic one
21
        if type(self.latticeconstant) == type({}):
22
            self.latticeconstant['beta'] = 90
23
            self.latticeconstant['gamma'] = 90
24
        else:
25
            if len(self.latticeconstant) == 4:
26
                self.latticeconstant = self.latticeconstant + (90,90)
27
            else:
28
                raise ValueError, "Improper lattice constants for monoclinic crystal."
29

    
30
        TriclinicFactory.make_crystal_basis(self)
31
        
32
SimpleMonoclinic = SimpleMonoclinicFactory()
33

    
34
class BaseCenteredMonoclinicFactory(SimpleMonoclinicFactory):
35
    # The natural basis vectors of the crystal structure
36
    int_basis = np.array([[1, -1, 0],
37
                          [1, 1, 0],
38
                          [0, 0, 2]])
39
    basis_factor = 0.5
40

    
41
    # Converts the natural basis back to the crystallographic basis
42
    inverse_basis = np.array([[1, 1, 0],
43
                              [-1, 1, 0],
44
                              [0, 0, 1]])
45
    inverse_basis_factor = 1.0
46

    
47
BaseCenteredMonoclinic = BaseCenteredMonoclinicFactory()