Confused about someting in the cdft newt subroutine


Clicked A Few Times
So I have been trying to do cdft and have been running into terrible convergence issues and have been trying to better understand the code by reading the source code. In reviewing the cdft_newt subroutine in cdft_util.F I am confused about the following.

       do i = 1, nconstr
grad_old(i) = grad(i)
p(i) = -grad(i)
enddo

       c use svd in case there are redundant constraints
do i = 1, nconstr
p(i) = 0.d0
enddo


Why is p(i) initialized to -grad(i) in the first loop then immediately initialized to zero in the second loop?

thanks,
Jason


Forum >> NWChem's corner >> Feedback