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.data import atomic_numbers, reference_states, chemical_symbols
4def get_element_info(symbol, latticeconstant):
5 if isinstance(symbol, str):
6 atomic_number = atomic_numbers[symbol]
7 else:
8 atomic_number = symbol
9 symbol = chemical_symbols[atomic_number]
11 if latticeconstant is None:
12 if reference_states[atomic_number]['symmetry'] in ['fcc', 'bcc', 'sc']:
13 lattice_constant = reference_states[atomic_number]['a']
14 else:
15 raise NotImplementedError(
16 ("Cannot guess lattice constant of a %s element." %
17 (reference_states[atomic_number]['symmetry'],)))
18 else:
19 if isinstance(latticeconstant, (int, float)):
20 lattice_constant = latticeconstant
21 else:
22 raise ValueError("Lattice constant must be of type int or float.")
24 return symbol, atomic_number, lattice_constant