Coverage for /builds/kinetik161/ase/ase/cluster/util.py: 71.43%
14 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
1from ase.data import atomic_numbers, chemical_symbols, reference_states
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