def _group_energy_terms(stdout):
    """Parse LAMMPS stdout to extract and group the energy terms in a dict. """

    lines = stdout.split("\n")
    line_nbr = [item.startswith('Step') for item in lines].index(True)
    k = lines[line_nbr].split()[1:]
    v = [float(item) for item in lines[line_nbr + 1].split()[1:]]
    return dict(zip(k, v))