You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
916 B
25 lines
916 B
2 years ago
|
from cmmde_data import atomic_numbers, reference_states, chemical_symbols
|
||
|
|
||
|
|
||
|
def get_element_info(symbol, latticeconstant):
|
||
|
if isinstance(symbol, str):
|
||
|
atomic_number = atomic_numbers[symbol]
|
||
|
else:
|
||
|
atomic_number = symbol
|
||
|
symbol = chemical_symbols[atomic_number]
|
||
|
|
||
|
if latticeconstant is None:
|
||
|
if reference_states[atomic_number]['symmetry'] in ['fcc', 'bcc', 'sc']:
|
||
|
lattice_constant = reference_states[atomic_number]['a']
|
||
|
else:
|
||
|
raise NotImplementedError(
|
||
|
("Cannot guess lattice constant of a %s element." %
|
||
|
(reference_states[atomic_number]['symmetry'],)))
|
||
|
else:
|
||
|
if isinstance(latticeconstant, (int, float)):
|
||
|
lattice_constant = latticeconstant
|
||
|
else:
|
||
|
raise ValueError("Lattice constant must be of type int or float.")
|
||
|
|
||
|
return symbol, atomic_number, lattice_constant
|