Skip to content

Commit

Permalink
Add citations for damping parameters (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk authored Sep 29, 2024
1 parent dd8e4a5 commit 202a6ba
Show file tree
Hide file tree
Showing 9 changed files with 972 additions and 27 deletions.
14 changes: 14 additions & 0 deletions app/cli.f90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ module dftd3_app_cli
logical :: has_param = .false.
integer :: verbosity = 2
logical :: pair_resolved = .false.
logical :: citation = .false.
character(len=:), allocatable :: citation_output
!> Parameter data base
character(len=:), allocatable :: db
end type run_config
Expand Down Expand Up @@ -212,6 +214,18 @@ subroutine get_run_arguments(config, list, start, error)
end if
call move_alloc(arg, config%json_output)
end if
case("--citation")
config%citation = .true.
config%citation_output = "dftd3.bib"
iarg = iarg + 1
call list%get(iarg, arg)
if (allocated(arg)) then
if (arg(1:1) == "-") then
iarg = iarg - 1
cycle
end if
call move_alloc(arg, config%citation_output)
end if
case("--property")
config%properties = .true.
case("--pair-resolved")
Expand Down
54 changes: 45 additions & 9 deletions app/driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ module dftd3_app_driver
use, intrinsic :: iso_fortran_env, only : output_unit, input_unit
use mctc_env, only : wp, error_type, fatal_error
use mctc_io, only : structure_type, read_structure, filetype, get_filetype
use dftd3
use dftd3_output
use dftd3_utils
use dftd3, only : damping_param, d3_param, d3_model, get_coordination_number, &
& get_dispersion, get_zero_damping, zero_damping_param, new_zero_damping, &
& get_rational_damping, rational_damping_param, new_rational_damping, &
& get_mzero_damping, mzero_damping_param, new_mzero_damping, get_mrational_damping, &
& get_optimizedpower_damping, optimizedpower_damping_param, &
& new_optimizedpower_damping, new_d3_model, get_pairwise_dispersion, &
& realspace_cutoff, get_lattice_points
use dftd3_output, only : ascii_damping_param, ascii_atomic_radii, &
& ascii_atomic_references, ascii_system_properties, ascii_energy_atom, &
& ascii_results, ascii_pairwise, tagged_result, json_results, &
& turbomole_gradient, turbomole_gradlatt
use dftd3_utils, only : wrap_to_central_cell
use dftd3_citation, only : format_bibtex, is_citation_present, citation_type, &
& get_citation, doi_dftd3_0, doi_dftd3_bj, doi_dftd3_m, doi_dftd3_op, same_citation
use dftd3_app_help, only : header
use dftd3_app_cli, only : app_config, run_config, param_config, get_arguments
use dftd3_app_toml, only : param_database
Expand Down Expand Up @@ -55,8 +66,10 @@ subroutine run_driver(config, error)
real(wp), allocatable :: pair_disp2(:, :), pair_disp3(:, :)
real(wp), allocatable :: s9
real(wp) :: energy
integer :: stat, unit
character(len=:), allocatable :: output
integer :: stat, unit, idx
logical :: exist
type(citation_type) :: citation, param_citation

if (config%verbosity > 1) then
call header(output_unit)
Expand All @@ -79,11 +92,12 @@ subroutine run_driver(config, error)
if (config%has_param) inp = config%inp
if (config%atm) s9 = config%inp%s9
if (config%zero) then
citation = get_citation(doi_dftd3_0)
if (.not.config%has_param) then
if (allocated(config%db)) then
call from_db(param, config%db, config%method, "zero", error)
else
call get_zero_damping(inp, config%method, error, s9)
call get_zero_damping(inp, config%method, error, s9, param_citation)
end if
if (allocated(error)) return
end if
Expand All @@ -97,11 +111,12 @@ subroutine run_driver(config, error)
end if
end if
if (config%mzero) then
citation = get_citation(doi_dftd3_m)
if (.not.config%has_param) then
if (allocated(config%db)) then
call from_db(param, config%db, config%method, "zerom", error)
else
call get_mzero_damping(inp, config%method, error, s9)
call get_mzero_damping(inp, config%method, error, s9, param_citation)
end if
if (allocated(error)) return
end if
Expand All @@ -115,18 +130,23 @@ subroutine run_driver(config, error)
end if
end if
if (config%rational .or. config%mrational) then
if (config%rational) then
citation = get_citation(doi_dftd3_bj)
else
citation = get_citation(doi_dftd3_m)
end if
if (.not.config%has_param) then
if (config%mrational) then
if (allocated(config%db)) then
call from_db(param, config%db, config%method, "bjm", error)
else
call get_mrational_damping(inp, config%method, error, s9)
call get_mrational_damping(inp, config%method, error, s9, param_citation)
end if
else
if (allocated(config%db)) then
call from_db(param, config%db, config%method, "bj", error)
else
call get_rational_damping(inp, config%method, error, s9)
call get_rational_damping(inp, config%method, error, s9, param_citation)
end if
end if
if (allocated(error)) return
Expand All @@ -141,11 +161,12 @@ subroutine run_driver(config, error)
end if
end if
if (config%optimizedpower) then
citation = get_citation(doi_dftd3_op)
if (.not.config%has_param) then
if (allocated(config%db)) then
call from_db(param, config%db, config%method, "op", error)
else
call get_optimizedpower_damping(inp, config%method, error, s9)
call get_optimizedpower_damping(inp, config%method, error, s9, param_citation)
end if
if (allocated(error)) return
end if
Expand Down Expand Up @@ -255,6 +276,21 @@ subroutine run_driver(config, error)

end if

if (config%citation) then
open(file=config%citation_output, newunit=unit)
if (.not.same_citation(citation, param_citation)) then
call format_bibtex(output, citation)
if (allocated(output)) write(unit, '(a)') output
end if
call format_bibtex(output, param_citation)
if (allocated(output)) write(unit, '(a)') output
close(unit)
if (config%verbosity > 0) then
write(output_unit, '(a)') &
& "[Info] Citation information written to '"//config%citation_output//"'"
end if
end if

end subroutine run_driver

subroutine property_calc(unit, mol, disp, verbosity)
Expand Down
1 change: 1 addition & 0 deletions app/help.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module dftd3_app_help
" attempts to add to Turbomole gradient and gradlatt files"//nl//&
" --property Evaluate dispersion related properties"//nl//&
" --pair-resolved Calculate pairwise representation of dispersion energy"//nl//&
" --citation [file] Print citation information to file (default: dftd3.bib)"//nl//&
"-v,--verbose Show more, can be used multiple times"//nl//&
"-s,--silent Show less, use twice to supress all output"//nl//&
" --version Print program version and exit"//nl//&
Expand Down
28 changes: 17 additions & 11 deletions assets/parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ d3.bjm = {s6=1.0, s9=1.0, alp=14.0, damping="rational"}
d3.zerom = {s6=1.0, s9=1.0, rs8=1.0, alp=14.0, damping="mzero"}
d3.op = {s9=1.0, alp=14.0, damping="optimizedpower"}

[parameter.slaterdirac]
d3.zero = {rs6=0.999, s8=-1.957, rs8=0.697}

[parameter.bp]
d3.bj = {a1=0.3946, s8=3.2822, a2=4.8516, doi="10.1002/jcc.21759"}
d3.zero = {rs6=1.139, s8=1.683, doi="10.1063/1.3382344"}
Expand Down Expand Up @@ -50,6 +53,7 @@ d3.op = {s6=0.91826, s8=0.0, a1=0.200, a2=4.750, bet=6.0, doi="10.1021/acs.jctc.

[parameter.rpw86pbe]
d3.bj = {a1=0.4613, s8=1.3845, a2=4.5062, doi="10.1002/jcc.21759"}
d3.zero = {rs6=1.224, s8=0.901}

[parameter.b3lyp]
d3.bj = {a1=0.3981, s8=1.9889, a2=4.4211, doi="10.1002/jcc.21759"}
Expand All @@ -65,6 +69,7 @@ d3.op = {s6=1.0, s8=0.51581, a1=0.575, a2=3.00, bet=8.0, doi="10.1021/acs.jctc.7

[parameter.hf]
d3.bj = {a1=0.3385, s8=0.9171, a2=2.8830, doi="10.1002/jcc.21759"}
d3.zero = {rs6=1.158, s8=1.746}

[parameter.tpss0]
d3.bj = {a1=0.3768, s8=1.2576, a2=4.5865, doi="10.1002/jcc.21759"}
Expand All @@ -83,9 +88,11 @@ d3.zero = {rs6=1.129, s8=0.109, doi="10.1021/jp501237c"}

[parameter.revpbe38]
d3.bj = {a1=0.4309, s8=1.4760, a2=3.9446, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.021, s8=0.862}

[parameter.pw6b95]
d3.bj = {a1=0.2076, s8=0.7257, a2=6.3750, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.532, s8=0.862}

[parameter.b2plyp]
d3.bj = {a1=0.3065, s8=0.9147, a2=5.0570, s6=0.64, doi="10.1039/c0cp02984j"}
Expand Down Expand Up @@ -151,12 +158,15 @@ d3.zero = {rs6=0.837, s8=2.033, doi="10.1039/c0cp02984j"}

[parameter.ssb]
d3.bj = {a1=-0.0952, s8=-0.1744, a2=5.2170, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.215, s8=0.663, doi="10.1039/c0cp02984j"}

[parameter.revssb]
d3.bj = {a1=0.4720, s8=0.4389, a2=4.0986, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.221, s8=0.560, doi="10.1039/c0cp02984j"}

[parameter.otpss]
d3.bj = {a1=0.4634, s8=2.7495, a2=4.3153, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.128, s8=1.494, doi="10.1039/c0cp02984j"}

[parameter.b3pw91]
d3.bj = {a1=0.4312, s8=2.8524, a2=4.4693, doi="10.1039/c0cp02984j"}
Expand All @@ -177,9 +187,11 @@ d3.op = {s6=1.0, s8=0.43185, a1=0.575, a2=3.00, bet=8.0, doi="10.1021/acs.jctc.7

[parameter.mpw1b95]
d3.bj = {a1=0.1955, s8=1.0508, a2=6.4177, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.605, s8=1.118, doi="10.1039/c0cp02984j"}

[parameter.pwb6k]
d3.bj = {a1=0.1805, s8=0.9383, a2=7.7627, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.660, s8=0.550, doi="10.1039/c0cp02984j"}

[parameter.b1b95]
d3.bj = {a1=0.2092, s8=1.4507, a2=5.5545, doi="10.1039/c0cp02984j"}
Expand All @@ -191,6 +203,7 @@ d3.zero = {rs6=1.931, s8=2.168, doi="10.1039/c0cp02984j"}

[parameter.camb3lyp]
d3.bj = {a1=0.3708, s8=2.0674, a2=5.4743, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.378, s8=1.217, doi="10.1039/c0cp02984j"}

[parameter.lcwpbe]
d3.bj = {a1=0.3919, s8=1.8541, a2=5.0897, doi="10.1039/c0cp02984j"}
Expand All @@ -204,6 +217,7 @@ d3.zero = {rs6=1.586, s8=0.760, s6=0.56, doi="10.1021/ct100466k"}

[parameter.ptpss]
d3.bj = {a1=0.0000, s8=0.2804, a2=6.5745, s6=0.750, doi="10.1039/c0cp02984j"}
d3.zero = {rs6=1.541, s8=0.879, s6=0.75, doi="10.1021/ct100466k"}

[parameter.pwpb95]
d3.bj = {a1=0.0000, s8=0.2904, a2=7.3141, s6=0.820, doi="10.1039/c0cp02984j"}
Expand All @@ -228,8 +242,8 @@ d3.bj = {a1=0.3563, s8=1.0821, a2=4.3359}
d3.bj = {a1=0.5719, s8=0.5883, a2=3.6017}

[parameter.pw1pw]
d3.bj = {a1=0.3807, s8=2.3363, a2=5.8844}
d3.zero = {rs6=1.4968, s8=1.1786, doi="10.1039/C7CP04913G"}
d3.bj = {a1=0.3807, s8=2.3363, a2=5.8844, doi="10.1039/c7cp04913g"}
d3.zero = {rs6=1.4968, s8=1.1786, doi="10.1039/c7cp04913g"}

[parameter.pwgga]
d3.bj = {a1=0.2211, s8=2.6910, a2=6.7278}
Expand Down Expand Up @@ -413,7 +427,7 @@ d3.bj = {a1=0.2746, s8=1.1908, a2=5.3157, doi="10.1039/c7cp04913g"}

[parameter.mpw2plyp]
d3.bj = {s6=0.66, a1=0.4105, s8=0.6223, a2=5.0136, doi="10.1039/c7cp04913g"}
d3.zero = {s6=0.66, rs6=1.5527, s8=0.7529, doi="10.1039/C7CP04913G"}
d3.zero = {s6=0.66, rs6=1.5527, s8=0.7529, doi="10.1039/c7cp04913g"}

[parameter.ms2]
d3.op = {s6=1.0, s8=0.90743, a1=0.700, a2=4.00, bet=2.0, doi="10.1021/acs.jctc.7b00176"}
Expand Down Expand Up @@ -469,14 +483,6 @@ d3.bj = {s6=0.3012, a1=0.0, s8=0.0, a2=4.5050, doi="10.1021/acs.jpca.1c01295"}
[parameter.dsdpbep86_2011]
d3.bj = {s6=0.418, a1=0.0, s8=0.0, a2=5.65, doi="10.1039/c1cp22592h"}

# dRPA75-D3(BJ) from MRCC source code
[parameter.drpa75_mrcc]
d3.bj = {s6=0.375, a1=0.0, s8=0.0, a2=4.505}

# SCS-dRPA75-D3(BJ) from MRCC source code
[parameter.scsdrpa75_mrcc]
d3.bj = {s6=0.375, a1=0.0, s8=0.0, a2=4.505}

[parameter.dsdsvwn5]
d3.bj = {s6=0.46, a1=0.0, s8=0.0, a2=5.6, doi="10.1002/jcc.23391"}

Expand Down
3 changes: 3 additions & 0 deletions man/s-dftd3.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Evaluate dispersion related properties
*--pair-resolved*::
Calculate pairwise representation of dispersion energy

*--citation* [_file_]::
Write citations as bibtex (default: `dftd3.bib`)

*-v, --verbose*::
Show more, can be used multiple times

Expand Down
1 change: 1 addition & 0 deletions src/dftd3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(dir "${CMAKE_CURRENT_SOURCE_DIR}")

list(
APPEND srcs
"${dir}/citation.f90"
"${dir}/cutoff.f90"
"${dir}/damping.f90"
"${dir}/data.f90"
Expand Down
Loading

0 comments on commit 202a6ba

Please sign in to comment.