find_optimal_deltad Subroutine

public subroutine find_optimal_deltad(p, f, coef)

This subroutines returns a set of coefficients for 'optimal' representing the current Density matrix F%D as a linear combination of the saved density matrices in the F%Dsave array F%D(:,:) = sum_i coef(i) * F%Dsave(:,:,i) + deltaD(:,:) 'optimal' means that the rest is small in that sense that it has minimal number of nonzero elements. To achieve this, we use unconstrained Newton minimizer to minimize the function

sum_{i<=j} ( 1 - f( (D_{i,j} - sum_k c_k * Dsave_{i,j,k})^2 - eps^2 ) )

with respect to the coefficients c_k where f is the fermi function

    f=1/(1+exp(x/T))

with some chosen temperature T

Arguments

Type IntentOptional Attributes Name
type(param), intent(in) :: p
type(wf_data), intent(in) :: f
real(kind=long), intent(inout), dimension(f%nsave) :: coef