function [dxdt]=pvt_dxdt(t,x);
%% 
%    UMD AOSC 615   SPRING 2009
%   dxdt for point vortex model with tracers 

%% global
% ode_prmtr=[Nv Nt];
global ode_prmtr

%% setup
Nv=round(ode_prmtr(1)); Nt=round(ode_prmtr(2));
dxdt=zeros(size(x));

%% dxdt
if(Nv>1); 
    for n=1:Nv-1; n2=2*n; n1=n2-1;    nv=2*(Nv+Nt)+n;
        for k=n+1:Nv; k2=2*k; k1=k2-1; kv=2*(Nv+Nt)+k;
            dxnk=x(n1:n2)-x(k1:k2);
            r2nk=dxnk'*dxnk; 
            dxdtnk=[-dxnk(2); dxnk(1)]/r2nk;
            dxdt(n1:n2)=dxdt(n1:n2)+x(kv)*dxdtnk;
            dxdt(k1:k2)=dxdt(k1:k2)-x(nv)*dxdtnk;
        end
    end
end
if(Nv>0);
    for n=1:Nv; n2=2*n; n1=n2-1;             nv=2*(Nv+Nt)+n;
        for k=1:Nt; k2=2*(k+Nv); k1=k2-1; kv=3*Nv+2*Nt+k;
            dxnk=x(n1:n2)-x(k1:k2);
            r2nk=dxnk'*dxnk; 
            dxdtnk=[-dxnk(2); dxnk(1)]/r2nk;
            dxdt(k1:k2)=dxdt(k1:k2)-x(nv)*dxdtnk;
        end
    end    
end

return