Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/argument.f90
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ recursive subroutine get_response_file(self, resp, stat)
call push_back(self, arg)
end do
close(unit, iostat=stat)
if (info /= 0) then
if (stat == 0 .and. info /= 0) then
stat = merge(0, info, is_iostat_end(info))
end if
end subroutine get_response_file
Expand All @@ -207,7 +207,7 @@ subroutine getline(unit, line, iostat, iomsg)
!> Status of operation
integer, intent(out) :: iostat
!> Error message
character(len=:), allocatable, optional :: iomsg
character(len=:), allocatable, optional, intent(out) :: iomsg

integer, parameter :: bufsize = 512
character(len=bufsize) :: buffer, msg
Expand Down
4 changes: 2 additions & 2 deletions app/cli.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ subroutine get_argument_as_real(arg, val, error)
!> Real value
real(wp), intent(out) :: val
!> Error handling
type(error_type), allocatable :: error
type(error_type), allocatable, intent(out) :: error

integer :: stat

Expand All @@ -124,7 +124,7 @@ end subroutine get_argument_as_real
subroutine get_argument_as_integer_list(arg, vals, error)
character(len=:), intent(in), allocatable :: arg
integer, allocatable, intent(out) :: vals(:)
type(error_type), allocatable :: error
type(error_type), allocatable, intent(out) :: error

