function VDk = VDcutoff(kr, kz, Rmax, Zmax, Nr) % makes the dipolar direct interaction matrix, size numel(kr) * numel(kz) % Rmax and Zmax are the interaction cutoffs. I use 4*(where the density goes to 10^-4 of its peak) % VDk needs to be multiplied by Cdd % approach is that of Lu, PRA 82, 023622 (2010) % blame Danny Baillie, 9 Aug 2011 % accuracy inputs for numerical integration if(nargin==4) Nr = 5e4; end Nz = 64; farRmultiple = 2000; % analytical transform without cutoff [KR, KZ]=ndgrid(kr,kz); Ksq = KR.^2 + KZ.^2; cossq = KZ.^2./Ksq; VDk = cossq-1/3; % analytical cutoff for slice 0