def extract_prep_residue(filename):
    """
    Extract residue name and atom name/type mapping from input prep file.
    Note: Only one residue must be present.

    Parameters
    ----------
    filename: Path
        Filename of the input prep file.

    Returns
    -------
    dict
        key = residue name, value = atom name to type mapping (dict).

    """

    res_name = None
    res_atom_to_type = {}

    with open(filename) as prep_file:

        line_no = 0

        for line in prep_file:

            if line_no == 4:
                res_name = line.split()[0]

            elif line_no > 9:

                if len(line.strip()) == 0:
                    break

                cols = line.split()

                res_atom_to_type[cols[1]] = cols[2]

            line_no += 1

    return {res_name: res_atom_to_type}