function dipoleMoment = obtainDipoleMoment(dminpu,wavefunc) % position = dminpu(:,1); dm_temp = dminpu(:,2);   dipoleMoment = zeros(size(wavefunc,2),1); for ii = 1:size(wavefunc,2) dipoleMoment(ii) = trapz(position, ... conj(wavefunc(:,ii)).*dm_temp.*wavefunc(:,ii)); end end