% Compare volumes between replica-exchange and no swaps.

clear;

nequil = 250;

volumes_allswap = textread('data-allswap/volumes.out');
volumes_noswap = textread('data-noswap/volumes.out');

% Determine number of states.
nstates = size(volumes_allswap,2);
nsamples = size(volumes_allswap,1);

% Determine statistical inefficiencies.
g_allswap = zeros(nstates,1);
g_noswap = zeros(nstates,1);
for i = 1:nstates
  g_allswap(i) = statistical_inefficiency(volumes_allswap(nequil:end,i));
  g_noswap(i) = statistical_inefficiency(volumes_noswap(nequil:end,i));
end

for i = 1:nstates
  V_i_allswap(i) = mean(volumes_allswap(nequil:end,i));
  dV_i_allswap(i) = std(volumes_allswap(nequil:end,i)) / sqrt(nsamples / g_allswap(i));

  V_i_noswap(i) = mean(volumes_noswap(nequil:end,i));
  dV_i_noswap(i) = std(volumes_noswap(nequil:end,i)) / sqrt(nsamples / g_noswap(i));    
end

clf;


errorbar(V_i_allswap, 2*dV_i_allswap, 'r.');
hold on;
errorbar(V_i_noswap, 2*dV_i_noswap, 'g.');
legend('repex', 'standard');

