1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
from __future__ import print_function, division
from ase.lattice.cubic import FaceCenteredCubic
from ase.lattice.hexagonal import HexagonalClosedPacked
from ase.test import must_raise
with must_raise(ValueError):
# The Miller indices of the surfaces are linearly dependent
atoms = FaceCenteredCubic(symbol='Cu',
miller=[[1, 1, 0], [1, 1, 0], [0, 0, 1]])
# This one should be OK:
atoms = FaceCenteredCubic(symbol='Cu',
miller=[[1, 1, 0], [0, 1, 0], [0, 0, 1]])
print(atoms.get_cell())
with must_raise(ValueError):
# The directions spanning the unit cell are linearly dependent
atoms = FaceCenteredCubic(symbol='Cu',
directions=[[1, 1, 0], [1, 1, 0], [0, 0, 1]])
with must_raise(ValueError):
# The directions spanning the unit cell are linearly dependent
atoms = FaceCenteredCubic(symbol='Cu',
directions=[[1, 1, 0], [1, 0, 0], [0, 1, 0]])
# This one should be OK:
atoms = FaceCenteredCubic(symbol='Cu',
directions=[[1, 1, 0], [0, 1, 0], [0, 0, 1]])
print(atoms.get_cell())
with must_raise((ValueError, NotImplementedError)):
# The Miller indices of the surfaces are linearly dependent
atoms = HexagonalClosedPacked(symbol='Mg',
miller=[[1, -1, 0, 0],
[1, 0, -1, 0],
[0, 1, -1, 0]])
# This one should be OK
#
# It is not! The miller argument is broken in hexagonal crystals!
#
# atoms = HexagonalClosedPacked(symbol='Mg',
# miller=[[1, -1, 0, 0],
# [1, 0, -1, 0],
# [0, 0, 0, 1]])
# print(atoms.get_cell())
with must_raise(ValueError):
# The directions spanning the unit cell are linearly dependent
atoms = HexagonalClosedPacked(symbol='Mg',
directions=[[1, -1, 0, 0],
[1, 0, -1, 0],
[0, 1, -1, 0]])
# This one should be OK
atoms = HexagonalClosedPacked(symbol='Mg',
directions=[[1, -1, 0, 0],
[1, 0, -1, 0],
[0, 0, 0, 1]])
print(atoms.get_cell())
|