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
1from ase.atoms import Atoms
2from ase.collections import g2
5def molecule(name, vacuum=None, **kwargs):
6 """Create an atomic structure from a database.
8 This is a helper function to easily create molecules from the g2 and
9 extra databases.
11 Parameters
12 ----------
13 name : str
14 Name of the molecule to build.
15 vacuum : float, optional
16 Amount of vacuum to pad the molecule with on all sides.
17 Additional keyword arguments (kwargs) can be supplied, which are passed
18 to ase.Atoms.
20 Returns
21 -------
22 ase.atoms.Atoms
23 An ASE Atoms object corresponding to the specified molecule.
25 Notes
26 -----
27 To see a list of allowed names, try:
29 >>> from ase.collections import g2
30 >>> print(g2.names)
31 >>> from ase.build.molecule import extra
32 >>> print(extra.keys())
34 Examples
35 --------
36 >>> from ase.build import molecule
37 >>> atoms = molecule('H2O')
39 """
40 if name in extra:
41 kwargs.update(extra[name])
42 mol = Atoms(**kwargs)
43 else:
44 mol = g2[name]
45 if kwargs:
46 mol = Atoms(mol, **kwargs)
47 if vacuum is not None:
48 mol.center(vacuum=vacuum)
49 return mol
52extra = {
53 'Be2': {
54 'symbols': 'BeBe',
55 'positions': [[0, 0, 1.0106],
56 [0, 0, -1.0106]]},
57 'C7NH5': {
58 'symbols': 'C7NH5',
59 'positions': [[-1.593581, -1.142601, 0.],
60 [-2.235542, 0.095555, 0.],
61 [-0.204885, -1.210726, 0.],
62 [0.549645, -0.025355, 0.],
63 [1.976332, -0.085321, 0.],
64 [-0.099258, 1.220706, 0.],
65 [-1.488628, 1.273345, 0.],
66 [3.136871, -0.128138, 0.],
67 [-2.177996, -2.060896, 0.],
68 [-3.323594, 0.141242, 0.],
69 [0.301694, -2.173705, 0.],
70 [0.488716, 2.136782, 0.],
71 [-1.987765, 2.240495, 0.]]},
72 'BDA': {
73 # 1,4-Benzodiamine
74 # aka p-Aminoaniline; p-Benzenediamine; p-Diaminobenzene;
75 # p-Phenylenediamine; Paraphenylen-diamine
76 # PBE-gpaw relaxed
77 'symbols': 'C6H4N2H4',
78 'positions': [[0.004212, 1.406347, 0.061073],
79 [1.193490, 0.687096, 0.029481],
80 [1.190824, -0.690400, -0.028344],
81 [0.000295, -1.406191, -0.059503],
82 [-1.186974, -0.685668, -0.045413],
83 [-1.185376, 0.690203, 0.009452],
84 [2.147124, 1.219997, 0.064477],
85 [2.141593, -1.227477, -0.054266],
86 [-2.138408, -1.222814, -0.095050],
87 [-2.137740, 1.226930, 0.023036],
88 [-0.006314, 2.776024, 0.186278],
89 [-0.007340, -2.777839, -0.159936],
90 [0.844710, -3.256543, 0.110098],
91 [-0.854965, -3.253324, 0.130125],
92 [0.845826, 3.267270, -0.055549],
93 [-0.854666, 3.254654, -0.092676]]},
94 'biphenyl': {
95 # PBE-gpaw relaxed
96 'symbols': 'C6H5C6H5',
97 'positions': [[-0.74081, -0.00000, -0.00003],
98 [-1.46261, -1.20370, -0.00993],
99 [-2.85531, -1.20350, -0.00663],
100 [-3.55761, -0.00000, -0.00003],
101 [-2.85531, 1.20350, 0.00667],
102 [-1.46261, 1.20370, 0.00997],
103 [-0.92071, -2.14850, 0.00967],
104 [-3.38981, -2.15110, -0.00083],
105 [-4.64571, -0.00000, -0.00003],
106 [-3.38981, 2.15110, 0.00077],
107 [-0.92071, 2.14850, -0.00963],
108 [3.55849, -0.00000, -0.00003],
109 [2.85509, -0.86640, -0.83553],
110 [1.46289, -0.87000, -0.83153],
111 [0.73969, -0.00000, -0.00003],
112 [1.46289, 0.87000, 0.83157],
113 [2.85509, 0.86640, 0.83547],
114 [4.64659, -0.00000, -0.00003],
115 [3.39189, -1.53770, -1.50253],
116 [0.91869, -1.53310, -1.50263],
117 [0.91869, 1.53310, 1.50267],
118 [3.39189, 1.53770, 1.50257]]},
119 'C60': {
120 # Buckminsterfullerene, I*h symm.
121 # The Buckyball has two degrees of freedom, the C-C bond, and the
122 # C=C bond. This is an LDA-gpaw relaxed structure with bond lengths
123 # 1.437 and 1.385.
124 # Experimentally, the two bond lengths are 1.45 and 1.40 Angstrom.
125 'symbols': 'C60',
126 'positions': [[2.2101953, 0.5866631, 2.6669504],
127 [3.1076393, 0.1577008, 1.6300286],
128 [1.3284430, -0.3158939, 3.2363232],
129 [3.0908709, -1.1585005, 1.2014240],
130 [3.1879245, -1.4574599, -0.1997005],
131 [3.2214623, 1.2230966, 0.6739440],
132 [3.3161210, 0.9351586, -0.6765151],
133 [3.2984981, -0.4301142, -1.1204138],
134 [-0.4480842, 1.3591484, 3.2081020],
135 [0.4672056, 2.2949830, 2.6175264],
136 [-0.0256575, 0.0764219, 3.5086259],
137 [1.7727917, 1.9176584, 2.3529691],
138 [2.3954623, 2.3095689, 1.1189539],
139 [-0.2610195, 3.0820935, 1.6623117],
140 [0.3407726, 3.4592388, 0.4745968],
141 [1.6951171, 3.0692446, 0.1976623],
142 [-2.1258394, -0.8458853, 2.6700963],
143 [-2.5620990, 0.4855202, 2.3531715],
144 [-0.8781521, -1.0461985, 3.2367302],
145 [-1.7415096, 1.5679963, 2.6197333],
146 [-1.6262468, 2.6357030, 1.6641811],
147 [-3.2984810, 0.4301871, 1.1204208],
148 [-3.1879469, 1.4573895, 0.1996030],
149 [-2.3360261, 2.5813627, 0.4760912],
150 [-0.5005210, -2.9797771, 1.7940308],
151 [-1.7944338, -2.7729087, 1.2047891],
152 [-0.0514245, -2.1328841, 2.7938830],
153 [-2.5891471, -1.7225828, 1.6329715],
154 [-3.3160705, -0.9350636, 0.6765268],
155 [-1.6951919, -3.0692581, -0.1976564],
156 [-2.3954901, -2.3096853, -1.1189862],
157 [-3.2214182, -1.2231835, -0.6739581],
158 [2.1758234, -2.0946263, 1.7922529],
159 [1.7118619, -2.9749681, 0.7557198],
160 [1.3130656, -1.6829416, 2.7943892],
161 [0.3959024, -3.4051395, 0.7557638],
162 [-0.3408219, -3.4591883, -0.4745610],
163 [2.3360057, -2.5814499, -0.4761050],
164 [1.6263757, -2.6357349, -1.6642309],
165 [0.2611352, -3.0821271, -1.6622618],
166 [-2.2100844, -0.5868636, -2.6670300],
167 [-1.7726970, -1.9178969, -2.3530466],
168 [-0.4670723, -2.2950509, -2.6175105],
169 [-1.3283500, 0.3157683, -3.2362375],
170 [-2.1759882, 2.0945383, -1.7923294],
171 [-3.0909663, 1.1583472, -1.2015749],
172 [-3.1076090, -0.1578453, -1.6301627],
173 [-1.3131365, 1.6828292, -2.7943639],
174 [0.5003224, 2.9799637, -1.7940203],
175 [-0.3961148, 3.4052817, -0.7557272],
176 [-1.7120629, 2.9749122, -0.7557988],
177 [0.0512824, 2.1329478, -2.7937450],
178 [2.1258630, 0.8460809, -2.6700534],
179 [2.5891853, 1.7227742, -1.6329562],
180 [1.7943010, 2.7730684, -1.2048262],
181 [0.8781323, 1.0463514, -3.2365313],
182 [0.4482452, -1.3591061, -3.2080510],
183 [1.7416948, -1.5679557, -2.6197714],
184 [2.5621724, -0.4853529, -2.3532026],
185 [0.0257904, -0.0763567, -3.5084446]]}}