def molpro_parser(filename):
    """ Parses energies from molpro output files
    """
    with open(filename) as f:
        lines = f.readlines()

    if not lines[-1].startswith(" Molpro calculation terminated"):
        print(f"error reading {filename}")
        return 0

    return float(lines[-3].split()[0])