def format_nmmpmat(denmat):
    """
    Format a given 7x7 complex numpy array into the format for the n_mmp_mat file

    Results in list of 14 strings. Every 2 lines correspond to one row in array
    Real and imaginary parts are formatted with 20.13f in alternating order

    :param denmat: numpy array (7x7) and complex for formatting

    :raises ValueError: If denmat has wrong shape or datatype

    :returns: list of str formatted in lines for the n_mmp_mat file
    """

    if denmat.shape != (7, 7):
        raise ValueError(f'Matrix has wrong shape for formatting: {denmat.shape}')

    if denmat.dtype != complex:
        raise ValueError(f'Matrix has wrong dtype for formatting: {denmat.dtype}')

    #Now we generate the text in the format expected in the n_mmp_mat file
    nmmp_lines = []
    for row in denmat:

        nmmp_lines.append(''.join([f'{x.real:20.13f}{x.imag:20.13f}' for x in row[:3]]) + f'{row[3].real:20.13f}')
        nmmp_lines.append(f'{row[3].imag:20.13f}' + ''.join([f'{x.real:20.13f}{x.imag:20.13f}' for x in row[4:]]))

    return nmmp_lines