utils

javelin.utils.get_atomic_number_symbol(Z=None, symbol=None)[source]

This function returns a tuple of matching arrays of atomic numbers (Z) and chemical symbols (symbol).

Parameters:
  • Z (int, array like object of int's) – atomic numbers
  • symbol (str, array like object of str) – chemical symbols
Returns:

arrays of atomic numbers and chemical symbols

Return type:

tuple of numpy.ndarray

Note: If both Z and symbol are provided the symbol will win out and change the Z to match.

Examples:
>>> Z, symbol = get_atomic_number_symbol(Z=[12, 24, 26, 48])
>>> print(Z)
[12 24 26 48]
>>> print(symbol)  # doctest: +ALLOW_UNICODE
['Mg' 'Cr' 'Fe' 'Cd']
>>> Z, symbol = get_atomic_number_symbol(symbol=['C', 'H', 'N', 'O'])
>>> print(Z)
[6 1 7 8]
>>> print(symbol)
['C' 'H' 'N' 'O']
javelin.utils.get_atomic_numbers(structure)[source]

Wrapper to get the atomic numbers from different structure classes

javelin.utils.get_positions(structure)[source]

Wrapper to get the positions from different structure classes

javelin.utils.get_unitcell(structure)[source]

Wrapper to get the unit cell from different structure classes

javelin.utils.is_structure(structure)[source]

Check if an object is a structure that javelin can understand.

ase.atoms with have cell, get_scaled_positions and get_atomic_numbers attributes diffpy.structure with have lattice, xyz, and element attributes