function P1 = multiply_by_potential(P1, P2)
% MULTIPLY_BY_POTENTIAL (Dispatch) Compute P1 *= P2 for a generic potential.
% P1 = multiply_by_potential(P1, P2)

switch P1.type
  case 'd',
    P1 = multiply_by_table(P1, P2);
  case 'm',
    P1 = multiply_by_max_table(P1, P2);
  case 'g',
    P1 = multiply_by_gpot(P1, P2);
  case 'cg',
    P1 = multiply_by_cgpot(P1, P2);
  otherwise
    error(['bad type ' P1.type]);
end
