Repository: dftd4/dftd4 (language: python)

Issue:
Parameterization for PBEsol
Is a parameterization available for PBEsol?  I am unsure if it is included and I just do not see the name as something I recognize.  If it is not available, is it something that is expected to be available in the future?


Discussion / hints:
There are currently no damping parameters available for PBEsol, parameterization is possible of course, but currently not planned by me.
I am also interested in AM05, but that is also unlikely to be parameterized I take it?  No public code is available for parameterization either?
We are currently parametrizing a couple of functionals, maybe we can also do PBEsol and AM05 in the same pass.

> No public code is available for parameterization either?

The parametrization is a least squares fit on the dispersion energies of the fitset given [here](https://github.com/dftd4/dftd4-fitset) (~1000 singlepoints for each functional). Plugging together a fit of the three damping parameters with [nlopt](https://nlopt.readthedocs.io) or a similar optimization library is quite straight-forward. But maybe I can add an example for such setup here.
An example for how to do this fitting for a single functional would be great, but if this parameterization becomes available directly from your group that would definitely be preferred.

Fix patch:
diff --git a/.github/workflows/fortran-build.yml b/.github/workflows/fortran-build.yml
index b6e821c4..a8ae3b71 100644
--- a/.github/workflows/fortran-build.yml
+++ b/.github/workflows/fortran-build.yml
@@ -69,10 +69,12 @@ jobs:
         --prefix=$PWD/_dist
         --libdir=lib
         --warnlevel=0
-        -Db_coverage=true
+        -Db_coverage=${{ env.COVERAGE }}
         -Dlapack=netlib
         -Dpython=true
         -Dapi_v2=true
+      env:
+        COVERAGE: ${{ contains(matrix.os, 'ubuntu') && 'true' || 'false' }}
 
     - name: Build library
       run: meson compile -C ${{ env.M_BUILD_DIR }}
@@ -80,6 +82,10 @@ jobs:
     - name: Run unit tests
       run: |
          meson test -C ${{ env.M_BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2
+
+    - name: Create coverage report
+      if: contains(matrix.os, 'ubuntu')
+      run: |
          ninja -C ${{ env.M_BUILD_DIR }} coverage
 
     - name: Install project
@@ -155,7 +161,7 @@ jobs:
       matrix:
         os: [ubuntu-latest, macos-latest]
         gcc_v: [9]
-        python_v: ['3.6', '3.7', '3.8']
+        python_v: ['3.7', '3.8', '3.9']
 
     env:
       FC: gfortran
diff --git a/assets/parameters.toml b/assets/parameters.toml
index 894233fd..1e21ba32 100644
--- a/assets/parameters.toml
+++ b/assets/parameters.toml
@@ -6,6 +6,10 @@ d4.bj-eeq-two = { s6=1.0, s9=0.0, alp=16.0, damping="bj", mbd="none" }
 d4.bj-eeq-atm = { s6=1.0, s9=1.0, alp=16.0, damping="bj", mbd="approx-atm" }
 d4.bj-eeq-mbd = { s6=1.0, s9=1.0, alp=16.0, damping="bj", mbd="rpa-like" }
 
+[parameter.am05]
+reference.doi = ["10.1103/PhysRevB.72.085108", "10.1063/1.2835596"]
+d4.bj-eeq-atm = { s8=1.71885838, a1=0.47901431, a2=5.96771581 }
+
 [parameter.b1b95]
 reference.doi = ["10.1063/1.470829"]
 d4.bj-eeq-atm = { s8=1.27701162, a1=0.40554715, a2=4.63323074, doi="10.1063/1.5090222" }
@@ -175,6 +179,10 @@ reference.doi = ["10.1063/1.2370993"]
 d4.bj-eeq-atm = { s8=0.59493760, a1=0.71422359, a2=6.35314182, doi="10.1063/1.5090222" }
 d4.bj-eeq-mbd = { s8=0.40077779, a1=0.69611405, a2=6.29092087, doi="10.1063/1.5090222" }
 
+[parameter.mn12sx]
+reference.doi = ["10.1039/C2CP42576A"]
+d4.bj-eeq-atm = { s8=0.85964873, a1=0.62662681, a2=5.62088906 }
+
 [parameter.mpw1b95]
 reference.doi = ["10.1021/jp048147q"]
 d4.bj-eeq-atm = { s8=0.50093024, a1=0.41585097, a2=4.99154869, doi="10.1063/1.5090222" }
@@ -235,6 +243,10 @@ reference.doi = ["10.1103/PhysRevLett.77.3865"]
 d4.bj-eeq-atm = { s8=0.95948085, a1=0.38574991, a2=4.80688534, doi="10.1063/1.5090222" }
 d4.bj-eeq-mbd = { s8=0.99924614, a1=0.38142528, a2=4.81839284, doi="10.1063/1.5090222" }
 
+[parameter.pbesol]
+reference.doi = ["10.1063/1.3691197"]
+d4.bj-eeq-atm = { s8=1.71885698, a1=0.47901421, a2=5.96771589 }
+
 [parameter.pw1pw]
 d4.bj-eeq-atm = { s8=0.96850170, a1=0.42427511, a2=5.02060636, doi="10.1063/1.5090222" }
 d4.bj-eeq-mbd = { s8=1.09759050, a1=0.42759830, a2=5.04559572, doi="10.1063/1.5090222" }
diff --git a/src/dftd4/param.f90 b/src/dftd4/param.f90
index de5bae24..78d7eceb 100644
--- a/src/dftd4/param.f90
+++ b/src/dftd4/param.f90
@@ -50,7 +50,7 @@ module dftd4_param
          & p_m05, p_m052x, p_m08hx, p_lcwhpbe, p_mn12l, p_tauhcthhyb, &
          & p_sogga11x, p_n12sx, p_mn12sx, p_mn15, p_glyp, p_bop, &
          & p_mpw1b95, p_revpbe0dh, p_revtpss0, p_revdsdpbep86, p_revdsdpbe, &
-         & p_revdsdblyp, p_revdodpbep86
+         & p_revdsdblyp, p_revdodpbep86, p_am05
    end enum
    integer, parameter :: df_enum = kind(p_invalid)
 
@@ -280,6 +280,10 @@ subroutine get_d4eeq_bjatm_parameter(dfnum, param, s9)
       param = dftd_param ( & ! (SAW190103)
          &  s6=1.0000_wp, s8=0.59493760_wp, a1=0.71422359_wp, a2=6.35314182_wp )
       !  Fitset: MD= 0.08395 MAD= 0.24888 RMSD= 0.34879
+   case(p_mn12sx)
+      param = dftd_param ( & ! (SAW211021)
+         &  s6=1.0000_wp, s8=0.85964873_wp, a1=0.62662681_wp, a2=5.62088906_wp )
+      !  Fitset: MD= 0.16131 MAD= 0.34142 RMSD= 0.47113
    case(p_mpw1b95)
       param = dftd_param ( & ! (SAW190107)
          &  s6=1.0000_wp, s8=0.50093024_wp, a1=0.41585097_wp, a2=4.99154869_wp )
@@ -336,6 +340,14 @@ subroutine get_d4eeq_bjatm_parameter(dfnum, param, s9)
       param = dftd_param ( & ! (SAW190103)
          &  s6=1.0000_wp, s8=0.95948085_wp, a1=0.38574991_wp, a2=4.80688534_wp )
       !  Fitset: MD= -0.20544 MAD= 0.33635 RMSD= 0.51168
+   case(p_pbesol)
+      param = dftd_param ( & ! (SAW211021)
+         &  s6=1.0000_wp, s8=1.71885698_wp, a1=0.47901421_wp, a2=5.96771589_wp )
+      !  Fitset: MD= -0.28899 MAD= 0.52215 RMSD= 0.93584
+   case(p_am05)
+      param = dftd_param ( & ! (SAW211021)
+         &  s6=1.0000_wp, s8=1.71885838_wp, a1=0.47901431_wp, a2=5.96771581_wp )
+      !  Fitset: MD= -0.28899 MAD= 0.52215 RMSD= 0.93584
    case(p_pw1pw)
       param = dftd_param ( & ! (SAW190103)
          &  s6=1.0000_wp, s8=0.96850170_wp, a1=0.42427511_wp, a2=5.02060636_wp )
@@ -772,6 +784,8 @@ pure function get_functional_id(df) result(num)
       num = p_b97m
    case('wb97m', 'ωb97m', 'omegab97m')
       num = p_wb97m
+   case('am05')
+      num = p_am05
    end select
 end function get_functional_id
 


Test patch:
diff --git a/test/unit/test_param.f90 b/test/unit/test_param.f90
index 87970dad..048b4eb5 100644
--- a/test/unit/test_param.f90
+++ b/test/unit/test_param.f90
@@ -95,7 +95,7 @@ subroutine test_rational_damping(error)
       & 'dodpbep86', 'dodsvwn', 'pbe02', 'pbe0dh', 'dftb(3ob)', 'dftb(mio)', &
       & 'dftb(pbc)', 'dftb(matsci)', 'dftb(ob2)', 'b1b95', 'glyp', 'revpbe0dh', &
       & 'revtpss0', 'revdsd-pbep86', 'revdsd-pbe', 'revdsd-blyp', &
-      & 'revdod-pbep86', 'b97m', 'wb97m']
+      & 'revdod-pbep86', 'b97m', 'wb97m', 'pbesol', 'am05', 'mn12sx']
    real(wp), parameter :: ref(*) = [&
       &-2.82477943738524E-1_wp,-1.83931932418458E-1_wp,-1.67883732655799E-1_wp, &
       &-1.19260344932822E-1_wp,-1.73553644083274E-1_wp,-4.64187011491173E-1_wp, &
@@ -125,7 +125,8 @@ subroutine test_rational_damping(error)
       &-4.28867617727652E-2_wp,-1.03264577526582E-1_wp,-2.71073701507995E-1_wp, &
       &-1.02702213711187E-1_wp,-8.21356035564771E-2_wp,-5.65853022691401E-2_wp, &
       &-8.56296238144821E-2_wp,-8.91479952796072E-2_wp,-6.13524150208560E-2_wp, &
-      &-1.24018193150396E-1_wp,-1.05459213596423E-1_wp]
+      &-1.24018193150396E-1_wp,-1.05459213596423E-1_wp,-3.62056545113500E-2_wp, &
+      &-3.62056561428035E-2_wp,-2.40058303330640E-2_wp]
    class(damping_param), allocatable :: param
    type(structure_type) :: mol
    integer :: ii