import re


def _parse_potcar(potcar_file):
    """Looks for element symbols in POTCAR

    Parameters
    ----------
    potcar_file : str
        Path to POTCAR file

    Returns
    -------
    elements : list of str
        List of element symbols
    """
    # Look for elements in POTCAR
    elements = []
    with open(potcar_file, "r") as f:
        element_re = re.compile('TITEL.*')
        match = None
        for line in f:
            match = element_re.search(line)
            if match:
                elements.append(match.group().split()[3].split('_')[0])
    return elements