145 real(real64),
allocatable,
intent(inout) :: dips(:, :)
146 real(real64),
allocatable :: weights(:), dips0(:, :), dips1(:, :)
147 real(real64) :: weight, weight_sum, re_d, im_d
148 integer :: i, j, iter, n0, n, d
152 allocate (weights(n), dips0(2, n), dips1(2, n))
156 weights(i) = exp(-sigma*(i - 1)**2)
163 if (any(dips(:, i) /= 0))
then
179 re_d = dips(1, j) - dips0(1, j)
180 im_d = dips(2, j) - dips0(2, j)
181 weight = weights(d) / sqrt(1 + re_d*re_d + im_d*im_d)
182 dips1(:, i) = dips1(:, i) + dips(:, j) * weight
183 weight_sum = weight_sum + weight
185 dips1(:, i) = dips1(:, i) / weight_sum