integer :: pos, stat
integer, allocatable :: tmp(:)
Expand Down
2 changes: 2 additions & 0 deletions app/toml.f90
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ subroutine get(self, param, method, damping)
call new_cso_damping(tmp, record%param)
call move_alloc(tmp, param)
end block
case default
continue
end select
end associate
end subroutine get
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/first-steps-fortran/src/scan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ end subroutine get_dispersion_for_reaction
subroutine scan_param_for_reaction(error, reaction, method, dft_energy)
use dftd3, only : d3_param
use mctc_env, only : error_type, fatal_error
type(error_type), allocatable :: error
type(error_type), allocatable, intent(out) :: error
type(reaction_type), intent(in) :: reaction
character(*), intent(in) :: method
real(wp), intent(in), optional :: dft_energy
Expand Down
10 changes: 1 addition & 9 deletions fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ main = "api-test.c"
ignore = [
"C002", # interface without implicit none
"C003", # implicit none(external)
"C011", # no default in select case
"C061", # missing intent attribute
"C071", # assumed size
"C072", # assumed size character intent
"C081", # implicit save
"C121", # use without explicit only
"C122", # intrinsic missing for internal modules
"C131", # default module accessibility
"C181", # iostat not checked
]
per-file-ignores."src/dftd3/api.f90" = ["C071", "C072"]
line-length = 132
3 changes: 2 additions & 1 deletion src/dftd3/api.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
!>{!./include/s-dftd3.h!}
!>```
module dftd3_api
use, intrinsic :: iso_c_binding, only : c_associated, c_bool, c_char, c_double, &
& c_f_pointer, c_int, c_loc, c_null_char, c_null_ptr, c_ptr
use dftd3_cutoff, only : realspace_cutoff
use dftd3_damping, only : damping_param
use dftd3_damping_cso, only : cso_damping_param, new_cso_damping
Expand All @@ -37,7 +39,6 @@ module dftd3_api
& get_cso_damping, get_z_damping
use dftd3_utils, only : wrap_to_central_cell
use dftd3_version, only : get_dftd3_version
use iso_c_binding
use mctc_env, only : wp, error_type, fatal_error
use mctc_io_structure, only : structure_type, new
implicit none
Expand Down
2 changes: 2 additions & 0 deletions src/dftd3/citation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ pure function get_citation(doi) result(citation)
pages="2506.14665", &
year="2025" &
)
case default
continue
end select
end function get_citation

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/cutoff.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
module dftd3_cutoff
use mctc_env, only : wp
implicit none
private

public :: realspace_cutoff, get_lattice_points, smooth_cutoff

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module dftd3_damping
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: damping_param, dispersion_interface

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/atm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module dftd3_damping_atm
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: get_atm_dispersion, get_atm_pairwise_dispersion

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/cso.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_cso
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: cso_damping_param, new_cso_damping

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/mzero.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_mzero
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: mzero_damping_param, new_mzero_damping

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/optimizedpower.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_optimizedpower
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: optimizedpower_damping_param, new_optimizedpower_damping

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/rational.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_rational
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: rational_damping_param, new_rational_damping

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/z.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_z
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: z_damping_param, new_z_damping

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/damping/zero.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module dftd3_damping_zero
use mctc_env, only : wp
use mctc_io, only : structure_type
implicit none
private

public :: zero_damping_param, new_zero_damping

Expand Down
89 changes: 60 additions & 29 deletions src/dftd3/gcp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,15 @@ end subroutine srb_deriv
!* Inspired by mopac7.0
!******************************************************************************
subroutine ssovl(r, iat, jat, iz, xza, xzb, ovl)
real(wp), intent(in) :: r
integer, intent(in) :: iat, jat
integer, intent(in) :: iz(:)
real(wp), intent(in) :: xza, xzb
real(wp), intent(out) :: ovl

integer :: ii, shell(72)
logical :: debug
real(wp) :: za, zb, R, ovl, ax, bx, norm, R05
real(wp) :: za, zb, ax, bx, norm, R05
integer :: na, nb
real(wp) :: xx
data shell/ &
Expand All @@ -501,8 +507,6 @@ subroutine ssovl(r, iat, jat, iz, xza, xzb, ovl)
! k-rn , no f-elements
54*3/
! ...
real(wp) :: xza, xzb
integer :: iat, jat, iz(*)

za = xza
zb = xzb
Expand Down Expand Up @@ -580,6 +584,8 @@ subroutine ssovl(r, iat, jat, iz, xza, xzb, ovl)
norm = sqrt((ZA*ZB*R*R)**7)/480.0d0
ovl = norm*(A6(ax)*Bint(bx, 0)-3.0d0*(A4(ax)*Bint(bx, 2) &
& -A2(ax)*Bint(bx, 4))-A0(ax)*Bint(bx, 6))/3.0_wp
case default
error stop "invalid shell combination in ssovl"
end select
else ! different elements
select case (ii)
Expand Down Expand Up @@ -634,6 +640,8 @@ subroutine ssovl(r, iat, jat, iz, xza, xzb, ovl)
case(9) ! <3s|3>
norm = sqrt((ZA*ZB*R*R)**7)/1440.0d0
ovl = norm*(A6(ax)*B0(bx)-3.0d0*(A4(ax)*B2(bx)-A2(ax)*B4(bx))-A0(ax)*B6(bx))
case default
error stop "invalid shell combination in ssovl"
end select
end if
end subroutine ssovl
Expand Down Expand Up @@ -851,7 +859,8 @@ end function bint
! faculty function
integer(wp) function fact(N)
implicit none
integer :: j, n
integer, intent(in) :: n
integer :: j
fact = 1
do j = 2, n
fact = fact*j
Expand All @@ -870,9 +879,15 @@ subroutine gsovl(r, iat, jat, iz, xza, xzb, g)
! za = slater exponent atom A
! zb = slater exponent atom B
! R = distance between atom A and B
real(wp), intent(in) :: r
integer, intent(in) :: iat, jat
integer, intent(in) :: iz(:)
real(wp), intent(in) :: xza, xzb
real(wp), intent(out) :: g

integer :: ii, shell(72)
logical :: debug
real(wp) :: ax, bx, R05, za, zb, R
real(wp) :: ax, bx, R05, za, zb
integer :: na, nb
data shell/ &
! h, he
Expand All @@ -885,11 +900,9 @@ subroutine gsovl(r, iat, jat, iz, xza, xzb, g)
! k-rn , no f-elements
54*3/
! ...
real(wp) :: g, Fa, Fb
real(wp) :: Fa, Fb
!--------------------- set exponents ---------------------------------------
real(wp) :: xza, xzb
real(wp) :: xx
integer :: iat, jat, iz(*)
logical :: lsame

za = xza
Expand Down Expand Up @@ -952,6 +965,8 @@ subroutine gsovl(r, iat, jat, iz, xza, xzb, g)
end if
case(9)
call g3s3s(za, zb, Fa, Fb, R, g, lsame)
case default
error stop "invalid shell combination in gsovl"
end select
else ! different elements
lsame = .false.
Expand Down Expand Up @@ -989,6 +1004,8 @@ subroutine gsovl(r, iat, jat, iz, xza, xzb, g)
end if
case(9) ! <3s|3>
call g3s3s(za, zb, Fa, Fb, R, g, lsame)
case default
error stop "invalid shell combination in gsovl"
end select
end if

Expand All @@ -1005,9 +1022,10 @@ subroutine g1s1s(za, zb, Fa, Fb, R, g, sameElement)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R
logical :: sameElement
real(wp), intent(in) :: za, zb, Fa, Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
logical, intent(in) :: sameElement

if(sameElement) then
t1 = za ** 2
Expand Down Expand Up @@ -1059,10 +1077,13 @@ subroutine g2s1s(za, zb, Fa, Fb, R, g, switch, lsame)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R, norm
logical :: switch
logical :: lsame
real(wp), intent(in) :: za, zb, Fa
real(wp), intent(inout) :: Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
real(wp) :: norm
logical, intent(in) :: switch
logical, intent(in) :: lsame
norm = (1d0/24d0)*sqrt(za**3*zb**5*3d0)

if(switch) then
Expand Down Expand Up @@ -1123,9 +1144,11 @@ subroutine g2s2s(za, zb, Fa, Fb, R, g, SameElement)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R, norm
logical :: SameElement
real(wp), intent(in) :: za, zb, Fa, Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
real(wp) :: norm
logical, intent(in) :: SameElement

norm = 1d0/(16d0*3d0)*SQRT((ZA*ZB)**5)

Expand Down Expand Up @@ -1191,10 +1214,13 @@ subroutine g1s3s(za, zb, Fa, Fb, R, g, switch, lsame)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R, norm
logical :: switch
logical :: lsame
real(wp), intent(in) :: za, zb, Fa
real(wp), intent(inout) :: Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
real(wp) :: norm
logical, intent(in) :: switch
logical, intent(in) :: lsame

if(switch) Fb = -Fb

Expand Down Expand Up @@ -1263,10 +1289,13 @@ subroutine g2s3s(za, zb, Fa, Fb, R, g, switch, lsame)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R, norm
logical :: switch
logical :: lsame
real(wp), intent(in) :: za, zb, Fa
real(wp), intent(inout) :: Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
real(wp) :: norm
logical, intent(in) :: switch
logical, intent(in) :: lsame
norm = sqrt((za**5)*(zb**7)/7.5_wp)/96.0d0

if(switch) Fb = -Fb
Expand Down Expand Up @@ -1351,9 +1380,11 @@ subroutine g3s3s(za, zb, Fa, Fb, R, g, SameElement)
! derivative of explicit integral expression
! using maple
implicit real(wp) (t)
real(wp) :: za, zb, Fa, Fb
real(wp) :: g, R, norm
logical :: SameElement
real(wp), intent(in) :: za, zb, Fa, Fb
real(wp), intent(in) :: R
real(wp), intent(out) :: g
real(wp) :: norm
logical, intent(in) :: SameElement

norm = sqrt((ZA*ZB)**7)/1440.0d0

Expand Down
4 changes: 4 additions & 0 deletions src/dftd3/gcp/param.f90
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ subroutine get_gcp_param(param, mol, method, basis, eta)
eta_ = 1.4022_wp
param%alpha = 0.8055_wp
param%beta = 1.3000_wp
case default
continue
end select

case(p_sv_p_bas)
Expand Down Expand Up @@ -906,6 +908,8 @@ subroutine get_gcp_param(param, mol, method, basis, eta)
param%damp = .true.
end if

case default
continue
end select
if (allocated(nbas)) then
param%xv = nbas - 0.5_wp * nel
Expand Down
4 changes: 2 additions & 2 deletions src/dftd3/model.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
! along with s-dftd3. If not, see <https://www.gnu.org/licenses/>.

module dftd3_model
use, intrinsic :: ieee_arithmetic, only : ieee_is_nan
use dftd3_data, only : get_r4r2_val, get_vdw_rad
use dftd3_reference
use ieee_arithmetic, only : ieee_is_nan
use dftd3_reference, only : number_of_references, reference_cn, get_c6, init_reference_c6
use mctc_data, only : get_covalent_rad
use mctc_env, only : wp
use mctc_io, only : structure_type
Expand Down
Loading
Loading