Statistiques
| Révision :

root / ase / test / crystal.py @ 1

Historique | Voir | Annoter | Télécharger (2,51 ko)

1
import numpy as np
2

    
3
from ase.lattice.spacegroup import crystal
4

    
5

    
6
# A diamond unit cell
7
diamond = crystal('C', [(0,0,0)], spacegroup=227, 
8
                  cellpar=[3.57, 3.57, 3.57, 90, 90, 90])
9

    
10
assert len(diamond) == 8
11
correct_pos = np.array([[ 0.  ,  0.  ,  0.  ],
12
                        [ 0.  ,  0.5 ,  0.5 ],
13
                        [ 0.5 ,  0.5 ,  0.  ],
14
                        [ 0.5 ,  0.  ,  0.5 ],
15
                        [ 0.75,  0.25,  0.75],
16
                        [ 0.25,  0.25,  0.25],
17
                        [ 0.25,  0.75,  0.75],
18
                        [ 0.75,  0.75,  0.25]])
19
assert np.allclose(diamond.get_scaled_positions(), correct_pos)
20

    
21

    
22

    
23
# A CoSb3 skutterudite unit cell containing 32 atoms
24
skutterudite = crystal(('Co', 'Sb'), 
25
    basis=[(0.25,0.25,0.25), (0.0, 0.335, 0.158)], 
26
    spacegroup=204, cellpar=[9.04, 9.04, 9.04, 90, 90, 90])
27

    
28
assert len(skutterudite) == 32
29

    
30
correct_pos = np.array([[ 0.25 ,  0.25 ,  0.25 ],
31
                        [ 0.75 ,  0.75 ,  0.25 ],
32
                        [ 0.75 ,  0.25 ,  0.75 ],
33
                        [ 0.25 ,  0.75 ,  0.75 ],
34
                        [ 0.75 ,  0.75 ,  0.75 ],
35
                        [ 0.25 ,  0.25 ,  0.75 ],
36
                        [ 0.25 ,  0.75 ,  0.25 ],
37
                        [ 0.75 ,  0.25 ,  0.25 ],
38
                        [ 0.   ,  0.335,  0.158],
39
                        [ 0.   ,  0.665,  0.158],
40
                        [ 0.   ,  0.335,  0.842],
41
                        [ 0.   ,  0.665,  0.842],
42
                        [ 0.158,  0.   ,  0.335],
43
                        [ 0.158,  0.   ,  0.665],
44
                        [ 0.842,  0.   ,  0.335],
45
                        [ 0.842,  0.   ,  0.665],
46
                        [ 0.335,  0.158,  0.   ],
47
                        [ 0.665,  0.158,  0.   ],
48
                        [ 0.335,  0.842,  0.   ],
49
                        [ 0.665,  0.842,  0.   ],
50
                        [ 0.5  ,  0.835,  0.658],
51
                        [ 0.5  ,  0.165,  0.658],
52
                        [ 0.5  ,  0.835,  0.342],
53
                        [ 0.5  ,  0.165,  0.342],
54
                        [ 0.658,  0.5  ,  0.835],
55
                        [ 0.658,  0.5  ,  0.165],
56
                        [ 0.342,  0.5  ,  0.835],
57
                        [ 0.342,  0.5  ,  0.165],
58
                        [ 0.835,  0.658,  0.5  ],
59
                        [ 0.165,  0.658,  0.5  ],
60
                        [ 0.835,  0.342,  0.5  ],
61
                        [ 0.165,  0.342,  0.5  ]])
62

    
63
assert np.allclose(skutterudite.get_scaled_positions(), correct_pos)