I found that for dftd4_load_rational_damping function, if the third argument (mdb in C, atm in Fortran) is false, s9 will still be set to 1.0. Could you help check whether this is a bug?
Traceback
-
C-API Layer (include/dftd4.h):
The function signature is dftd4_load_rational_damping(..., bool mdb).
-
Fortran API Layer (src/dftd4/api.f90):
The C function calls load_rational_damping_api.
function load_rational_damping_api(verror, charptr, atm)
...
logical(c_bool), value, intent(in) :: atm
real(wp), allocatable :: s9
...
if (atm) s9 = 1.0_wp
call get_rational_damping(method, tmp, s9)
If atm (the third argument) is false, the variable s9 remains unallocated.
-
Parameter Retrieval (src/dftd4/param.f90):
The get_rational_damping interface calls get_rational_damping_name, which calls get_rational_damping_id.
Since s9 was unallocated in the caller, it is treated as not present in the optional arguments chain.
In get_rational_damping_id:
mbd = .true.
if (present(s9)) mbd = abs(s9) > epsilon(s9)
Because s9 is not present, mbd defaults to .true.. This triggers the call to get_d4eeq_bjatm_parameter.
-
Default Value Assignment:
Inside get_d4eeq_bjatm_parameter, the helper function dftd_param is called without s9.
pure function dftd_param(..., s9)
...
s9_ = 1.0_wp
if (present(s9)) s9_ = s9
Since s9 is missing, it defaults to 1.0.
I found that for
dftd4_load_rational_dampingfunction, if the third argument (mdbin C,atmin Fortran) is false,s9will still be set to 1.0. Could you help check whether this is a bug?Traceback
C-API Layer (
include/dftd4.h):The function signature is
dftd4_load_rational_damping(..., bool mdb).Fortran API Layer (
src/dftd4/api.f90):The C function calls
load_rational_damping_api.If
atm(the third argument) isfalse, the variables9remains unallocated.Parameter Retrieval (
src/dftd4/param.f90):The
get_rational_dampinginterface callsget_rational_damping_name, which callsget_rational_damping_id.Since
s9was unallocated in the caller, it is treated as not present in the optional arguments chain.In
get_rational_damping_id:Because
s9is not present,mbddefaults to.true.. This triggers the call toget_d4eeq_bjatm_parameter.Default Value Assignment:
Inside
get_d4eeq_bjatm_parameter, the helper functiondftd_paramis called withouts9.Since
s9is missing, it defaults to 1.0.