Skip to content

Commit

Permalink
Add D4 parameters for RSHs (dftd4#220)
Browse files Browse the repository at this point in the history
Add: LC-wPBE, LC-wPBEh, CAM-QTP(01), wB97M-rev, wB97X-rev, wB97X-3c, r2SCAN-3c
  • Loading branch information
marvinfriede authored Nov 13, 2023
1 parent 0627ec8 commit ea1311b
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 73 deletions.
4 changes: 4 additions & 0 deletions app/05-r2scan3c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "3.6.0",
"energy": -9.8497530849906E-03
}
4 changes: 4 additions & 0 deletions app/06-r2scan3c-mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "3.6.0",
"energy": -7.4859260608873E-03
}
2 changes: 2 additions & 0 deletions app/cli.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module dftd4_cli
logical :: tmer = .true.
logical :: properties = .false.
logical :: mbdscale = .false.
logical :: zeta = .false.
logical :: grad = .false.
logical :: hessian = .false.
character(len=:), allocatable :: grad_output
Expand Down Expand Up @@ -238,6 +239,7 @@ subroutine get_run_arguments(config, list, start, error)
iarg = iarg + 1
call get_argument_as_real(iarg, config%gc, error)
if (allocated(error)) exit
config%zeta = .true.
case("--wfactor")
iarg = iarg + 1
call get_argument_as_real(iarg, config%wf, error)
Expand Down
29 changes: 25 additions & 4 deletions app/driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module dftd4_driver
use dftd4_utils
use dftd4_cli, only : cli_config, param_config, run_config
use dftd4_help, only : header
use dftd4_param, only : functional_group, get_functionals
use dftd4_param, only : functional_group, get_functionals, &
get_functional_id, p_r2scan_3c
implicit none
private

Expand Down Expand Up @@ -68,14 +69,16 @@ subroutine run_main(config, error)

type(structure_type) :: mol
character(len=:), allocatable :: filename
character(len=:), allocatable :: functional
class(damping_param), allocatable :: param
type(d4_model) :: d4
real(wp) :: charge
real(wp), allocatable :: energy, gradient(:, :), sigma(:, :), hessian(:, :, :, :)
real(wp), allocatable :: pair_disp2(:, :), pair_disp3(:, :)
real(wp), allocatable :: cn(:), q(:), c6(:, :), alpha(:)
real(wp), allocatable :: s9
integer :: stat, unit
real(wp) :: ga, gc
integer :: stat, unit, is, id
logical :: exist

if (config%verbosity > 1) then
Expand Down Expand Up @@ -116,12 +119,30 @@ subroutine run_main(config, error)
call wrap_to_central_cell(mol%xyz, mol%lattice, mol%periodic)
end if

ga = config%ga
gc = config%gc
if (config%mbdscale) s9 = config%inp%s9
if (config%rational) then
if (config%has_param) then
param = config%inp
else
call get_rational_damping(config%method, param, s9)
is = index(config%method, '/')
if (is == 0) is = len_trim(config%method) + 1
functional = lowercase(config%method(:is-1))
id = get_functional_id(functional)

! special case: r2SCAN-3c (modifies s9, ga, gc)
if (id == p_r2scan_3c) then
if (.not.config%mbdscale) then
s9 = 2.0_wp
end if
if (.not.config%zeta) then
ga = 2.0_wp
gc = 1.0_wp
end if
end if

call get_rational_damping(functional, param, s9)
if (.not.allocated(param)) then
call fatal_error(error, "No parameters for '"//config%method//"' available")
return
Expand All @@ -143,7 +164,7 @@ subroutine run_main(config, error)
end if
end if

call new_d4_model(error, d4, mol, ga=config%ga, gc=config%gc, wf=config%wf)
call new_d4_model(error, d4, mol, ga=ga, gc=gc, wf=config%wf)
if (allocated(error)) return

if (config%properties) then
Expand Down
42 changes: 42 additions & 0 deletions app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,45 @@ test(
'--func', 'b3lyp',
],
)

