def _parse_cpmd_atoms_block(lines, line_idx, parsed):
    """Add to ``parsed`` ``cpmd_atom_to_line_idx``.

    ``cpmd_atom_to_line_idx`` is a Dict[int, int] that associates a CPMD atom
    index to the line number where its coordinates are stored.

    Parameters
    ----------
    lines : List[str]
        The lines of the entire file as read by file.readlines().
    line_idx : int
        The index of the first line after '&ATOMS'.
    parsed : Dict
        A memo dictionary where the parsed info is saved.

    Returns
    -------
    line_idx : int
        The line index right after the '&END' directive of the '&MIMIC' block.

    """
    parsed['cpmd_atom_to_line_idx'] = {}

    current_atom_idx = 0
    while line_idx < len(lines):
        line = lines[line_idx].strip()

        if line.startswith('*'):
            # New atom type. First line is nonlocality, second is number of atoms.
            n_atoms = int(lines[line_idx+2])

            # Add the atoms to the map.
            line_idx += 3
            for element_atom_idx in range(n_atoms):
                parsed['cpmd_atom_to_line_idx'][current_atom_idx] = line_idx+element_atom_idx
                current_atom_idx += 1

            line_idx += n_atoms
        elif line.startswith('&END'):
            break
        else:
            # Empty line.
            line_idx += 1

    return line_idx + 1