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
1import numpy as np
3from ase import Atoms
4from ase.cluster.util import get_element_info
7def Decahedron(symbol, p, q, r, latticeconstant=None):
8 """
9 Return a decahedral cluster.
11 Parameters
12 ----------
13 symbol: Chemical symbol (or atomic number) of the element.
15 p: Number of atoms on the (100) facets perpendicular to the five
16 fold axis.
18 q: Number of atoms on the (100) facets parallel to the five fold
19 axis. q = 1 corresponds to no visible (100) facets.
21 r: Depth of the Marks re-entrence at the pentagon corners. r = 0
22 corresponds to no re-entrence.
24 latticeconstant (optional): The lattice constant. If not given,
25 then it is extracted form ase.data.
26 """
28 symbol, atomic_number, latticeconstant = get_element_info(
29 symbol, latticeconstant)
31 # Check values of p, q, r
32 if p < 1 or q < 1:
33 raise ValueError("p and q must be greater than 0.")
35 if r < 0:
36 raise ValueError("r must be greater than or equal to 0.")
38 # Defining constants
39 t = 2.0 * np.pi / 5.0
40 b = latticeconstant / np.sqrt(2.0)
41 a = b * np.sqrt(3.0) / 2.0
43 verticies = a * np.array([[np.cos(np.pi / 2.), np.sin(np.pi / 2.), 0.],
44 [np.cos(t * 1. + np.pi / 2.),
45 np.sin(t * 1. + np.pi / 2.), 0.],
46 [np.cos(t * 2. + np.pi / 2.),
47 np.sin(t * 2. + np.pi / 2.), 0.],
48 [np.cos(t * 3. + np.pi / 2.),
49 np.sin(t * 3. + np.pi / 2.), 0.],
50 [np.cos(t * 4. + np.pi / 2.), np.sin(t * 4. + np.pi / 2.), 0.]])
52 # Number of atoms on the five fold axis and a nice constant
53 h = p + q + 2 * r - 1
54 g = h - q + 1 # p + 2*r
56 positions = []
57 # Make the five fold axis
58 for j in range(h):
59 pos = np.array([0.0, 0.0, j * b - (h - 1) * b / 2.0])
60 positions.append(pos)
62 # Make pentagon rings around the five fold axis
63 for n in range(1, h):
64 # Condition for (100)-planes
65 if n < g:
66 for m in range(5):
67 v1 = verticies[m - 1]
68 v2 = verticies[m]
69 for i in range(n):
70 # Condition for marks re-entrence
71 if n - i < g - r and i < g - r:
72 for j in range(h - n):
73 pos = (n - i) * v1 + i * v2
74 pos += np.array([0.0, 0.0, j * b -
75 (h - n - 1) * b / 2.0])
76 positions.append(pos)
78 symbols = [atomic_number] * len(positions)
79 return Atoms(symbols=symbols, positions=positions)