function [u] = v2f_scalar(r1, r2, theta, beta, a, s)
% Integrand for the two-jump interaction potential.
% function [u] = v2f_scalar(r1, r2, theta, beta, a, s)
% All arguments must be scalars.
% The return value u is a scalar.

	if (s == 0)
		u = 0;
		return;
	end
	if (s == 1)
		u = 0;
		return;
	end

	r12  = r1^2;
	r22  = r2^2;
	nmxy2 = r1^2 + r2^2 - 2 * r1 * r2 * cos(theta);

	A = r12 / 8 / beta;
	B = r22 / 8 / beta;

	T1 = 1.0 / sqrt(8*pi*beta);
	T2 = exp(nmxy2/8/beta);
	T1_a_T2 = T1 * a * T2;
	T3 = 1.0 / ((s*(1-s))^(1.5));
	T4 = exp(-A/s);
	T5 = exp(-B/(1-s));

	u = T1_a_T2 * T3 * T4 * T5;
	return
end

% theta = pi/4
% beta = 1
% a = 0.1

%   r 1    2         3     4
% s
% 0.1 0.1982 0.0038 0.0000 0.0000
% 0.2 0.1535 0.0184 0.0005 0.0000
% 0.3 0.1230 0.0257 0.0019 0.0000
