From 6f0fbb1f4f7e86ffccd73e39a5c8049d528e4f3a Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 26 Jan 2026 15:37:14 +0800 Subject: [PATCH] fix base value for even k recursion in grid_ik fix the problem in issue 1233 https://github.com/nwchemgit/nwchem/issues/1233#issue-3854751518 --- src/nwdft/grid/grid_rtrunc.F | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/nwdft/grid/grid_rtrunc.F b/src/nwdft/grid/grid_rtrunc.F index 18cc7d72ba..fc2a3f6ad2 100644 --- a/src/nwdft/grid/grid_rtrunc.F +++ b/src/nwdft/grid/grid_rtrunc.F @@ -246,8 +246,10 @@ c if (ilo .eq. 0) then dexpo=sqrt(alpha)*r if(dexpo.gt.40d0) then + valexp=0d0 value=0d0 else + valexp=exp(-alpha*r*r) #if defined(WIN32) ||defined(LINUX) value = 0.5d0*sqrt(4.0d0*atan(1.0d0)/alpha)* $ derfc(dexpo) @@ -256,13 +258,14 @@ c $ erfc(dexpo) #endif endif - endif - if(alpha*r*r.gt.500d0) then - valexp=0d0 - value =0d0 else - valexp=exp(-alpha*r*r) - value =valexp/(2.0d0*alpha) + if(alpha*r*r.gt.500d0) then + valexp=0d0 + value =0d0 + else + valexp=exp(-alpha*r*r) + value =valexp/(2.0d0*alpha) + endif endif c do i = ilo+2,k,2