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.cluster.cubic import FaceCenteredCubic
8from ase.cluster.compounds import L1_2
11def Octahedron(symbol, length, cutoff=0, latticeconstant=None, alloy=False):
12 """
13 Returns Face Centered Cubic clusters of the octahedral class depending
14 on the choice of cutoff.
16 ============================ =======================
17 Type Condition
18 ============================ =======================
19 Regular octahedron cutoff = 0
20 Truncated octahedron cutoff > 0
21 Regular truncated octahedron length = 3 * cutoff + 1
22 Cuboctahedron length = 2 * cutoff + 1
23 ============================ =======================
26 Parameters:
28 symbol: string or sequence of int
29 The chemical symbol or atomic number of the element(s).
31 length: int
32 Number of atoms on the square edges of the complete octahedron.
34 cutoff (optional): int
35 Number of layers cut at each vertex.
37 latticeconstant (optional): float
38 The lattice constant. If not given,
39 then it is extracted form ase.data.
41 alloy (optional): bool
42 If true the L1_2 structure is used. Default is False.
44 """
46 # Check length and cutoff
47 if length < 1:
48 raise ValueError("The length must be at least one.")
50 if cutoff < 0 or length < 2 * cutoff + 1:
51 raise ValueError(
52 "The cutoff must fulfill: > 0 and <= (length - 1) / 2.")
54 # Create cluster
55 surfaces = [(1, 1, 1), (1, 0, 0)]
56 if length % 2 == 0:
57 center = np.array([0.5, 0.5, 0.5])
58 layers = [length / 2, length - 1 - cutoff]
59 else:
60 center = np.array([0.0, 0.0, 0.0])
61 layers = [(length - 1) / 2, length - 1 - cutoff]
63 if not alloy:
64 return FaceCenteredCubic(
65 symbol, surfaces, layers, latticeconstant, center)
66 else:
67 return L1_2(symbol, surfaces, layers, latticeconstant, center)