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"""
2Function-like objects that creates cubic clusters.
3"""
5import numpy as np
7from ase.data import reference_states as _refstate
8from ase.cluster.factory import ClusterFactory
11class SimpleCubicFactory(ClusterFactory):
12 spacegroup = 221
14 xtal_name = 'sc'
16 def get_lattice_constant(self):
17 "Get the lattice constant of an element with cubic crystal structure."
18 symmetry = _refstate[self.atomic_numbers[0]]['symmetry']
19 if symmetry != self.xtal_name:
20 raise ValueError("Cannot guess the %s " % (self.xtal_name,) +
21 "lattice constant of an element with crystal " +
22 "structure %s." % (symmetry,))
23 return _refstate[self.atomic_numbers[0]]['a']
25 def set_basis(self):
26 a = self.lattice_constant
27 if not isinstance(a, (int, float)):
28 raise ValueError(
29 "Improper lattice constant for %s crystal." %
30 (self.xtal_name,))
32 self.lattice_basis = np.array([[a, 0., 0.],
33 [0., a, 0.],
34 [0., 0., a]])
36 self.resiproc_basis = self.get_resiproc_basis(self.lattice_basis)
39SimpleCubic = SimpleCubicFactory()
42class BodyCenteredCubicFactory(SimpleCubicFactory):
43 spacegroup = 229
45 xtal_name = 'bcc'
47 atomic_basis = np.array([[0., 0., 0.],
48 [.5, .5, .5]])
51BodyCenteredCubic = BodyCenteredCubicFactory()
54class FaceCenteredCubicFactory(SimpleCubicFactory):
55 spacegroup = 225
57 xtal_name = 'fcc'
59 atomic_basis = np.array([[0., 0., 0.],
60 [0., .5, .5],
61 [.5, 0., .5],
62 [.5, .5, 0.]])
65FaceCenteredCubic = FaceCenteredCubicFactory()