# r2SCAN-3c modifies s9, ga, gc, hence, requiring additional tests:
# - selection via functional name
# - check if s9, ga, gc can still be modified when name is given
# - full manual specification via command line
test(
'app-r2scan3c',
app_tester,
args: [
dftd4_exe,
files('05-r2scan3c.json'),
files('04-caffeine.xyz'),
'--noedisp',
'--func', 'r2scan-3c',
],
)
test(
'app-r2scan3c-mod',
app_tester,
args: [
dftd4_exe,
files('06-r2scan3c-mod.json'),
files('04-caffeine.xyz'),
'--noedisp',
'--func', 'r2scan-3c',
'--zeta', '4.0', '5.0',
'--mbdscale', '1.0',
],
)
test(
'app-r2scan3c-cli',
app_tester,
args: [
dftd4_exe,
files('05-r2scan3c.json'),
files('04-caffeine.xyz'),
'--noedisp',
'--param', '1.0', '0.0', '0.42', '5.65',
'--mbdscale', '2.0',
'--zeta', '2.0', '1.0',
],
)
42 changes: 36 additions & 6 deletions assets/parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ d4.bj-eeq-atm = { s8=3.24571506, a1=0.50050454, a2=4.12346483, doi="10.1063/1.50
d4.bj-eeq-mbd = { s8=3.23137432, a1=0.49955226, a2=4.10411084, doi="10.1063/1.5090222" }

[parameter.camb3lyp]
reference.doi = ["10.1016/j.cplett.2004.06.011"]
d4.bj-eeq-atm = { s8=1.66041301, a1=0.40267156, a2=5.17432195, doi="10.1063/1.5090222" }
d4.bj-eeq-mbd = { s8=1.74407961, a1=0.40137870, a2=5.18731225, doi="10.1063/1.5090222" }

[parameter.camqtp01]
reference.doi = ["10.1063/1.4955497"]
d4.bj-eeq-atm = { s8=1.156, a1=0.461, a2=6.375, doi="10.1021/acs.jctc.3c00717" }

[parameter.dodblyp]
d4.bj-eeq-atm = { s6=0.4700, s8=1.31146043, a1=0.43407294, a2=4.27914360, doi="10.1063/1.5090222" }
d4.bj-eeq-mbd = { s6=0.4700, s8=1.17809956, a1=0.40252428, a2=4.25096555, doi="10.1063/1.5090222" }
Expand Down Expand Up @@ -157,9 +162,18 @@ d4.bj-eeq-atm = { s8=2.59538499, a1=0.42088944, a2=3.28193223, doi="10.1063/1.50
d4.bj-eeq-mbd = { s8=2.36461524, a1=0.41518379, a2=3.19365471, doi="10.1063/1.5090222" }

[parameter.lcblyp]
reference.doi = ["10.1063/1.1688752"]
d4.bj-eeq-atm = { s8=1.60344180, a1=0.45769839, a2=7.86924893, doi="10.1063/1.5090222" }
d4.bj-eeq-mbd = { s8=2.40109962, a1=0.47867438, a2=8.01038424, doi="10.1063/1.5090222" }

[parameter.lcwpbe]
reference.doi = ["10.1063/1.2954017", "10.1021/ct800530u"]
d4.bj-eeq-atm = { s8=1.170, a1=0.378, a2=4.816, doi="10.1021/acs.jctc.3c00717" }

[parameter.lcwpbeh]
reference.doi = ["10.1063/1.3073302"]
d4.bj-eeq-atm = { s8=1.318, a1=0.386, a2=5.010, doi="10.1021/acs.jctc.3c00717" }

[parameter.lh07ssvwn]
reference.doi = ["10.1016/j.cplett.2007.04.020"]
d4.bj-eeq-atm = { s8=3.16675531, a1=0.35965552, a2=4.31947614, doi="10.1063/1.5090222" }
Expand Down Expand Up @@ -351,16 +365,20 @@ reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077"]
d4.bj-eeq-atm = { s8=0.60187490, a1=0.51559235, a2=5.77342911, doi="10.1063/5.0041008" }

[parameter.r2scanh]
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.26434/chemrxiv-2021-cn8lp"]
d4.bj-eeq-atm = {s8=0.8324, a1=0.4944, a2=5.9019, doi="10.26434/chemrxiv-2021-cn8lp"}
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.1063/5.0086040"]
d4.bj-eeq-atm = { s8=0.8324, a1=0.4944, a2=5.9019, doi="10.1063/5.0086040" }

[parameter.r2scan0]
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.26434/chemrxiv-2021-cn8lp"]
d4.bj-eeq-atm = {s8=0.8992, a1=0.4778, a2=5.8779, doi="10.26434/chemrxiv-2021-cn8lp"}
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.1063/5.0086040"]
d4.bj-eeq-atm = { s8=0.8992, a1=0.4778, a2=5.8779, doi="10.1063/5.0086040" }

[parameter.r2scan50]
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.26434/chemrxiv-2021-cn8lp"]
d4.bj-eeq-atm = {s8=1.0471, a1=0.4574, a2=5.8969, doi="10.26434/chemrxiv-2021-cn8lp"}
reference.doi = ["10.1021/acs.jpclett.0c02405", "10.1021/acs.jpclett.0c03077", "10.1063/5.0086040"]
d4.bj-eeq-atm = { s8=1.0471, a1=0.4574, a2=5.8969, doi="10.1063/5.0086040" }

[parameter.r2scan-3c]
reference.doi = ["10.1063/5.0040021"]
d4.bj-eeq-atm = { s8=0.00, a1=0.42, a2=5.65, s9=2.0, doi="10.1063/5.0040021" }

[parameter.tpss0]
d4.bj-eeq-atm = { s8=1.62438102, a1=0.40329022, a2=4.80537871, doi="10.1063/1.5090222" }
Expand Down Expand Up @@ -389,6 +407,14 @@ reference.doi = ["10.1063/1.2834918"]
d4.bj-eeq-atm = { s8=-0.07519516, a1=0.45094893, a2=6.78425255, doi="10.1063/1.5090222" }
d4.bj-eeq-mbd = { s8=0.38815338, a1=0.47448629, a2=6.91367384, doi="10.1063/1.5090222" }

[parameter.wb97x-rev]
reference.doi = ["10.1063/1.4952647"]
d4.bj-eeq-atm = { s8=0.4485, a1=0.3306, a2=4.279, doi="10.1063/5.0133026" }

[parameter.wb97x-3c]
reference.doi = ["10.1063/5.0133026"]
d4.bj-eeq-atm = { s8=0.0, a1=0.2464, a2=4.737, doi="10.1063/5.0133026" }

[parameter.b97m]
reference.doi = ["10.1063/1.4907719"]
d4.bj-eeq-atm = { s8=0.6633, a1=0.4288, a2=3.9935, doi="10.1002/jcc.26411" }
Expand All @@ -397,6 +423,10 @@ d4.bj-eeq-atm = { s8=0.6633, a1=0.4288, a2=3.9935, doi="10.1002/jcc.26411" }
reference.doi = ["10.1063/1.4952647"]
d4.bj-eeq-atm = { s8=0.7761, a1=0.7514, a2=2.7099, doi="10.1002/jcc.26411" }

[parameter.wb97m-rev]
reference.doi = ["10.1063/1.4952647"]
d4.bj-eeq-atm = { s8=0.842, a1=0.359, a2=4.668 , doi="10.1021/acs.jctc.3c00717" }

[parameter.x3lyp]
d4.bj-eeq-atm = { s8=1.54701429, a1=0.20318443, a2=5.61852648, doi="10.1063/1.5090222" }
d4.bj-eeq-mbd = { s8=1.55067492, a1=0.19818545, a2=5.61262748, doi="10.1063/1.5090222" }
Expand Down
Loading

0 comments on commit ea1311b

Please sign in to comment.