def decompose_atom_list(atom_list):
    """
    Return elements and/or atom ids and coordinates from an `atom list`.

    Depending on input type of an atom list (version 1 or 2)

        1. [[element, coordinates (x, y, z)], ...]
        2. [[element, atom key, coordinates (x, y, z)], ...]

    the function reverses what pywindow.utilities.compose_atom_list() do.

    Parameters
    ----------
    atom_list : list
        A nested list of lists (version 1 or 2)

    Returns
    -------
    touple
        A touple of elements and coordinates arrays, or if input contained
        atom ideas, also atom ids array.

    """
    transpose = list(zip(*atom_list))
    if len(transpose) == 4:
        elements = np.array(transpose[0])
        array_a = np.array(transpose[1]).reshape(-1, 1)
        array_b = np.array(transpose[2]).reshape(-1, 1)
        array_c = np.array(transpose[3]).reshape(-1, 1)
        array_ab = np.concatenate((array_a, array_b), axis=1)
        coordinates = np.concatenate((array_ab, array_c), axis=1)
        return elements, coordinates
    elif len(transpose) == 5:
        elements = np.array(transpose[0])
        atom_ids = np.array(transpose[1])
        array_a = np.array(transpose[2]).reshape(-1, 1)
        array_b = np.array(transpose[3]).reshape(-1, 1)
        array_c = np.array(transpose[4]).reshape(-1, 1)
        array_ab = np.concatenate((array_a, array_b), axis=1)
        coordinates = np.concatenate((array_ab, array_c), axis=1)
        return elements, atom_ids, coordinates
    else:
        raise _FunctionError(
            "The decompose_atom_list() function accepts only list of lists "
            " with only 4 or 5 items per sublist.")
def decompose_atom_list ( atom_list ) : transpose = list ( zip ( * atom_list ) ) if len ( transpose ) == 4 : elements = np . array ( transpose [ 0 ] ) array_a = np . array ( transpose [ 1 ] ) . reshape ( - 1 , 1 ) array_b = np . array ( transpose [ 2 ] ) . reshape ( - 1 , 1 ) array_c = np . array ( transpose [ 3 ] ) . reshape ( - 1 , 1 ) array_ab = np . concatenate ( ( array_a , array_b ) , axis = 1 ) coordinates = np . concatenate ( ( array_ab , array_c ) , axis = 1 ) return elements , coordinates elif len ( transpose ) == 5 : elements = np . array ( transpose [ 0 ] ) atom_ids = np . array ( transpose [ 1 ] ) array_a = np . array ( transpose [ 2 ] ) . reshape ( - 1 , 1 ) array_b = np . array ( transpose [ 3 ] ) . reshape ( - 1 , 1 ) array_c = np . array ( transpose [ 4 ] ) . reshape ( - 1 , 1 ) array_ab = np . concatenate ( ( array_a , array_b ) , axis = 1 ) coordinates = np . concatenate ( ( array_ab , array_c ) , axis = 1 ) return elements , atom_ids , coordinates else : raise _FunctionError ( "The decompose_atom_list() function accepts only list of lists " " with only 4 or 5 items per sublist." )
Return elements and/or atom ids and coordinates from an `atom list`.

    Depending on input type of an atom list (version 1 or 2)

        1. [[element, coordinates (x, y, z)], ...]
        2. [[element, atom key, coordinates (x, y, z)], ...]

    the function reverses what pywindow.utilities.compose_atom_list() do.

    Parameters
    ----------
    atom_list : list
        A nested list of lists (version 1 or 2)

    Returns
    -------
    touple
        A touple of elements and coordinates arrays, or if input contained
        atom ideas, also atom ids array.