Repository: dftd4/dftd4 (language: python)

Issue:
pairwise atomic analysis
**Is your feature request related to a problem? Please describe.**
The Sherrill group has made use of the pairwise atomic analysis that can be got from `dftd3 -anal`. Can we access this in dftd4?

```
 analysis of pair-wise terms (in kcal/mol)
pair  atoms         C6              C8            E6       E8       Edisp
   1   2    6  6    0.256732D+02    0.742514D+03  -0.1703  -0.0854  -0.25566
   1   3    6  1    0.889494D+01    0.166318D+03  -0.0896  -0.0333  -0.12288
   1   4    6  1    0.889494D+01    0.166318D+03  -0.0896  -0.0333  -0.12288
...
```

**Describe the solution you'd like**
For our purposes, having the `(nat, nat)` array of the rightmost column in Hartrees be stored in QCSchema at `atomic_result.extras["qcvars"]["PAIRWISE DISPERSION CORRECTION ANALYSIS"]` would be ideal. (Analogous dftd3 processing https://github.com/MolSSI/QCEngine/blob/master/qcengine/programs/dftd3.py#L196-L209). But we'd be happy with any means or format of access.

@jeffschriber


Discussion / hints:
`dftd4` is currently using an atom-resolved energy representation `(nat)` for the dispersion terms internally. Creating a pairwise representation would be possible as well, but requires some extra thoughts when mapping the ATM three-body terms on atomic pairs, especially when under periodic boundary conditions with self-interaction triples.
For clarification, are you looking for the a pairwise analysis of the dispersion energy, *i.e.* a representation of the dispersion energy in atomic pairs with E(disp) = Σij E(i, j) or an analysis of the pairwise dispersion energy, *i.e.* what `dftd3 -anal` printed? Those two are equivalent only if the ATM contribution is neglected.
We're looking for the former, the summation, but without ATM (so either). No periodic boundary condition complications either. We'll run twice w/ s9=0.0 + analysis and then with s9=1.0 to get 2-body analysis and full d4 energy with 3-body. Or if separate 2-body and 3-body energies are available in output, can work with that.

Fix patch:
diff --git a/README.md b/README.md
index 3631f137..f4fc786a 100644
--- a/README.md
+++ b/README.md
@@ -111,6 +111,12 @@ Dispersion related properties can be calculated as well:
 dftd4 --property geo.gen
 ```
 
+To evaluate pairwise resolved dispersion energies use
+
+```sh
+dftd4 --pair-resolved mol.xyz
+```
+
 For an overview over all command line arguments use the ``--help`` argument or checkout the [``dftd4(1)``](man/dftd4.1.adoc) manpage.
 
 
diff --git a/app/ammonia.tmol b/app/ammonia.tmol
new file mode 100644
index 00000000..cb6cca83
--- /dev/null
+++ b/app/ammonia.tmol
@@ -0,0 +1,23 @@
+$coord
+    1.97420621099560E+00    1.97415497783241E+00    1.97424596974304E+00      N
+    6.82182427659395E+00    2.87346383480995E+00    7.72099517560089E+00      N
+    7.72104957181201E+00    6.82177051521773E+00    2.87336561318016E+00      N
+    2.87343220660781E+00    7.72108897828386E+00    6.82187093171878E+00      N
+    3.51863272100286E+00    2.63865333484548E+00    1.00652979981286E+00      H
+    2.63877594964754E+00    1.00647313885594E+00    3.51882748086447E+00      H
+    1.00639728563189E+00    3.51850454450845E+00    2.63869202592387E+00      H
+    8.36624975982697E+00    2.20896711017229E+00    8.68870955681018E+00      H
+    7.48639684558259E+00    3.84114715917956E+00    6.17640982573725E+00      H
+    5.85401675167715E+00    1.32911569888797E+00    7.05654606696031E+00      H
+    7.05646299938990E+00    5.85409590282274E+00    1.32879923864813E+00      H
+    8.68882633853582E+00    8.36611541129785E+00    2.20894120662207E+00      H
+    3.84121223226912E+00    6.17673669892998E+00    7.48629723649480E+00      H
+    1.32897854262127E+00    7.05658604099926E+00    5.85414031368096E+00      H
+    2.20884896069885E+00    8.68875820985799E+00    8.36643568423387E+00      H
+    6.17659142004652E+00    7.48627051643848E+00    3.84109594690835E+00      H 
+$periodic 3
+$lattice
+    9.69523775911749    0.00000000000000    0.00000000000000
+    0.00000000000000    9.69523775911749    0.00000000000000
+    0.00000000000000    0.00000000000000    9.69523775911749
+$end
diff --git a/app/caffeine.xyz b/app/caffeine.xyz
new file mode 100644
index 00000000..be03439c
--- /dev/null
+++ b/app/caffeine.xyz
@@ -0,0 +1,26 @@
+  24
+
+ C         -3.2668063145       -1.0612383311        0.0019792586
+ N         -2.2766003898       -0.0195172936       -0.0013208218
+ C         -0.9134590858       -0.2019878522        0.0036747135
+ C         -0.3724701006        1.0762202467        0.0017569102
+ N         -1.3526586265        2.0066755645       -0.0051933750
+ C         -2.4700895686        1.3111433173       -0.0065911261
+ H         -3.4434528448        1.7598589152       -0.0115392456
+ N          0.9701620055        1.2833365802       -0.0008793828
+ C          1.8257144377        0.2028321683       -0.0007168653
+ O          3.0278876281        0.3474912012       -0.0051812078
+ N          1.2515027114       -1.0636950051       -0.0008922263
+ C         -0.1065018202       -1.3842039491        0.0029991689
+ O         -0.5015980556       -2.5366534217        0.0044099955
+ C          2.2018357820       -2.1638123093       -0.0037185988
+ H          1.6323675079       -3.0900622488        0.0097444448
+ H          2.8244315108       -2.1119787186       -0.8964193499
+ H          2.8450781508       -2.0977859157        0.8731480371
+ C          1.5216365707        2.6211569486        0.0093869454
+ H          0.7306184352        3.3088549484       -0.2771144995
+ H          1.8886888508        2.8714188674        1.0060887389
+ H          2.3551115434        2.6687817985       -0.6902763920
+ H         -2.7510404767       -2.0202634640       -0.0176576390
+ H         -3.9109098848       -0.9753935259       -0.8744768432
+ H         -3.8816811438       -0.9984445054        0.9013764258
diff --git a/app/energy.json b/app/energy.json
new file mode 100644
index 00000000..63ef4cd1
--- /dev/null
+++ b/app/energy.json
@@ -0,0 +1,4 @@
+{
+  "version":  "3.1.0",
+  "energy":    -2.5957956130179434E-02
+}
diff --git a/app/gradient.json b/app/gradient.json
new file mode 100644
index 00000000..6d5fc70e
--- /dev/null
+++ b/app/gradient.json
@@ -0,0 +1,143 @@
+{
+  "version":  "3.1.0",
+  "energy":    -1.1421071926687140E-02,
+  "virial": [
+     3.9165842263301628E-03,
+    -7.9452570168500082E-04,
+     6.9571638098621380E-04,
+    -7.9452570168500104E-04,
+     7.6720245373158276E-03,
+     4.7258520203701893E-04,
+     6.9571638098621402E-04,
+     4.7258520203701898E-04,
+     2.5948325643309336E-03
+  ],
+  "gradient": [
+     5.4890936870307458E-06,
+     6.8905474400116919E-05,
+     7.2070072169919800E-05,
+     2.4930043602179583E-05,
+     6.7691577269145462E-05,
+     3.7700300451771096E-05,
+    -1.4736602874695291E-05,
+     5.0856751475448562E-05,
+     5.1948468437263376E-05,
+    -5.5631010132875833E-06,
+     2.7077036227042269E-05,
+     1.1709864260263766E-06,
+    -5.4814462973470864E-06,
+     5.3354792280423706E-05,
+    -5.0069999398762651E-05,
+    -4.9371107431931046E-05,
+     5.3330648261494858E-05,
+    -3.7238206995447541E-05,
+    -3.2284825409718268E-05,
+     6.2055713163868212E-05,
+    -7.2108640792203880E-05,
+    -4.1493709585997241E-07,
+     1.0024882676689814E-06,
+     3.9850389305088546E-06,
+     5.0263488391624156E-05,
+    -5.7894047464555081E-06,
+     4.3331203570559593E-06,
+     5.3979056519958045E-05,
+    -4.7773970154111436E-05,
+     3.1020675110125864E-06,
+     1.4604167870251663E-05,
+    -7.3704595241581053E-05,
+     3.2346752222179134E-06,
+    -3.1735094682207055E-05,
+    -6.4930848342024087E-05,
+     4.1568627637070596E-06,
+    -4.4626255568885203E-05,
+    -2.4542181531969100E-05,
+     5.2506554018258934E-06,
+    -7.6487138211663158E-05,
+    -1.6273009059362172E-05,
+     4.2102393734156682E-06,
+    -8.0258448622239946E-05,
+    -1.0419771633515923E-05,
+    -2.7616995354742501E-05,
+    -8.3718768805998017E-05,
+    -1.6304503815768962E-05,
+     3.4174695947532257E-05,
+     2.4646603214524721E-05,
+    -1.2128514825335609E-04,
+    -1.5088766034328947E-05,
+     4.1513556981584620E-05,
+    -5.5411976900960972E-05,
+     1.6366788715407484E-05,
+    -1.8068889842021422E-05,
+    -6.7233519496395024E-05,
+     1.3994732684073835E-05,
+     1.3038498462342140E-05,
+    -5.7422393449078066E-05,
+    -4.2009797558819596E-05,
+     7.6696839367233026E-05,
+     1.4286527615113126E-05,
+     5.0744732779807672E-07,
+     7.7380091285684206E-05,
+     1.7910909606269029E-05,
+     2.9525034140713740E-05,
+     8.4355687520225485E-05,
+     2.0039183353897748E-05,
+    -3.2256599969490821E-05,
+     1.7760451323057495E-06,
+     1.4228927109586233E-05,
+     1.5791888579799308E-05,
+     5.0870798168350767E-06,
+     1.6779304078616517E-05,
+     2.0145609527045689E-05,
+     2.4459298615509132E-06,
+     1.9853918791557404E-05,
+     1.8271241104678267E-05,
+     8.3473764053464057E-06,
+     1.4040431034673634E-05,
+     1.6856640390511496E-05,
+     4.3462171755171121E-06,
+     2.0762925231650889E-05,
+     1.9138737435879392E-05,
+     1.6813307629038787E-06,
+     1.3629029016594584E-05,
+     1.3562000040069437E-05,
+    -4.0645086129636864E-06,
+     1.1079769236527805E-05,
+     1.1536033419199555E-05,
+    -6.7875315299839272E-06,
+     1.3858945760891228E-05,
+    -1.2618262303414359E-05,
+    -3.0888208196509158E-07,
+     1.2268775012368763E-05,
+    -1.0984662416476264E-05,
+    -1.3464853117230929E-05,
+     1.0139612525620147E-05,
+    -1.6400453263893265E-05,
+    -1.1910867614826198E-05,
+     1.7401732871000870E-05,
+    -1.8988414038076405E-05,
+    -7.2393442222823694E-06,
+     1.2703207078329715E-05,
+    -1.5867172929266527E-05,
+    -1.1133121468500236E-05,
+     1.3608543984675277E-05,
+    -1.9996225679943384E-05,
+    -1.0012696170863329E-05,
+     1.7782398187082272E-05,
+    -1.8313140995089047E-05,
+     1.9049200550896968E-05,
+    -1.0782734070747409E-05,
+     3.2796204715257997E-06,
+    -1.3716048276244802E-05,
+    -1.7287775152205311E-05,
+     3.1325062512730999E-06,
+     2.2289489224541949E-06,
+    -1.0821125527034664E-05,
+    -2.6618361271991471E-06,
+     3.4139423538857460E-06,
+    -2.2685703180406254E-05,
+    -7.6301611826346083E-06,
+     6.1112710663802315E-06,
+    -2.1979961284692225E-05,
+    -7.5961280404431076E-06
+  ]
+}
diff --git a/app/main.f90 b/app/main.f90
index 4dbfff04..dfab3c45 100644
--- a/app/main.f90
+++ b/app/main.f90
@@ -21,7 +21,7 @@ program main
    use dftd4, only : get_dispersion, d4_model, new_d4_model, &
       realspace_cutoff, get_lattice_points, get_coordination_number, &
       damping_param, rational_damping_param, get_rational_damping, &
-      get_dftd4_version
+      get_dftd4_version, get_pairwise_dispersion
    use dftd4_charge, only : get_charges
    use dftd4_output
    use dftd4_utils
@@ -44,6 +44,7 @@ program main
       real(wp) :: ga = 3.0_wp
       real(wp) :: gc = 2.0_wp
       real(wp) :: wf = 6.0_wp
+      logical :: pair_resolved = .false.
    end type d4_config
    type(d4_config) :: config
 
@@ -55,7 +56,7 @@ program main
    type(d4_model) :: d4
    type(error_type), allocatable :: error
    real(wp) :: energy, sigma(3, 3), charge
-   real(wp), allocatable :: gradient(:, :)
+   real(wp), allocatable :: gradient(:, :), pair_disp2(:, :), pair_disp3(:, :)
    character(len=:), allocatable :: method
    real(wp), allocatable :: s9
    integer :: stat, unit
@@ -134,8 +135,16 @@ program main
    if (allocated(param)) then
       call get_dispersion(mol, d4, param, realspace_cutoff(), energy, gradient, &
          & sigma)
+      if (config%pair_resolved) then
+         allocate(pair_disp2(mol%nat, mol%nat), pair_disp3(mol%nat, mol%nat))
+         call get_pairwise_dispersion(mol, d4, param, realspace_cutoff(), pair_disp2, &
+            & pair_disp3)
+      end if
       if (config%verbosity > 0) then
          call ascii_results(output_unit, mol, energy, gradient, sigma)
+         if (config%pair_resolved) then
+            call ascii_pairwise(output_unit, mol, pair_disp2, pair_disp3)
+         end if
       end if
       if (config%tmer) then
          if (config%verbosity > 0) then
@@ -185,9 +194,11 @@ program main
       if (config%json) then
          open(file=config%json_output, newunit=unit)
          if (config%grad) then
-            call json_results(unit, "  ", energy, gradient, sigma)
+            call json_results(unit, "  ", energy, gradient, sigma, &
+               & pairwise_energy2=pair_disp2, pairwise_energy3=pair_disp3)
          else
-            call json_results(unit, "  ", energy)
+            call json_results(unit, "  ", energy, &
+               & pairwise_energy2=pair_disp2, pairwise_energy3=pair_disp3)
          end if
          close(unit)
          if (config%verbosity > 0) then
@@ -267,6 +278,7 @@ subroutine help(unit)
       "", "write results to file (default: dftd4.txt),", &
       "", "attempts to add to Turbomole gradient and gradlatt files", &
       "    --property", "Show dispersion related atomic and system properties", &
+      "    --pair-resolved", "Calculate pairwise representation of dispersion energy", &
       "    --noedisp", "Disable writing of dispersion energy to .EDISP file", &
       "    --json [file]", "Dump results to JSON output (default: dftd4.json)", &
       "    --grad [file]", "Request gradient evaluation,", &
@@ -467,6 +479,8 @@ subroutine get_arguments(input, input_format, config, method, inp, error)
          end if
       case("--property")
          config%properties = .true.
+      case("--pair-resolved")
+         config%pair_resolved = .true.
       case("--noedisp")
          config%tmer = .false.
       case("--nowrap")
diff --git a/app/meson.build b/app/meson.build
index 3f60d75a..01fbf869 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -26,3 +26,39 @@ test('app-help', dftd4_exe, args: '--help')
 test('app-license', dftd4_exe, args: '--license')
 test('app-citation', dftd4_exe, args: '--citation')
 test('app-noargs', dftd4_exe, should_fail: true)
+
+test(
+  'app-energy',
+  files('tester.py'),
+  args: [
+    dftd4_exe,
+    files('ammonia.tmol'),
+    files('energy.json'),
+    '--noedisp',
+    '--func', 'tpssh'
+  ],
+)
+test(
+  'app-gradient',
+  files('tester.py'),
+  args: [
+    dftd4_exe,
+    files('nitralin.mol'),
+    files('gradient.json'),
+    '--noedisp',
+    '--grad',
+    '--func', 'scan',
+  ],
+)
+test(
+  'app-pair-analysis',
+  files('tester.py'),
+  args: [
+    dftd4_exe,
+    files('caffeine.xyz'),
+    files('pair-analysis.json'),
+    '--noedisp',
+    '--pair-resolved',
+    '--func', 'b3lyp',
+  ],
+)
diff --git a/app/nitralin.mol b/app/nitralin.mol
new file mode 100644
index 00000000..80eae092
--- /dev/null
+++ b/app/nitralin.mol
@@ -0,0 +1,47 @@
+
+          03092123493D
+
+ 42  0  0     0  0            999 V2000
+    3.4480    3.6060   -0.0290 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.6340    2.8450   -1.3340 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.6190    1.7220   -1.5110 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8010    1.0090   -2.7450 N   0  0  0  0  0  0  0  0  0  0  0  0
+    2.7100    1.7480   -4.0090 C   0  0  0  0  0  0  0  0  0  0  0  0
+    1.3460    2.3800   -4.1790 C   0  0  0  0  0  0  0  0  0  0  0  0
+    1.2060    3.1580   -5.4800 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.0770   -0.3690   -2.7670 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.3970   -0.8170   -2.7380 C   0  0  0  0  0  0  0  0  0  0  0  0
+    4.6710   -2.1850   -2.7600 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.6230   -3.1050   -2.8090 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.3020   -2.6570   -2.8380 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.0290   -1.2890   -2.8160 C   0  0  0  0  0  0  0  0  0  0  0  0
+    0.6710   -0.8620   -2.8470 N   0  0  0  0  0  0  0  0  0  0  0  0
+    0.1270   -0.6570   -3.9570 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.0630   -0.7040   -1.7630 O   0  0  0  0  0  0  0  0  0  0  0  0
+    3.9660   -4.8170   -2.8330 S   0  0  0  0  0  0  0  0  0  0  0  0
+    5.2710   -5.0220   -2.2210 O   0  0  0  0  0  0  0  0  0  0  0  0
+    2.8070   -5.5370   -2.3230 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.1040   -5.2150   -4.5610 C   0  0  0  0  0  0  0  0  0  0  0  0
+    5.4870    0.0970   -2.6860 N   0  0  0  0  0  0  0  0  0  0  0  0
+    5.9180    0.4620   -1.5670 O   0  0  0  0  0  0  0  0  0  0  0  0
+    5.9810    0.5100   -3.7610 O   0  0  0  0  0  0  0  0  0  0  0  0
+    4.1910    4.4040    0.0690 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.4540    4.0630    0.0020 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5380    2.9420    0.8370 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.6430    2.4150   -1.3480 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5690    3.5470   -2.1730 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.7220    0.9930   -0.7020 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.5940    2.1070   -1.4950 H   0  0  0  0  0  0  0  0  0  0  0  0
+    2.9060    1.0160   -4.7870 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5110    2.4800   -3.9930 H   0  0  0  0  0  0  0  0  0  0  0  0
+    0.6010    1.5760   -4.1700 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.1190    3.0430   -3.3360 H   0  0  0  0  0  0  0  0  0  0  0  0
+    0.2080    3.6000   -5.5660 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.9390    3.9700   -5.5130 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.3760    2.5160   -6.3490 H   0  0  0  0  0  0  0  0  0  0  0  0
+    5.6990   -2.5390   -2.7380 H   0  0  0  0  0  0  0  0  0  0  0  0
+    1.4880   -3.3770   -2.8760 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.3180   -6.2760   -4.6330 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.1550   -4.9690   -5.0270 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.9130   -4.6180   -4.9680 H   0  0  0  0  0  0  0  0  0  0  0  0
+M  END
diff --git a/app/pair-analysis.json b/app/pair-analysis.json
new file mode 100644
index 00000000..5658f6f9
--- /dev/null
+++ b/app/pair-analysis.json
@@ -0,0 +1,1160 @@
+{
+  "version":  "3.1.0",
+  "energy":    -4.6740499655804617E-02,
+  "additive pairwise energy": [
+     0.0000000000000000E+00,
+    -3.4557928869121735E-04,
+    -2.9044186524091262E-04,
+    -1.4448989777284484E-04,
+    -1.6190405487998425E-04,
+    -2.8528160789733308E-04,
+    -7.5129824817474146E-05,
+    -3.2152352225417534E-05,
+    -1.8331839995465100E-05,
+    -4.6272529233105555E-06,
+    -4.8517153280985997E-05,
+    -2.0877111137118298E-04,
+    -2.1310078871150635E-04,
+    -1.3120551169913320E-05,
+    -3.8462113187416048E-06,
+    -1.4174098133236253E-06,
+    -1.3963487662322661E-06,
+    -7.9038779692284556E-06,
+    -1.9564382122056805E-06,
+    -1.0501462068162272E-06,
+    -8.3625778933224859E-07,
+    -9.1701340286622145E-05,
+    -9.9601393208374251E-05,
+    -9.9473629825869641E-05,
+    -3.4557928869121735E-04,
+     0.0000000000000000E+00,
+    -3.5242163853306920E-04,
+    -3.2150768849531432E-04,
+    -3.9228098729351274E-04,
+    -3.4603995469208680E-04,
+    -1.0347686817382803E-04,
+    -1.7705822048743301E-04,
+    -7.7690657640321618E-05,
+    -1.5795101447264177E-05,
+    -1.4320487975428477E-04,
+    -3.0171969203792202E-04,
+    -2.3519322400270866E-04,
+    -2.7156219717614954E-05,
+    -5.7594203809823474E-06,
+    -2.8817802461665015E-06,
+    -2.8460846702462611E-06,
+    -4.1941833949543987E-05,
+    -1.0898033413730021E-05,
+    -4.7246889697872993E-06,
+    -3.5342577305622566E-06,
+    -9.6993574508321271E-05,
+    -1.0493705318574600E-04,
+    -1.0479404218837785E-04,
+    -2.9044186524091262E-04,
+    -3.5242163853306920E-04,
+     0.0000000000000000E+00,
+    -3.0607149193835712E-04,
+    -3.6011855594105939E-04,
+    -3.0731765072143842E-04,
+    -5.7986158639871330E-05,
+    -3.2832178426755093E-04,
+    -2.5340957065501691E-04,
+    -8.7776129392250449E-05,
+    -3.3068892239342264E-04,
+    -3.0801364123860903E-04,
+    -3.0007371585479638E-04,
+    -1.3744236191054444E-04,
+    -2.5611335502640310E-05,
+    -1.4678638520198758E-05,
+    -1.4559474654939719E-05,
+    -1.3103866989467309E-04,
+    -2.5061507059905449E-05,
+    -1.5139906575512484E-05,
+    -1.2538947435098937E-05,
+    -8.0269703742761562E-05,
+    -5.7543308564291951E-05,
+    -5.8346582798046130E-05,
+    -1.4448989777284484E-04,
+    -3.2150768849531432E-04,
+    -3.0607149193835712E-04,
+     0.0000000000000000E+00,
+    -3.5764893942256216E-04,
+    -2.9295627297250184E-04,
+    -5.7813049889557157E-05,
+    -3.3405189657491840E-04,
+    -2.6549956481097489E-04,
+    -1.5000077895115381E-04,
+    -2.8675270512891016E-04,
+    -2.7137585392515218E-04,
+    -1.2989998233222110E-04,
+    -7.5850170079269828E-05,
+    -8.6988565513488398E-06,
+    -9.2314793481245025E-06,
+    -9.2299846727704527E-06,
+    -2.7553151527835338E-04,
+    -8.0977051778841693E-05,
+    -6.0868991140867310E-05,
+    -5.1117942721337577E-05,
+    -2.2442483714697281E-05,
+    -1.6822361928532675E-05,
+    -1.6988609861663693E-05,
+    -1.6190405487998425E-04,
+    -3.9228098729351274E-04,
+    -3.6011855594105939E-04,
+    -3.5764893942256216E-04,
+     0.0000000000000000E+00,
+    -3.7029274941104796E-04,
+    -1.1109219917286285E-04,
+    -3.7673866180248607E-04,
+    -1.4477816756901200E-04,
+    -3.7014794868472551E-05,
+    -9.9048385432804289E-05,
+    -1.5807528360570395E-04,
+    -4.0278792412423835E-05,
+    -1.5646189905833296E-05,
+    -2.1011366870973566E-06,
+    -2.1109847369360179E-06,
+    -2.1028011684204667E-06,
+    -2.8191511825878524E-04,
+    -9.7716456210571610E-05,
+    -4.3947896781916756E-05,
+    -2.8476342951628308E-05,
+    -1.5351345923508336E-05,
+    -2.3023421458753428E-05,
+    -2.2780713798588845E-05,
+    -2.8528160789733308E-04,
+    -3.4603995469208680E-04,
+    -3.0731765072143842E-04,
+    -2.9295627297250184E-04,
+    -3.7029274941104796E-04,
+     0.0000000000000000E+00,
+    -9.9501946401009042E-05,
+    -1.8169819504608973E-04,
+    -5.1126917735141148E-05,
+    -1.1557851454680624E-05,
+    -5.5551913760962434E-05,
+    -1.4838274848372022E-04,
+    -5.5469084875220256E-05,
+    -9.9707327996693485E-06,
+    -1.7479689957568670E-06,
+    -1.2637556169459556E-06,
+    -1.2524153114775943E-06,
+    -7.2729037336488977E-05,
+    -2.8164139299048408E-05,
+    -8.1057807644693474E-06,
+    -5.3227568720511408E-06,
+    -4.5860084481886938E-05,
+    -7.5661509067853402E-05,
+    -7.4819602215720044E-05,
+    -7.5129824817474146E-05,
+    -1.0347686817382803E-04,
+    -5.7986158639871330E-05,
+    -5.7813049889557157E-05,
+    -1.1109219917286285E-04,
+    -9.9501946401009042E-05,
+     0.0000000000000000E+00,
+    -1.2205905497743448E-05,
+    -3.0952068204024772E-06,
+    -8.9814156808130525E-07,
+    -3.3481517137389893E-06,
+    -9.8587543015764725E-06,
+    -4.0650730914887306E-06,
+    -7.8907163372913910E-07,
+    -1.5694957487056763E-07,
+    -1.1510853847254738E-07,
+    -1.1404492534346648E-07,
+    -5.5872023947403454E-06,
+    -2.6312483081047846E-06,
+    -7.1308252366314582E-07,
+    -4.6971195864804346E-07,
+    -5.8989089058618619E-06,
+    -1.9581535099097794E-05,
+    -1.9015890037869198E-05,
+    -3.2152352225417534E-05,
+    -1.7705822048743301E-04,
+    -3.2832178426755093E-04,
+    -3.3405189657491840E-04,
+    -3.7673866180248607E-04,
+    -1.8169819504608973E-04,
+    -1.2205905497743448E-05,
+     0.0000000000000000E+00,
+    -3.2258094823978052E-04,
+    -3.3184267658543324E-04,
+    -3.5549804826473524E-04,
+    -2.6774874061620709E-04,
+    -7.5557767696256210E-05,
+    -1.4173363844591718E-04,
+    -1.1650003182153538E-05,
+    -2.2146434082917951E-05,
+    -2.2342499146652671E-05,
+    -3.4124099486773613E-04,
+    -1.0023296468597344E-04,
+    -1.0152991790877720E-04,
+    -9.9842370466177535E-05,
+    -5.6767853893970779E-06,
+    -3.5086060778379727E-06,
+    -3.5520814911312517E-06,
+    -1.8331839995465100E-05,
+    -7.7690657640321618E-05,
+    -2.5340957065501691E-04,
+    -2.6549956481097489E-04,
+    -1.4477816756901200E-04,
+    -5.1126917735141148E-05,
+    -3.0952068204024772E-06,
+    -3.2258094823978052E-04,
+     0.0000000000000000E+00,
+    -2.9330017646219916E-04,
+    -3.2087389956222582E-04,
+    -2.6080762630218508E-04,
+    -1.2833156280448132E-04,
+    -2.6748604996934474E-04,
+    -4.5153093292049487E-05,
+    -7.3724358543479643E-05,
+    -7.4045325415168323E-05,
+    -2.6644964529172352E-04,
+    -4.6069337779644989E-05,
+    -6.7870592718373527E-05,
+    -7.5072583546489683E-05,
+    -4.6415844144981817E-06,
+    -1.9466671327606459E-06,
+    -1.9848534044355712E-06,
+    -4.6272529233105555E-06,
+    -1.5795101447264177E-05,
+    -8.7776129392250449E-05,
+    -1.5000077895115381E-04,
+    -3.7014794868472551E-05,
+    -1.1557851454680624E-05,
+    -8.9814156808130525E-07,
+    -3.3184267658543324E-04,
+    -2.9330017646219916E-04,
+     0.0000000000000000E+00,
+    -3.2966270525137530E-04,
+    -1.3516573301120411E-04,
+    -3.6420940424237947E-05,
+    -2.7096604936102084E-04,
+    -2.6615622706294422E-05,
+    -7.7413223315241461E-05,
+    -7.8042317721008705E-05,
+    -2.6359277087043914E-04,
+    -2.5669669057519816E-05,
+    -6.3926947107776995E-05,
+    -8.0590998801923302E-05,
+    -1.2048315882835148E-06,
+    -5.7721399074214548E-07,
+    -5.8644351306963382E-07,
+    -4.8517153280985997E-05,
+    -1.4320487975428477E-04,
+    -3.3068892239342264E-04,
+    -2.8675270512891016E-04,
+    -9.9048385432804289E-05,
+    -5.5551913760962434E-05,
+    -3.3481517137389893E-06,
+    -3.5549804826473524E-04,
+    -3.2087389956222582E-04,
+    -3.2966270525137530E-04,
+     0.0000000000000000E+00,
+    -3.3434722419313598E-04,
+    -3.2986527958886377E-04,
+    -3.3834012113217175E-04,
+    -9.7048388670583507E-05,
+    -9.9908531154498537E-05,
+    -9.9825558425687108E-05,
+    -1.3606397428917632E-04,
+    -1.2080238078612212E-05,
+    -1.8421854885368894E-05,
+    -2.2398232512075807E-05,
+    -1.7410612338323094E-05,
+    -4.4721158076063165E-06,
+    -4.5972532834924565E-06,
+    -2.0877111137118298E-04,
+    -3.0171969203792202E-04,
+    -3.0801364123860903E-04,
+    -2.7137585392515218E-04,
+    -1.5807528360570395E-04,
+    -1.4838274848372022E-04,
+    -9.8587543015764725E-06,
+    -2.6774874061620709E-04,
+    -2.6080762630218508E-04,
+    -1.3516573301120411E-04,
+    -3.3434722419313598E-04,
+     0.0000000000000000E+00,
+    -3.0695323516940034E-04,
+    -2.7678508344407374E-04,
+    -8.1100197120683376E-05,
+    -5.5977755563452268E-05,
+    -5.5539986769999748E-05,
+    -6.0467158707421407E-05,
+    -7.3951553069390040E-06,
+    -7.2388605659584604E-06,
+    -7.2262719705644148E-06,
+    -7.2249780782639476E-05,
+    -2.3870964732658313E-05,
+    -2.4668357460680754E-05,
+    -2.1310078871150635E-04,
+    -2.3519322400270866E-04,
+    -3.0007371585479638E-04,
+    -1.2989998233222110E-04,
+    -4.0278792412423835E-05,
+    -5.5469084875220256E-05,
+    -4.0650730914887306E-06,
+    -7.5557767696256210E-05,
+    -1.2833156280448132E-04,
+    -3.6420940424237947E-05,
+    -3.2986527958886377E-04,
+    -3.0695323516940034E-04,
+     0.0000000000000000E+00,
+    -2.6371519471451662E-04,
+    -8.6178649181297749E-05,
+    -3.7339489855023796E-05,
+    -3.6704435268909633E-05,
+    -1.2107872895755385E-05,
+    -1.6420816888732177E-06,
+    -1.6428600297204946E-06,
+    -1.6437768982594971E-06,
+    -8.3592605085950293E-05,
+    -2.3900456817041149E-05,
+    -2.4880154150992002E-05,
+    -1.3120551169913320E-05,
+    -2.7156219717614954E-05,
+    -1.3744236191054444E-04,
+    -7.5850170079269828E-05,
+    -1.5646189905833296E-05,
+    -9.9707327996693485E-06,
+    -7.8907163372913910E-07,
+    -1.4173363844591718E-04,
+    -2.6748604996934474E-04,
+    -2.7096604936102084E-04,
+    -3.3834012113217175E-04,
+    -2.7678508344407374E-04,
+    -2.6371519471451662E-04,
+     0.0000000000000000E+00,
+    -9.0972092282500105E-05,
+    -9.4041485825780474E-05,
+    -9.3956277817202857E-05,
+    -3.1897388670911424E-05,
+    -2.5443402780410897E-06,
+    -4.7804970496729728E-06,
+    -6.4772958444114568E-06,
+    -5.7342318423766300E-06,
+    -1.3965327132901078E-06,
+    -1.4344320738802199E-06,
+    -3.8462113187416048E-06,
+    -5.7594203809823474E-06,
+    -2.5611335502640310E-05,
+    -8.6988565513488398E-06,
+    -2.1011366870973566E-06,
+    -1.7479689957568670E-06,
+    -1.5694957487056763E-07,
+    -1.1650003182153538E-05,
+    -4.5153093292049487E-05,
+    -2.6615622706294422E-05,
+    -9.7048388670583507E-05,
+    -8.1100197120683376E-05,
+    -8.6178649181297749E-05,
+    -9.0972092282500105E-05,
+     0.0000000000000000E+00,
+    -2.6951142859121278E-05,
+    -2.6925495177073011E-05,
+    -2.3813734321003492E-06,
+    -2.5036176384920343E-07,
+    -3.8629843365722069E-07,
+    -4.6879107454357379E-07,
+    -2.2187169769796209E-06,
+    -4.2012861497980493E-07,
+    -4.3468277577768210E-07,
+    -1.4174098133236253E-06,
+    -2.8817802461665015E-06,
+    -1.4678638520198758E-05,
+    -9.2314793481245025E-06,
+    -2.1109847369360179E-06,
+    -1.2637556169459556E-06,
+    -1.1510853847254738E-07,
+    -2.2146434082917951E-05,
+    -7.3724358543479643E-05,
+    -7.7413223315241461E-05,
+    -9.9908531154498537E-05,
+    -5.5977755563452268E-05,
+    -3.7339489855023796E-05,
+    -9.4041485825780474E-05,
+    -2.6951142859121278E-05,
+     0.0000000000000000E+00,
+    -2.7877665636065321E-05,
+    -5.7206874892830496E-06,
+    -4.8633100844765060E-07,
+    -7.9357516176902684E-07,
+    -1.6164049720303669E-06,
+    -5.8297229673572980E-07,
+    -1.9378033584528666E-07,
+    -1.6165885058325796E-07,
+    -1.3963487662322661E-06,
+    -2.8460846702462611E-06,
+    -1.4559474654939719E-05,
+    -9.2299846727704527E-06,
+    -2.1028011684204667E-06,
+    -1.2524153114775943E-06,
+    -1.1404492534346648E-07,
+    -2.2342499146652671E-05,
+    -7.4045325415168323E-05,
+    -7.8042317721008705E-05,
+    -9.9825558425687108E-05,
+    -5.5539986769999748E-05,
+    -3.6704435268909633E-05,
+    -9.3956277817202857E-05,
+    -2.6925495177073011E-05,
+    -2.7877665636065321E-05,
+     0.0000000000000000E+00,
+    -5.8262901350233221E-06,
+    -4.4926746057739890E-07,
+    -1.2019765625319928E-06,
+    -1.2110303804171233E-06,
+    -5.6852132369787976E-07,
+    -1.5662269361342180E-07,
+    -1.9593159190638808E-07,
+    -7.9038779692284556E-06,
+    -4.1941833949543987E-05,
+    -1.3103866989467309E-04,
+    -2.7553151527835338E-04,
+    -2.8191511825878524E-04,
+    -7.2729037336488977E-05,
+    -5.5872023947403454E-06,
+    -3.4124099486773613E-04,
+    -2.6644964529172352E-04,
+    -2.6359277087043914E-04,
+    -1.3606397428917632E-04,
+    -6.0467158707421407E-05,
+    -1.2107872895755385E-05,
+    -3.1897388670911424E-05,
+    -2.3813734321003492E-06,
+    -5.7206874892830496E-06,
+    -5.8262901350233221E-06,
+     0.0000000000000000E+00,
+    -9.3734323851495704E-05,
+    -9.5401623298719052E-05,
+    -9.3603007722154437E-05,
+    -1.2632602697062978E-06,
+    -1.0569696671222029E-06,
+    -1.0661592279085020E-06,
+    -1.9564382122056805E-06,
+    -1.0898033413730021E-05,
+    -2.5061507059905449E-05,
+    -8.0977051778841693E-05,
+    -9.7716456210571610E-05,
+    -2.8164139299048408E-05,
+    -2.6312483081047846E-06,
+    -1.0023296468597344E-04,
+    -4.6069337779644989E-05,
+    -2.5669669057519816E-05,
+    -1.2080238078612212E-05,
+    -7.3951553069390040E-06,
+    -1.6420816888732177E-06,
+    -2.5443402780410897E-06,
+    -2.5036176384920343E-07,
+    -4.8633100844765060E-07,
+    -4.4926746057739890E-07,
+    -9.3734323851495704E-05,
+     0.0000000000000000E+00,
+    -2.7999125929227990E-05,
+    -2.7445372837541784E-05,
+    -2.7319187784809286E-07,
+    -3.0443098903541463E-07,
+    -2.8258325898461687E-07,
+    -1.0501462068162272E-06,
+    -4.7246889697872993E-06,
+    -1.5139906575512484E-05,
+    -6.0868991140867310E-05,
+    -4.3947896781916756E-05,
+    -8.1057807644693474E-06,
+    -7.1308252366314582E-07,
+    -1.0152991790877720E-04,
+    -6.7870592718373527E-05,
+    -6.3926947107776995E-05,
+    -1.8421854885368894E-05,
+    -7.2388605659584604E-06,
+    -1.6428600297204946E-06,
+    -4.7804970496729728E-06,
+    -3.8629843365722069E-07,
+    -7.9357516176902684E-07,
+    -1.2019765625319928E-06,
+    -9.5401623298719052E-05,
+    -2.7999125929227990E-05,
+     0.0000000000000000E+00,
+    -2.7987219768749384E-05,
+    -1.8224920881708162E-07,
+    -1.4024909244500760E-07,
+    -1.7594771597718708E-07,
+    -8.3625778933224859E-07,
+    -3.5342577305622566E-06,
+    -1.2538947435098937E-05,
+    -5.1117942721337577E-05,
+    -2.8476342951628308E-05,
+    -5.3227568720511408E-06,
+    -4.6971195864804346E-07,
+    -9.9842370466177535E-05,
+    -7.5072583546489683E-05,
+    -8.0590998801923302E-05,
+    -2.2398232512075807E-05,
+    -7.2262719705644148E-06,
+    -1.6437768982594971E-06,
+    -6.4772958444114568E-06,
+    -4.6879107454357379E-07,
+    -1.6164049720303669E-06,
+    -1.2110303804171233E-06,
+    -9.3603007722154437E-05,
+    -2.7445372837541784E-05,
+    -2.7987219768749384E-05,
+     0.0000000000000000E+00,
+    -1.5682743978644249E-07,
+    -1.3274060886301907E-07,
+    -1.1609269963757716E-07,
+    -9.1701340286622145E-05,
+    -9.6993574508321271E-05,
+    -8.0269703742761562E-05,
+    -2.2442483714697281E-05,
+    -1.5351345923508336E-05,
+    -4.5860084481886938E-05,
+    -5.8989089058618619E-06,
+    -5.6767853893970779E-06,
+    -4.6415844144981817E-06,
+    -1.2048315882835148E-06,
+    -1.7410612338323094E-05,
+    -7.2249780782639476E-05,
+    -8.3592605085950293E-05,
+    -5.7342318423766300E-06,
+    -2.2187169769796209E-06,
+    -5.8297229673572980E-07,
+    -5.6852132369787976E-07,
+    -1.2632602697062978E-06,
+    -2.7319187784809286E-07,
+    -1.8224920881708162E-07,
+    -1.5682743978644249E-07,
+     0.0000000000000000E+00,
+    -2.7931943958514027E-05,
+    -2.7898743728921289E-05,
+    -9.9601393208374251E-05,
+    -1.0493705318574600E-04,
+    -5.7543308564291951E-05,
+    -1.6822361928532675E-05,
+    -2.3023421458753428E-05,
+    -7.5661509067853402E-05,
+    -1.9581535099097794E-05,
+    -3.5086060778379727E-06,
+    -1.9466671327606459E-06,
+    -5.7721399074214548E-07,
+    -4.4721158076063165E-06,
+    -2.3870964732658313E-05,
+    -2.3900456817041149E-05,
+    -1.3965327132901078E-06,
+    -4.2012861497980493E-07,
+    -1.9378033584528666E-07,
+    -1.5662269361342180E-07,
+    -1.0569696671222029E-06,
+    -3.0443098903541463E-07,
+    -1.4024909244500760E-07,
+    -1.3274060886301907E-07,
+    -2.7931943958514027E-05,
+     0.0000000000000000E+00,
+    -3.0310710296877979E-05,
+    -9.9473629825869641E-05,
+    -1.0479404218837785E-04,
+    -5.8346582798046130E-05,
+    -1.6988609861663693E-05,
+    -2.2780713798588845E-05,
+    -7.4819602215720044E-05,
+    -1.9015890037869198E-05,
+    -3.5520814911312517E-06,
+    -1.9848534044355712E-06,
+    -5.8644351306963382E-07,
+    -4.5972532834924565E-06,
+    -2.4668357460680754E-05,
+    -2.4880154150992002E-05,
+    -1.4344320738802199E-06,
+    -4.3468277577768210E-07,
+    -1.6165885058325796E-07,
+    -1.9593159190638808E-07,
+    -1.0661592279085020E-06,
+    -2.8258325898461687E-07,
+    -1.7594771597718708E-07,
+    -1.1609269963757716E-07,
+    -2.7898743728921289E-05,
+    -3.0310710296877979E-05,
+     0.0000000000000000E+00
+  ],
+  "non-additive pairwise energy": [
+     0.0000000000000000E+00,
+    -5.5818016815129370E-07,
+    -9.5427086511448793E-07,
+    -1.3362399532440823E-07,
+     5.4141288794631597E-07,
+     5.5014741243902180E-07,
+     3.5071837961263712E-07,
+     2.7423532197693595E-07,
+     3.6136546548005907E-07,
+    -5.4140302632209347E-07,
+     4.3075686472458775E-07,
+    -2.7731800209206142E-07,
+     3.3456016889878700E-07,
+     1.8083168664663645E-07,
+     1.6243935257685368E-07,
+    -1.0193414307122261E-07,
+    -1.0892553276507677E-07,
+    -3.9776343561405934E-07,
+    -2.0655086489651999E-07,
+    -2.1973190458782847E-07,
+    -2.8897841085448624E-07,
+     2.4176831509754702E-07,
+     1.3417116759999097E-08,
+     4.3396686545483256E-08,
+    -5.5818016815129370E-07,
+     0.0000000000000000E+00,
+    -3.9333429331390204E-07,
+    -1.3339910098503762E-07,
+     4.2275408820542614E-07,
+     1.7706853643539428E-07,
+    -1.1579975416759705E-07,
+     1.1431272626757261E-07,
+     5.5793783592886312E-07,
+     1.5880602150687605E-07,
+     1.8869533230016190E-07,
+     2.5273545004781212E-08,
+     4.9055669922392900E-07,
+     5.1735849187707837E-07,
+     2.2743790416544586E-07,
+     1.4836637048269889E-08,
+     5.7076975028059787E-09,
+     3.1951229740651075E-07,
+     1.4549068074966735E-07,
+     2.9402964656841420E-08,
+    -8.6990188004496124E-08,
+     9.6365764102434852E-08,
+    -4.2164462682138178E-07,
+    -4.0133137475281024E-07,
+    -9.5427086511448793E-07,
+    -3.9333429331390204E-07,
+     0.0000000000000000E+00,
+     2.5481280885551349E-08,
+     2.7265457406376242E-08,
+    -4.8414135681447474E-07,
+    -1.3794125417431996E-07,
+    -6.5420145125965508E-08,
+    -2.6565050358473080E-07,
+     3.7012046772403400E-07,
+    -9.6857745820877041E-08,
+     2.3579779296935078E-08,
+     2.7755487482325229E-08,
+     6.9599747271054987E-09,
+     5.1244160518390970E-08,
+     6.0544196805341204E-08,
+     5.6562860263394619E-08,
+     1.9894684890153340E-07,
+     2.1680469035547202E-07,
+     2.9606432116632998E-07,
+     2.6741346418303149E-07,
+    -2.9887266757639434E-07,
+    -3.5024613590641145E-07,
+    -3.4965967344756676E-07,
+    -1.3362399532440823E-07,
+    -1.3339910098503762E-07,
+     2.5481280885551349E-08,
+     0.0000000000000000E+00,
+    -4.3380591578318424E-07,
+    -5.2675192700615558E-07,
+    -1.7673306288528761E-07,
+    -1.4718251010087156E-07,
+    -1.2987112986729356E-07,
+     1.7279876653456563E-07,
+     2.6778540119714611E-07,
+     3.1556950536192052E-07,
+     7.8664881980542941E-07,
+     4.9773561598642041E-07,
+     2.5808947351739070E-07,
+     2.1624709839321954E-07,
+     2.1139236085135806E-07,
+    -4.1778976912199127E-07,
+    -2.9246785448458784E-07,
+    -7.6995746569983057E-08,
+    -7.6565391656008674E-08,
+     1.7305592251652839E-07,
+     4.5478228702434231E-08,
+     5.0705658423384615E-08,
+     5.4141288794631597E-07,
+     4.2275408820542614E-07,
+     2.7265457406376242E-08,
+    -4.3380591578318424E-07,
+     0.0000000000000000E+00,
+     2.0201772655325496E-07,
+    -2.8317311298427396E-07,
+     1.1449877775475858E-07,
+     5.3136503050762091E-07,
+     6.8488855959572706E-07,
+     6.1230580639686282E-07,
+     9.2062151788794638E-07,
+     1.0220765378214869E-06,
+     2.5534590728211062E-07,
+    -1.3733418412412464E-07,
+    -9.7767723486128123E-08,
+    -1.0480302988828159E-07,
+     3.6667821432476295E-07,
+     6.1621724252074357E-08,
+     2.7745146090503918E-07,
+     2.6682572910949132E-07,
+     4.0694606993524778E-07,
+     2.4838139869514236E-07,
+     2.5274954229574279E-07,
+     5.5014741243902180E-07,
+     1.7706853643539428E-07,
+    -4.8414135681447474E-07,
+    -5.2675192700615558E-07,
+     2.0201772655325496E-07,
+     0.0000000000000000E+00,
+    -6.3059561224781570E-07,
+     3.1632780577858962E-07,
+     8.1172329278478809E-07,
+    -1.8896555867081675E-08,
+     4.7989520905054228E-07,
+     4.6973390743798565E-07,
+     8.8490482446227683E-07,
+    -1.8070317190642868E-07,
+    -2.2064100832712389E-07,
+    -2.6129142349944404E-07,
+    -2.6951762516482129E-07,
+     6.3610525513335331E-07,
+     2.6633612912460562E-07,
+     3.2465122050617484E-07,
+     2.0789180286384540E-07,
+     4.1704263614021229E-07,
+     2.2329903249912613E-07,
+     2.3495383074599226E-07,
+     3.5071837961263712E-07,
+    -1.1579975416759705E-07,
+    -1.3794125417431996E-07,
+    -1.7673306288528761E-07,
+    -2.8317311298427396E-07,
+    -6.3059561224781570E-07,
+     0.0000000000000000E+00,
+     2.0672160411673208E-07,
+    -1.2414813673715268E-07,
+    -3.9501051477411241E-07,
+    -2.0352459381467642E-07,
+     2.1621601255618873E-07,
+     8.1465199759590245E-08,
+    -3.9640683039512528E-07,
+    -1.2139686211483074E-07,
+    -1.1698983901517939E-07,
+    -1.1889349575332904E-07,
+     2.0476648480297564E-07,
+     1.5887419791382274E-07,
+     2.6363752523021997E-08,
+    -8.0505574831655802E-08,
+     2.0505075161747002E-07,
+     2.0240934266090423E-07,
+     2.0421343032041277E-07,
+     2.7423532197693595E-07,
+     1.1431272626757261E-07,
+    -6.5420145125965508E-08,
+    -1.4718251010087156E-07,
+     1.1449877775475858E-07,
+     3.1632780577858962E-07,
+     2.0672160411673208E-07,
+     0.0000000000000000E+00,
+     1.4746610634183885E-07,
+    -2.3554468139256276E-07,
+     4.1143136665288606E-07,
+     4.2716180610172607E-07,
+     7.5631837001898656E-07,
+     3.4336341399431738E-07,
+     1.7190267298876507E-07,
+     2.2060999033165014E-07,
+     2.2099195894678612E-07,
+    -5.7718762257661159E-07,
+    -3.1491664575591832E-07,
+    -3.0197674054461189E-07,
+    -4.0090669274309827E-07,
+     1.5921986619141016E-07,
+    -6.2364534561069800E-08,
+    -5.0737761319917661E-08,
+     3.6136546548005907E-07,
+     5.5793783592886312E-07,
+    -2.6565050358473080E-07,
+    -1.2987112986729356E-07,
+     5.3136503050762091E-07,
+     8.1172329278478809E-07,
+    -1.2414813673715268E-07,
+     1.4746610634183885E-07,
+     0.0000000000000000E+00,
+    -8.6848030329210677E-07,
+     1.6583699983763697E-07,
+     3.4333424909108508E-08,
+     6.5646749219692744E-07,
+     8.6842698131162968E-08,
+     6.5033664010111122E-09,
+    -1.3301589863806527E-07,
+    -1.3407347090350879E-07,
+     1.5465235105189213E-07,
+     9.6251358389365039E-08,
+     3.4078776934388466E-08,
+    -5.8793125070849653E-08,
+     2.2561165228628428E-07,
+    -1.8022108875480915E-07,
+    -1.6727409109273770E-07,
+    -5.4140302632209347E-07,
+     1.5880602150687605E-07,
+     3.7012046772403400E-07,
+     1.7279876653456563E-07,
+     6.8488855959572706E-07,
+    -1.8896555867081675E-08,
+    -3.9501051477411241E-07,
+    -2.3554468139256276E-07,
+    -8.6848030329210677E-07,
+     0.0000000000000000E+00,
+    -4.2875314690945322E-08,
+     4.7959679603668569E-07,
+     6.6757656791428544E-07,
+     5.0122860632477961E-07,
+     3.0810093758874711E-07,
+     2.1927900467593211E-07,
+     2.2067092989916662E-07,
+     4.9518842789612823E-07,
+     3.3680978892284884E-07,
+     2.8355612228216732E-07,
+     2.2566742695753217E-07,
+    -1.9570622698316363E-07,
+    -2.3394838914190857E-07,
+    -2.2922065196568182E-07,
+     4.3075686472458775E-07,
+     1.8869533230016190E-07,
+    -9.6857745820877041E-08,
+     2.6778540119714611E-07,
+     6.1230580639686282E-07,
+     4.7989520905054228E-07,
+    -2.0352459381467642E-07,
+     4.1143136665288606E-07,
+     1.6583699983763697E-07,
+    -4.2875314690945322E-08,
+     0.0000000000000000E+00,
+    -1.0094833515486389E-07,
+     1.2220043917982914E-07,
+    -6.9423998896758973E-07,
+    -3.9201701095558127E-07,
+    -4.5943743790813813E-07,
+    -4.6327229690164096E-07,
+     4.9286958366382593E-07,
+     2.3754569650365758E-07,
+     2.7428331385481903E-07,
+     2.4730164350956949E-07,
+     2.5559435498676823E-07,
+     7.8209793607844012E-08,
+     9.1434392437892094E-08,
+    -2.7731800209206142E-07,
+     2.5273545004781212E-08,
+     2.3579779296935078E-08,
+     3.1556950536192052E-07,
+     9.2062151788794638E-07,
+     4.6973390743798565E-07,
+     2.1621601255618873E-07,
+     4.2716180610172607E-07,
+     3.4333424909108508E-08,
+     4.7959679603668569E-07,
+    -1.0094833515486389E-07,
+     0.0000000000000000E+00,
+    -3.7654788002100870E-07,
+    -5.0727469466207377E-07,
+    -4.5630298347189905E-07,
+    -1.4628836412279348E-07,
+    -1.4664758742266106E-07,
+     8.8644070373957565E-07,
+     3.5725968545868611E-07,
+     3.6266612677450923E-07,
+     3.2897686631881186E-07,
+    -2.0525114282073925E-07,
+     5.8911335703230220E-08,
+     5.6708681664345638E-08,
+     3.3456016889878700E-07,
+     4.9055669922392900E-07,
+     2.7755487482325229E-08,
+     7.8664881980542941E-07,
+     1.0220765378214869E-06,
+     8.8490482446227683E-07,
+     8.1465199759590245E-08,
+     7.5631837001898656E-07,
+     6.5646749219692744E-07,
+     6.6757656791428544E-07,
+     1.2220043917982914E-07,
+    -3.7654788002100870E-07,
+     0.0000000000000000E+00,
+     2.9316331680841033E-07,
+    -4.8065122408804431E-08,
+     2.6484536161350760E-07,
+     2.6453793999033965E-07,
+     1.2886143903654633E-07,
+    -1.8247492775820134E-07,
+    -1.3007339036112698E-07,
+    -1.6485613542018813E-07,
+     5.3774708886043099E-08,
+     2.4998452943867851E-07,
+     2.4939658932261316E-07,
+     1.8083168664663645E-07,
+     5.1735849187707837E-07,
+     6.9599747271054987E-09,
+     4.9773561598642041E-07,
+     2.5534590728211062E-07,
+    -1.8070317190642868E-07,
+    -3.9640683039512528E-07,
+     3.4336341399431738E-07,
+     8.6842698131162968E-08,
+     5.0122860632477961E-07,
+    -6.9423998896758973E-07,
+    -5.0727469466207377E-07,
+     2.9316331680841033E-07,
+     0.0000000000000000E+00,
+     1.2604944349896944E-07,
+     1.3321145695156603E-07,
+     1.2306330051680447E-07,
+     6.0776715768075731E-07,
+    -6.3366594983472892E-08,
+     2.1337657476319766E-07,
+     2.7561871921113634E-07,
+     2.1525717495781734E-07,
+    -1.2909430070784789E-07,
+    -1.1882624833122437E-07,
+     1.6243935257685368E-07,
+     2.2743790416544586E-07,
+     5.1244160518390970E-08,
+     2.5808947351739070E-07,
+    -1.3733418412412464E-07,
+    -2.2064100832712389E-07,
+    -1.2139686211483074E-07,
+     1.7190267298876507E-07,
+     6.5033664010111122E-09,
+     3.0810093758874711E-07,
+    -3.9201701095558127E-07,
+    -4.5630298347189905E-07,
+    -4.8065122408804431E-08,
+     1.2604944349896944E-07,
+     0.0000000000000000E+00,
+     2.1402380740133345E-07,
+     2.1044425773125676E-07,
+    -9.2050925380595475E-08,
+    -1.3701847779392721E-07,
+    -6.7293893830130526E-08,
+    -6.7439792858720454E-08,
+     1.2202912259406037E-07,
+    -7.4923164479253377E-09,
+    -6.7858756803391448E-10,
+    -1.0193414307122261E-07,
+     1.4836637048269889E-08,
+     6.0544196805341204E-08,
+     2.1624709839321954E-07,
+    -9.7767723486128123E-08,
+    -2.6129142349944404E-07,
+    -1.1698983901517939E-07,
+     2.2060999033165014E-07,
+    -1.3301589863806527E-07,
+     2.1927900467593211E-07,
+    -4.5943743790813813E-07,
+    -1.4628836412279348E-07,
+     2.6484536161350760E-07,
+     1.3321145695156603E-07,
+     2.1402380740133345E-07,
+     0.0000000000000000E+00,
+     3.2682798332632422E-07,
+     2.5728472763842025E-07,
+    -3.3407054780077706E-08,
+     2.9070608610713508E-08,
+     1.6038638201808373E-07,
+    -1.7997261070483725E-08,
+     4.8720808224543718E-09,
+    -8.0387894766421501E-08,
+    -1.0892553276507677E-07,
+     5.7076975028059787E-09,
+     5.6562860263394619E-08,
+     2.1139236085135806E-07,
+    -1.0480302988828159E-07,
+    -2.6951762516482129E-07,
+    -1.1889349575332904E-07,
+     2.2099195894678612E-07,
+    -1.3407347090350879E-07,
+     2.2067092989916662E-07,
+    -4.6327229690164096E-07,
+    -1.4664758742266106E-07,
+     2.6453793999033965E-07,
+     1.2306330051680447E-07,
+     2.1044425773125676E-07,
+     3.2682798332632422E-07,
+     0.0000000000000000E+00,
+     2.6070341957039883E-07,
+    -7.8321400796172217E-08,
+     1.5013889386046954E-07,
+     1.0835165727464658E-07,
+    -2.4533317773103012E-08,
+    -8.4692693333392857E-08,
+     6.6277970214454966E-09,
+    -3.9776343561405934E-07,
+     3.1951229740651075E-07,
+     1.9894684890153340E-07,
+    -4.1778976912199127E-07,
+     3.6667821432476295E-07,
+     6.3610525513335331E-07,
+     2.0476648480297564E-07,
+    -5.7718762257661159E-07,
+     1.5465235105189213E-07,
+     4.9518842789612823E-07,
+     4.9286958366382593E-07,
+     8.8644070373957565E-07,
+     1.2886143903654633E-07,
+     6.0776715768075731E-07,
+    -9.2050925380595475E-08,
+     2.5728472763842025E-07,
+     2.6070341957039883E-07,
+     0.0000000000000000E+00,
+     1.2327090080724895E-07,
+     1.8703811858677177E-07,
+     1.5656717911934086E-08,
+    -2.2352478908059766E-07,
+    -2.3593958155715627E-07,
+    -2.2586423516635692E-07,
+    -2.0655086489651999E-07,
+     1.4549068074966735E-07,
+     2.1680469035547202E-07,
+    -2.9246785448458784E-07,
+     6.1621724252074357E-08,
+     2.6633612912460562E-07,
+     1.5887419791382274E-07,
+    -3.1491664575591832E-07,
+     9.6251358389365039E-08,
+     3.3680978892284884E-07,
+     2.3754569650365758E-07,
+     3.5725968545868611E-07,
+    -1.8247492775820134E-07,
+    -6.3366594983472892E-08,
+    -1.3701847779392721E-07,
+    -3.3407054780077706E-08,
+    -7.8321400796172217E-08,
+     1.2327090080724895E-07,
+     0.0000000000000000E+00,
+     2.3680212382155266E-07,
+     1.4337769169755407E-07,
+    -7.2103174725118532E-08,
+    -4.3443069158372569E-08,
+    -6.5450873268804130E-08,
+    -2.1973190458782847E-07,
+     2.9402964656841420E-08,
+     2.9606432116632998E-07,
+    -7.6995746569983057E-08,
+     2.7745146090503918E-07,
+     3.2465122050617484E-07,
+     2.6363752523021997E-08,
+    -3.0197674054461189E-07,
+     3.4078776934388466E-08,
+     2.8355612228216732E-07,
+     2.7428331385481903E-07,
+     3.6266612677450923E-07,
+    -1.3007339036112698E-07,
+     2.1337657476319766E-07,
+    -6.7293893830130526E-08,
+     2.9070608610713508E-08,
+     1.5013889386046954E-07,
+     1.8703811858677177E-07,
+     2.3680212382155266E-07,
+     0.0000000000000000E+00,
+     3.3228745292922959E-07,
+    -3.0179427336353325E-08,
+    -7.0634895347516680E-08,
+     1.2888626689209382E-08,
+    -2.8897841085448624E-07,
+    -8.6990188004496124E-08,
+     2.6741346418303149E-07,
+    -7.6565391656008674E-08,
+     2.6682572910949132E-07,
+     2.0789180286384540E-07,
+    -8.0505574831655802E-08,
+    -4.0090669274309827E-07,
+    -5.8793125070849653E-08,
+     2.2566742695753217E-07,
+     2.4730164350956949E-07,
+     3.2897686631881186E-07,
+    -1.6485613542018813E-07,
+     2.7561871921113634E-07,
+    -6.7439792858720454E-08,
+     1.6038638201808373E-07,
+     1.0835165727464658E-07,
+     1.5656717911934086E-08,
+     1.4337769169755407E-07,
+     3.3228745292922959E-07,
+     0.0000000000000000E+00,
+    -4.7651558851066849E-08,
+    -3.1155560189505626E-08,
+    -8.7912515283386865E-08,
+     2.4176831509754702E-07,
+     9.6365764102434852E-08,
+    -2.9887266757639434E-07,
+     1.7305592251652839E-07,
+     4.0694606993524778E-07,
+     4.1704263614021229E-07,
+     2.0505075161747002E-07,
+     1.5921986619141016E-07,
+     2.2561165228628428E-07,
+    -1.9570622698316363E-07,
+     2.5559435498676823E-07,
+    -2.0525114282073925E-07,
+     5.3774708886043099E-08,
+     2.1525717495781734E-07,
+     1.2202912259406037E-07,
+    -1.7997261070483725E-08,
+    -2.4533317773103012E-08,
+    -2.2352478908059766E-07,
+    -7.2103174725118532E-08,
+    -3.0179427336353325E-08,
+    -4.7651558851066849E-08,
+     0.0000000000000000E+00,
+     9.5945760193865255E-08,
+     1.0579986697060028E-07,
+     1.3417116759999097E-08,
+    -4.2164462682138178E-07,
+    -3.5024613590641145E-07,
+     4.5478228702434231E-08,
+     2.4838139869514236E-07,
+     2.2329903249912613E-07,
+     2.0240934266090423E-07,
+    -6.2364534561069800E-08,
+    -1.8022108875480915E-07,
+    -2.3394838914190857E-07,
+     7.8209793607844012E-08,
+     5.8911335703230220E-08,
+     2.4998452943867851E-07,
+    -1.2909430070784789E-07,
+    -7.4923164479253377E-09,
+     4.8720808224543718E-09,
+    -8.4692693333392857E-08,
+    -2.3593958155715627E-07,
+    -4.3443069158372569E-08,
+    -7.0634895347516680E-08,
+    -3.1155560189505626E-08,
+     9.5945760193865255E-08,
+     0.0000000000000000E+00,
+     2.9299793762785414E-07,
+     4.3396686545483256E-08,
+    -4.0133137475281024E-07,
+    -3.4965967344756676E-07,
+     5.0705658423384615E-08,
+     2.5274954229574279E-07,
+     2.3495383074599226E-07,
+     2.0421343032041277E-07,
+    -5.0737761319917661E-08,
+    -1.6727409109273770E-07,
+    -2.2922065196568182E-07,
+     9.1434392437892094E-08,
+     5.6708681664345638E-08,
+     2.4939658932261316E-07,
+    -1.1882624833122437E-07,
+    -6.7858756803391448E-10,
+    -8.0387894766421501E-08,
+     6.6277970214454966E-09,
+    -2.2586423516635692E-07,
+    -6.5450873268804130E-08,
+     1.2888626689209382E-08,
+    -8.7912515283386865E-08,
+     1.0579986697060028E-07,
+     2.9299793762785414E-07,
+     0.0000000000000000E+00
+  ]
+}
diff --git a/include/dftd4.h b/include/dftd4.h
index 495ac619..47a82e15 100644
--- a/include/dftd4.h
+++ b/include/dftd4.h
@@ -25,6 +25,7 @@
 #define DFTD4_API_CALL
 #define DFTD4_API_SUFFIX__V_3_0
 #define DFTD4_API_SUFFIX__V_3_1
+#define DFTD4_API_SUFFIX__V_3_2
 
 /// Error handle class
 typedef struct _dftd4_error* dftd4_error;
@@ -161,3 +162,12 @@ dftd4_get_dispersion(dftd4_error /* error */,
                      double* /* energy */,
                      double* /* gradient[n][3] */,
                      double* /* sigma[3][3] */) DFTD4_API_SUFFIX__V_3_0;
+
+/// Evaluate the pairwise representation of the dispersion energy
+DFTD4_API_ENTRY void DFTD4_API_CALL
+dftd4_get_pairwise_dispersion(dftd4_error /* error */,
+                              dftd4_structure /* mol */,
+                              dftd4_model /* disp */,
+                              dftd4_param /* param */,
+                              double* /* pair_energy2[n][n] */,
+                              double* /* pair_energy3[n][n] */) DFTD4_API_SUFFIX__V_3_2;
diff --git a/man/dftd4.1.adoc b/man/dftd4.1.adoc
index 46fe693c..cf1422d8 100644
--- a/man/dftd4.1.adoc
+++ b/man/dftd4.1.adoc
@@ -52,6 +52,9 @@ Specify the functional to select the correct parameters.
 *--property*::
      Print atomic properties and molecular C6-coefficient
 
+*--pair-resolved*::
+     Calculate pairwise representation of dispersion energy
+
 *--version*::
      Prints version number and citation
 
diff --git a/python/dftd4/ase.py b/python/dftd4/ase.py
index 58da1067..ee58e58c 100644
--- a/python/dftd4/ase.py
+++ b/python/dftd4/ase.py
@@ -206,10 +206,10 @@ def calculate(
             raise CalculationFailed("dftd4 could not evaluate input")
 
         # These properties are garanteed to exist for all implemented calculators
-        self.results["energy"] = _res.get_energy() * Hartree
+        self.results["energy"] = _res.get("energy") * Hartree
         self.results["free_energy"] = self.results["energy"]
-        self.results["forces"] = -_res.get_gradient() * Hartree / Bohr
+        self.results["forces"] = -_res.get("gradient") * Hartree / Bohr
         # stress tensor is only returned for periodic systems
         if self.atoms.pbc.any():
-            _stress = _res.get_virial() * Hartree / self.atoms.get_volume()
+            _stress = _res.get("virial") * Hartree / self.atoms.get_volume()
             self.results["stress"] = _stress.flat[[0, 4, 8, 5, 2, 1]]
diff --git a/python/dftd4/interface.py b/python/dftd4/interface.py
index 9477dcae..e61e5784 100644
--- a/python/dftd4/interface.py
+++ b/python/dftd4/interface.py
@@ -219,7 +219,7 @@ def __init__(
         else:
             self._disp = new_d4_model(self._mol)
 
-    def get_dispersion(self, param: DampingParam, grad: bool) -> Results:
+    def get_dispersion(self, param: DampingParam, grad: bool) -> dict:
         """Perform actual evaluation of the dispersion correction"""
 
         _error = new_error()
@@ -243,7 +243,35 @@ def get_dispersion(self, param: DampingParam, grad: bool) -> Results:
 
         handle_error(_error)
 
-        return Results(_energy[0], _gradient, _sigma)
+        results = dict(energy=_energy[0])
+        if _gradient is not None:
+            results.update(gradient=_gradient)
+        if _sigma is not None:
+            results.update(virial=_sigma)
+        return results
+
+    def get_pairwise_dispersion(self, param: DampingParam) -> dict:
+        """Evaluate pairwise representation of the dispersion energy"""
+
+        _error = new_error()
+        _pair_disp2 = np.zeros((len(self), len(self)))
+        _pair_disp3 = np.zeros((len(self), len(self)))
+
+        _lib.dftd4_get_pairwise_dispersion(
+            _error,
+            self._mol,
+            self._disp,
+            param._param,
+            _cast("double*", _pair_disp2),
+            _cast("double*", _pair_disp3),
+        )
+
+        handle_error(_error)
+
+        return {
+            "additive pairwise energy": _pair_disp2,
+            "non-additive pairwise energy": _pair_disp3,
+        }
 
 
 def _cast(ctype, array):
diff --git a/python/dftd4/qcschema.py b/python/dftd4/qcschema.py
index f3156289..2c835e0b 100644
--- a/python/dftd4/qcschema.py
+++ b/python/dftd4/qcschema.py
@@ -26,6 +26,7 @@
 ======================== =========== ============================================
  level_hint               None        Dispersion correction level (allowed: "d4")
  params_tweaks            None        Optional dict with the damping parameters
+ pair_resolved            False       Enable pairwise resolved dispersion energy
 ======================== =========== ============================================
 
 The params_tweaks dict contains the damping parameters, at least s8, a1 and a2
@@ -126,7 +127,9 @@ def run_qcschema(
             return_result=return_result,
             error=qcel.models.ComputeError(
                 error_type="input error",
-                error_message="Level '{}' is invalid for this dispersion correction".format(_level),
+                error_message="Level '{}' is invalid for this dispersion correction".format(
+                    _level
+                ),
             ),
         )
         return qcel.models.AtomicResult(**ret_data)
@@ -160,16 +163,21 @@ def run_qcschema(
             param=param,
             grad=atomic_input.driver == "gradient",
         )
+        extras = {"dftd4": res}
 
         if atomic_input.driver == "gradient":
             if all(atomic_input.molecule.real):
-                fullgrad = res.get_gradient()
+                fullgrad = res.get("gradient")
             else:
                 ireal = np.argwhere(atomic_input.molecule.real).reshape((-1))
                 fullgrad = np.zeros_like(atomic_input.molecule.geometry)
-                fullgrad[ireal, :] = res.get_gradient()
+                fullgrad[ireal, :] = res.get("gradient")
+
+        properties.update(return_energy=res.get("energy"))
 
-        properties.update(return_energy=res.get_energy())
+        if atomic_input.keywords.get("pair_resolved", False):
+            res = disp.get_pairwise_dispersion(param=param)
+            extras["dftd4"].update(res)
 
         success = atomic_input.driver in _supported_drivers
         if atomic_input.driver == "energy":
@@ -184,6 +192,8 @@ def run_qcschema(
                 ),
             )
 
+        ret_data["extras"].update(extras)
+
     except RuntimeError as e:
         ret_data.update(
             error=qcel.models.ComputeError(
diff --git a/src/dftd4.f90 b/src/dftd4.f90
index d0fb8a99..fbd9feb0 100644
--- a/src/dftd4.f90
+++ b/src/dftd4.f90
@@ -16,7 +16,7 @@
 
 module dftd4
    use dftd4_cutoff, only : realspace_cutoff, get_lattice_points
-   use dftd4_disp, only : get_dispersion
+   use dftd4_disp, only : get_dispersion, get_properties, get_pairwise_dispersion
    use dftd4_ncoord, only : get_coordination_number
    use dftd4_damping, only : damping_param
    use dftd4_damping_rational, only : rational_damping_param
diff --git a/src/dftd4/api.f90 b/src/dftd4/api.f90
index 4a4ae8d3..fc119fb1 100644
--- a/src/dftd4/api.f90
+++ b/src/dftd4/api.f90
@@ -26,7 +26,7 @@ module dftd4_api
    use dftd4_cutoff, only : realspace_cutoff
    use dftd4_damping, only : damping_param
    use dftd4_damping_rational, only : rational_damping_param
-   use dftd4_disp, only : get_dispersion, get_properties
+   use dftd4_disp, only : get_dispersion, get_pairwise_dispersion, get_properties
    use dftd4_model, only : d4_model, new_d4_model
    use dftd4_param, only : get_rational_damping
    use dftd4_utils, only : wrap_to_central_cell
@@ -49,7 +49,7 @@ module dftd4_api
    public :: new_rational_damping_api , load_rational_damping_api
    public :: delete_param_api
 
-   public :: get_dispersion_api, get_properties_api
+   public :: get_dispersion_api, get_pairwise_dispersion_api, get_properties_api
 
    !> Namespace for C routines
    character(len=*), parameter :: namespace = "dftd4_"
@@ -527,6 +527,60 @@ subroutine get_dispersion_api(verror, vmol, vdisp, vparam, &
 end subroutine get_dispersion_api
 
 
+!> Calculate pairwise representation of dispersion energy
+subroutine get_pairwise_dispersion_api(verror, vmol, vdisp, vparam, &
+      & c_pair_energy2, c_pair_energy3) &
+      & bind(C, name=namespace//"get_pairwise_dispersion")
+   type(c_ptr), value :: verror
+   type(vp_error), pointer :: error
+   type(c_ptr), value :: vmol
+   type(vp_structure), pointer :: mol
+   type(c_ptr), value :: vdisp
+   type(vp_model), pointer :: disp
+   type(c_ptr), value :: vparam
+   type(vp_param), pointer :: param
+   type(c_ptr), value, intent(in) :: c_pair_energy2
+   real(wp), pointer :: pair_energy2(:, :)
+   type(c_ptr), value, intent(in) :: c_pair_energy3
+   real(wp), pointer :: pair_energy3(:, :)
+
+   if (debug) print'("[Info]",1x, a)', "get_pairwise_dispersion"
+
+   if (.not.c_associated(verror)) return
+   call c_f_pointer(verror, error)
+
+   if (.not.c_associated(vmol)) then
+      call fatal_error(error%ptr, "Molecular structure data is missing")
+      return
+   end if
+   call c_f_pointer(vmol, mol)
+
+   if (.not.c_associated(vdisp)) then
+      call fatal_error(error%ptr, "Dispersion model is missing")
+      return
+   end if
+   call c_f_pointer(vdisp, disp)
+
+   if (.not.c_associated(vparam)) then
+      call fatal_error(error%ptr, "Damping parameters are missing")
+      return
+   end if
+   call c_f_pointer(vparam, param)
+
+   if (.not.allocated(param%ptr)) then
+      call fatal_error(error%ptr, "Damping parameters are not initialized")
+      return
+   end if
+
+   call c_f_pointer(c_pair_energy2, pair_energy2, [mol%ptr%nat, mol%ptr%nat])
+   call c_f_pointer(c_pair_energy3, pair_energy3, [mol%ptr%nat, mol%ptr%nat])
+
+   call get_pairwise_dispersion(mol%ptr, disp%ptr, param%ptr, realspace_cutoff(), &
+      & pair_energy2, pair_energy3)
+
+end subroutine get_pairwise_dispersion_api
+
+
 !> Calculate dispersion
 subroutine get_properties_api(verror, vmol, vdisp, &
       & c_cn, c_charges, c_c6, c_alpha) &
@@ -546,9 +600,6 @@ subroutine get_properties_api(verror, vmol, vdisp, &
    real(c_double), intent(out), optional :: c_alpha(*)
    real(wp), allocatable :: alpha(:)
 
-   integer :: mref
-   real(wp), allocatable :: gwvec(:, :), lattr(:, :)
-
    if (debug) print'("[Info]",1x, a)', "get_properties"
 
    if (.not.c_associated(verror)) return
diff --git a/src/dftd4/damping.f90 b/src/dftd4/damping.f90
index 647504e3..feec4df9 100644
--- a/src/dftd4/damping.f90
+++ b/src/dftd4/damping.f90
@@ -27,6 +27,8 @@ module dftd4_damping
    contains
       procedure(dispersion_interface), deferred :: get_dispersion2
       procedure(dispersion_interface), deferred :: get_dispersion3
+      procedure(pairwise_dispersion_interface), deferred :: get_pairwise_dispersion2
+      procedure(pairwise_dispersion_interface), deferred :: get_pairwise_dispersion3
    end type damping_param
 
 
@@ -75,6 +77,32 @@ subroutine dispersion_interface(self, mol, trans, cutoff, r4r2, &
          !> Dispersion virial
          real(wp), intent(inout), optional :: sigma(:, :)
       end subroutine dispersion_interface
+
+      !> Evaluation of the pairwise representation of the dispersion energy
+      subroutine pairwise_dispersion_interface(self, mol, trans, cutoff, r4r2, c6, energy)
+         import :: structure_type, damping_param, wp
+
+         !> Damping parameters
+         class(damping_param), intent(in) :: self
+
+         !> Molecular structure data
+         class(structure_type), intent(in) :: mol
+
+         !> Lattice points
+         real(wp), intent(in) :: trans(:, :)
+
+         !> Real space cutoff
+         real(wp), intent(in) :: cutoff
+
+         !> Expectation values for r4 over r2 operator
+         real(wp), intent(in) :: r4r2(:)
+
+         !> C6 coefficients for all atom pairs.
+         real(wp), intent(in) :: c6(:, :)
+
+         !> Pairwise representation of the dispersion energy
+         real(wp), intent(inout) :: energy(:, :)
+      end subroutine pairwise_dispersion_interface
    end interface
 
 
diff --git a/src/dftd4/damping/rational.f90 b/src/dftd4/damping/rational.f90
index d0f698bf..999084b0 100644
--- a/src/dftd4/damping/rational.f90
+++ b/src/dftd4/damping/rational.f90
@@ -43,6 +43,12 @@ module dftd4_damping_rational
       !> Evaluate ATM three-body dispersion energy expression
       procedure :: get_dispersion3
 
+      !> Evaluate pairwise representation of additive dispersion energy
+      procedure :: get_pairwise_dispersion2
+
+      !> Evaluate pairwise representation of non-additive dispersion energy
+      procedure :: get_pairwise_dispersion3
+
    end type rational_damping_param
 
 
@@ -234,4 +240,189 @@ subroutine get_dispersion3(self, mol, trans, cutoff, r4r2, c6, dc6dcn, dc6dq, &
 end subroutine get_dispersion3
 
 
+!> Evaluation of the dispersion energy expression projected on atomic pairs
+subroutine get_pairwise_dispersion2(self, mol, trans, cutoff, r4r2, c6, energy)
+
+   !> Damping parameters
+   class(rational_damping_param), intent(in) :: self
+
+   !> Molecular structure data
+   class(structure_type), intent(in) :: mol
+
+   !> Lattice points
+   real(wp), intent(in) :: trans(:, :)
+
+   !> Real space cutoff
+   real(wp), intent(in) :: cutoff
+
+   !> Expectation values for r4 over r2 operator
+   real(wp), intent(in) :: r4r2(:)
+
+   !> C6 coefficients for all atom pairs.
+   real(wp), intent(in) :: c6(:, :)
+
+   !> Dispersion energy
+   real(wp), intent(inout) :: energy(:, :)
+
+   integer :: iat, jat, izp, jzp, jtr
+   real(wp) :: vec(3), r2, cutoff2, r0ij, rrij, c6ij, t6, t8, edisp, dE
+
+   if (abs(self%s6) < epsilon(1.0_wp) .and. abs(self%s8) < epsilon(1.0_wp)) return
+   cutoff2 = cutoff*cutoff
+
+   !$omp parallel do schedule(runtime) default(none) reduction(+:energy) &
+   !$omp shared(mol, self, c6, trans, cutoff2, r4r2) &
+   !$omp private(iat, jat, izp, jzp, jtr, vec, r2, r0ij, rrij, c6ij, &
+   !$omp& t6, t8, edisp, dE)
+   do iat = 1, mol%nat
+      izp = mol%id(iat)
+      do jat = 1, iat
+         jzp = mol%id(jat)
+         rrij = 3*r4r2(izp)*r4r2(jzp)
+         r0ij = self%a1 * sqrt(rrij) + self%a2
+         c6ij = c6(jat, iat)
+         do jtr = 1, size(trans, 2)
+            vec(:) = mol%xyz(:, iat) - (mol%xyz(:, jat) + trans(:, jtr))
+            r2 = vec(1)*vec(1) + vec(2)*vec(2) + vec(3)*vec(3)
+            if (r2 > cutoff2 .or. r2 < epsilon(1.0_wp)) cycle
+
+            t6 = 1.0_wp/(r2**3 + r0ij**6)
+            t8 = 1.0_wp/(r2**4 + r0ij**8)
+
+            edisp = self%s6*t6 + self%s8*rrij*t8
+
+            dE = -c6ij*edisp * 0.5_wp
+
+            energy(jat, iat) = energy(jat, iat) + dE
+            if (iat /= jat) then
+               energy(iat, jat) = energy(iat, jat) + dE
+            end if
+         end do
+      end do
+   end do
+
+end subroutine get_pairwise_dispersion2
+
+
+!> Evaluation of the dispersion energy expression
+subroutine get_pairwise_dispersion3(self, mol, trans, cutoff, r4r2, c6, energy)
+
+   !> Damping parameters
+   class(rational_damping_param), intent(in) :: self
+
+   !> Molecular structure data
+   class(structure_type), intent(in) :: mol
+
+   !> Lattice points
+   real(wp), intent(in) :: trans(:, :)
+
+   !> Real space cutoff
+   real(wp), intent(in) :: cutoff
+
+   !> Expectation values for r4 over r2 operator
+   real(wp), intent(in) :: r4r2(:)
+
+   !> C6 coefficients for all atom pairs.
+   real(wp), intent(in) :: c6(:, :)
+
+   !> Dispersion energy
+   real(wp), intent(inout) :: energy(:, :)
+
+   integer :: iat, jat, kat, izp, jzp, kzp, jtr, ktr
+   real(wp) :: vij(3), vjk(3), vik(3), r2ij, r2jk, r2ik, c6ij, c6jk, c6ik, triple
+   real(wp) :: r0ij, r0jk, r0ik, r0, r1, r2, r3, r5, rr, fdmp, ang
+   real(wp) :: cutoff2, c9, dE
+
+   if (abs(self%s9) < epsilon(1.0_wp)) return
+   cutoff2 = cutoff*cutoff
+
+   !$omp parallel do schedule(runtime) default(none) reduction(+:energy) &
+   !$omp shared(mol, trans, c6, r4r2, cutoff2, self) &
+   !$omp private(iat, jat, kat, izp, jzp, kzp, jtr, ktr, vij, vjk, vik, &
+   !$omp& r2ij, r2jk, r2ik, c6ij, c6jk, c6ik, triple, r0ij, r0jk, r0ik, r0, &
+   !$omp& r1, r2, r3, r5, rr, fdmp, ang, c9, dE)
+   do iat = 1, mol%nat
+      izp = mol%id(iat)
+      do jat = 1, iat
+         jzp = mol%id(jat)
+         c6ij = c6(jat, iat)
+         r0ij = self%a1 * sqrt(3*r4r2(jzp)*r4r2(izp)) + self%a2
+         do jtr = 1, size(trans, 2)
+            vij(:) = mol%xyz(:, jat) + trans(:, jtr) - mol%xyz(:, iat)
+            r2ij = vij(1)*vij(1) + vij(2)*vij(2) + vij(3)*vij(3)
+            if (r2ij > cutoff2 .or. r2ij < epsilon(1.0_wp)) cycle
+            do kat = 1, jat
+               kzp = mol%id(kat)
+               c6ik = c6(kat, iat)
+               c6jk = c6(kat, jat)
+               c9 = -self%s9 * sqrt(abs(c6ij*c6ik*c6jk))
+               r0ik = self%a1 * sqrt(3*r4r2(kzp)*r4r2(izp)) + self%a2
+               r0jk = self%a1 * sqrt(3*r4r2(kzp)*r4r2(jzp)) + self%a2
+               r0 = r0ij * r0ik * r0jk
+               triple = triple_scale(iat, jat, kat)
+               do ktr = 1, size(trans, 2)
+                  vik(:) = mol%xyz(:, kat) + trans(:, ktr) - mol%xyz(:, iat)
+                  r2ik = vik(1)*vik(1) + vik(2)*vik(2) + vik(3)*vik(3)
+                  if (r2ik > cutoff2 .or. r2ik < epsilon(1.0_wp)) cycle
+                  vjk(:) = mol%xyz(:, kat) + trans(:, ktr) - mol%xyz(:, jat) &
+                     & - trans(:, jtr)
+                  r2jk = vjk(1)*vjk(1) + vjk(2)*vjk(2) + vjk(3)*vjk(3)
+                  if (r2jk > cutoff2 .or. r2jk < epsilon(1.0_wp)) cycle
+                  r2 = r2ij*r2ik*r2jk
+                  r1 = sqrt(r2)
+                  r3 = r2 * r1
+                  r5 = r3 * r2
+
+                  fdmp = 1.0_wp / (1.0_wp + 6.0_wp * (r0 / r1)**(self%alp / 3.0_wp))
+                  ang = 0.375_wp*(r2ij + r2jk - r2ik)*(r2ij - r2jk + r2ik)&
+                     & *(-r2ij + r2jk + r2ik) / r5 + 1.0_wp / r3
+
+                  rr = ang*fdmp
+
+                  dE = rr * c9 * triple/6
+                  energy(jat, iat) = energy(jat, iat) - dE
+                  energy(kat, iat) = energy(kat, iat) - dE
+                  energy(iat, jat) = energy(iat, jat) - dE
+                  energy(kat, jat) = energy(kat, jat) - dE
+                  energy(iat, kat) = energy(iat, kat) - dE
+                  energy(jat, kat) = energy(jat, kat) - dE
+               end do
+            end do
+         end do
+      end do
+   end do
+
+end subroutine get_pairwise_dispersion3
+
+
+!> Logic exercise to distribute a triple energy to atomwise energies.
+elemental function triple_scale(ii, jj, kk) result(triple)
+
+   !> Atom indices
+   integer, intent(in) :: ii, jj, kk
+
+   !> Fraction of energy
+   real(wp) :: triple
+
+   if (ii == jj) then
+      if (ii == kk) then
+         ! ii'i" -> 1/6
+         triple = 1.0_wp/6.0_wp
+      else
+         ! ii'j -> 1/2
+         triple = 0.5_wp
+      end if
+   else
+      if (ii /= kk .and. jj /= kk) then
+         ! ijk -> 1 (full)
+         triple = 1.0_wp
+      else
+         ! ijj' and iji' -> 1/2
+         triple = 0.5_wp
+      end if
+   end if
+
+end function triple_scale
+
+
 end module dftd4_damping_rational
diff --git a/src/dftd4/disp.f90 b/src/dftd4/disp.f90
index d4f86411..e132fe76 100644
--- a/src/dftd4/disp.f90
+++ b/src/dftd4/disp.f90
@@ -29,7 +29,7 @@ module dftd4_disp
    implicit none
    private
 
-   public :: get_dispersion, get_properties
+   public :: get_dispersion, get_properties, get_pairwise_dispersion
 
 
 contains
@@ -62,7 +62,7 @@ subroutine get_dispersion(mol, disp, param, cutoff, energy, gradient, sigma)
    logical :: grad
    integer :: mref
    real(wp), allocatable :: cn(:), dcndr(:, :, :), dcndL(:, :, :)
-   real(wp), allocatable :: q(:), dqdr(:, :, :), dqdL(:, :, :), zero(:)
+   real(wp), allocatable :: q(:), dqdr(:, :, :), dqdL(:, :, :)
    real(wp), allocatable :: gwvec(:, :), gwdcn(:, :), gwdq(:, :)
    real(wp), allocatable :: c6(:, :), dc6dcn(:, :), dc6dq(:, :)
    real(wp), allocatable :: dEdcn(:), dEdq(:), energies(:)
@@ -166,4 +166,60 @@ subroutine get_properties(mol, disp, cutoff, cn, q, c6, alpha)
 end subroutine get_properties
 
 
+!> Wrapper to handle the evaluation of pairwise representation of the dispersion energy
+subroutine get_pairwise_dispersion(mol, disp, param, cutoff, energy2, energy3)
+
+   !> Molecular structure data
+   class(structure_type), intent(in) :: mol
+
+   !> Dispersion model
+   class(d4_model), intent(in) :: disp
+
+   !> Damping parameters
+   class(damping_param), intent(in) :: param
+
+   !> Realspace cutoffs
+   type(realspace_cutoff), intent(in) :: cutoff
+
+   !> Pairwise representation of additive dispersion energy
+   real(wp), intent(out) :: energy2(:, :)
+
+   !> Pairwise representation of non-additive dispersion energy
+   real(wp), intent(out) :: energy3(:, :)
+
+   integer :: mref
+   real(wp), allocatable :: cn(:), q(:), gwvec(:, :), c6(:, :), lattr(:, :)
+
+   mref = maxval(disp%ref)
+
+   allocate(cn(mol%nat))
+   call get_lattice_points(mol%periodic, mol%lattice, cutoff%cn, lattr)
+   call get_coordination_number(mol, lattr, cutoff%cn, disp%rcov, disp%en, cn)
+
+   allocate(q(mol%nat))
+   call get_charges(mol, q)
+
+   allocate(gwvec(mref, mol%nat))
+   call disp%weight_references(mol, cn, q, gwvec)
+
+   allocate(c6(mol%nat, mol%nat))
+   call disp%get_atomic_c6(mol, gwvec, c6=c6)
+
+   energy2(:, :) = 0.0_wp
+   energy3(:, :) = 0.0_wp
+   call get_lattice_points(mol%periodic, mol%lattice, cutoff%disp2, lattr)
+   call param%get_pairwise_dispersion2(mol, lattr, cutoff%disp2, disp%r4r2, &
+      & c6, energy2)
+
+   q(:) = 0.0_wp
+   call disp%weight_references(mol, cn, q, gwvec)
+   call disp%get_atomic_c6(mol, gwvec, c6=c6)
+
+   call get_lattice_points(mol%periodic, mol%lattice, cutoff%disp3, lattr)
+   call param%get_pairwise_dispersion3(mol, lattr, cutoff%disp3, disp%r4r2, &
+      & c6, energy3)
+
+end subroutine get_pairwise_dispersion
+
+
 end module dftd4_disp
diff --git a/src/dftd4/output.f90 b/src/dftd4/output.f90
index 0f057154..99714f0f 100644
--- a/src/dftd4/output.f90
+++ b/src/dftd4/output.f90
@@ -27,7 +27,7 @@ module dftd4_output
    private
 
    public :: ascii_atomic_radii, ascii_atomic_references, ascii_system_properties
-   public :: ascii_results, ascii_damping_param
+   public :: ascii_results, ascii_damping_param, ascii_pairwise
    public :: turbomole_gradient, turbomole_gradlatt
    public :: json_results, tagged_result
 
@@ -217,6 +217,57 @@ subroutine ascii_results(unit, mol, energy, gradient, sigma)
 end subroutine ascii_results
 
 
+subroutine ascii_pairwise(unit, mol, pair_disp2, pair_disp3)
+
+   !> Unit for output
+   integer, intent(in) :: unit
+
+   !> Molecular structure data
+   class(structure_type), intent(in) :: mol
+
+   real(wp), intent(in) :: pair_disp2(:, :)
+   real(wp), intent(in) :: pair_disp3(:, :)
+
+   integer :: iat, jat, isp, jsp
+   real(wp) :: disp, e2, e3
+
+   e2 = 0.0_wp
+   e3 = 0.0_wp
+
+   write(unit, '(a,":")') "Pairwise representation of dispersion (in kcal/mol)"
+   write(unit, '(82("-"))')
+   write(unit, '(2(a6,1x,a4,5x),*(1x,a10:,1x,a7))') &
+      "#", "Z", "#", "Z", "additive", "(rel.)", "non-add.", "(rel.)", "total"
+   write(unit, '(82("-"))')
+   do iat = 1, mol%nat
+      isp = mol%id(iat)
+      do jat = 1, mol%nat
+         jsp = mol%id(jat)
+         e2 = e2 + pair_disp2(jat, iat)
+         e3 = e3 + pair_disp3(jat, iat)
+         disp = pair_disp2(jat, iat) + pair_disp3(jat, iat)
+         if (abs(disp) < epsilon(disp)) cycle
+         write(unit, '(2(i6,1x,i4,1x,a4),*(1x,es10.2:,1x,"(",i4,"%)"))') &
+            & iat, mol%num(isp), mol%sym(isp), &
+            & jat, mol%num(jsp), mol%sym(jsp), &
+            & pair_disp2(jat, iat) * autokcal, nint(pair_disp2(jat, iat)/disp*100), &
+            & pair_disp3(jat, iat) * autokcal, nint(pair_disp3(jat, iat)/disp*100), &
+            & disp * autokcal
+      end do
+   end do
+   write(unit, '(82("-"))')
+   disp = e2 + e3
+   write(unit, '(1x, a, t33,*(1x,es10.2:,1x,"(",i4,"%)"))') &
+      & "total dispersion energy", &
+      & e2 * autokcal, nint(e2/disp*100), &
+      & e3 * autokcal, nint(e3/disp*100), &
+      & disp * autokcal
+   write(unit, '(82("-"))')
+   write(unit, '(a)')
+
+end subroutine ascii_pairwise
+
+
 subroutine ascii_damping_param(unit, param, method)
 
    !> Unit for output
@@ -450,7 +501,8 @@ subroutine getline(unit,line,iostat)
 end subroutine getline
 
 
-subroutine json_results(unit, indentation, energy, gradient, sigma, cn, q, c6)
+subroutine json_results(unit, indentation, energy, gradient, sigma, cn, q, c6, &
+      & pairwise_energy2, pairwise_energy3)
    integer, intent(in) :: unit
    character(len=*), intent(in), optional :: indentation
    real(wp), intent(in), optional :: energy
@@ -459,6 +511,8 @@ subroutine json_results(unit, indentation, energy, gradient, sigma, cn, q, c6)
    real(wp), intent(in), optional :: cn(:)
    real(wp), intent(in), optional :: q(:)
    real(wp), intent(in), optional :: c6(:, :)
+   real(wp), intent(in), optional :: pairwise_energy2(:, :)
+   real(wp), intent(in), optional :: pairwise_energy3(:, :)
    character(len=:), allocatable :: indent, version_string
    character(len=*), parameter :: jsonkey = "('""',a,'"":',1x)"
    real(wp), allocatable :: array(:)
@@ -512,6 +566,20 @@ subroutine json_results(unit, indentation, energy, gradient, sigma, cn, q, c6)
       array = reshape(c6, [product(shape(c6))])
       call write_json_array(unit, array, indent)
    end if
+   if (present(pairwise_energy2)) then
+      write(unit, '(",")', advance='no')
+      if (allocated(indent)) write(unit, '(/,a)', advance='no') repeat(indent, 1)
+      write(unit, jsonkey, advance='no') 'additive pairwise energy'
+      array = reshape(pairwise_energy2, [product(shape(pairwise_energy2))])
+      call write_json_array(unit, array, indent)
+   end if
+   if (present(pairwise_energy3)) then
+      write(unit, '(",")', advance='no')
+      if (allocated(indent)) write(unit, '(/,a)', advance='no') repeat(indent, 1)
+      write(unit, jsonkey, advance='no') 'non-additive pairwise energy'
+      array = reshape(pairwise_energy3, [product(shape(pairwise_energy3))])
+      call write_json_array(unit, array, indent)
+   end if
    if (allocated(indent)) write(unit, '(/)', advance='no')
    write(unit, '("}")')
 


Test patch:
diff --git a/app/tester.py b/app/tester.py
new file mode 100755
index 00000000..ab5ce3cf
--- /dev/null
+++ b/app/tester.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+"""
+Minimal Python wrapper for testing the dftd4 command line interface.
+
+The wrapper will assume a specific order in the arguments rather than
+providing a generic command line interface by itself since it is
+supposed to be used by meson for testing purposes only.
+"""
+
+try:
+    import subprocess, sys, json, os, pytest
+except ImportError:
+    exit(77)
+
+if len(sys.argv) < 5:
+    raise RuntimeError("Requires at least four arguments")
+
+thr = 1.0e-9
+prog = sys.argv[1]
+geom = sys.argv[2]
+outp = sys.argv[3]
+args = sys.argv[4:]
+
+stat = subprocess.call(
+    [prog, geom, "--json", os.path.basename(outp)] + args,
+    shell=False,
+    stdin=None,
+    stderr=subprocess.STDOUT,
+)
+if stat != 0:
+    raise RuntimeError("Calculation failed")
+
+with open(outp) as f:
+    ref = json.load(f)
+    del ref["version"]
+
+with open(os.path.basename(outp)) as f:
+    res = json.load(f)
+
+for key in ref:
+    if key not in res:
+        raise RuntimeError("Missing '" + key + "' entry in results")
+    assert pytest.approx(res[key], abs=thr) == ref[key]
diff --git a/python/dftd4/test_interface.py b/python/dftd4/test_interface.py
index 72007418..a94d1fcf 100644
--- a/python/dftd4/test_interface.py
+++ b/python/dftd4/test_interface.py
@@ -147,11 +147,11 @@ def test_blypd4():
 
     res = model.get_dispersion(DampingParam(method="blyp"), grad=False)
 
-    assert approx(res.get_energy(), abs=thr) == -0.06991716314879085
+    assert approx(res.get("energy"), abs=thr) == -0.06991716314879085
 
     res = model.get_dispersion(DampingParam(method="blyp"), grad=True)
 
-    assert approx(res.get_energy(), abs=thr) == -0.06991716314879085
+    assert approx(res.get("energy"), abs=thr) == -0.06991716314879085
 
 
 def test_pbed4():
@@ -203,11 +203,11 @@ def test_pbed4():
 
     res = model.get_dispersion(DampingParam(method="pbe"), grad=False)
 
-    assert approx(res.get_energy(), abs=thr) == -0.028415184156428127
+    assert approx(res.get("energy"), abs=thr) == -0.028415184156428127
 
     res = model.get_dispersion(DampingParam(method="pbe"), grad=True)
 
-    assert approx(res.get_energy(), abs=thr) == -0.028415184156428127
+    assert approx(res.get("energy"), abs=thr) == -0.028415184156428127
 
 
 def test_r2scan3c():
@@ -257,10 +257,210 @@ def test_r2scan3c():
 
     model = DispersionModel(numbers, positions, ga=2.0, gc=1.0)
 
-    res = model.get_dispersion(DampingParam(s8=0.0, a1=0.42, a2=5.65, s9=2.0), grad=False)
+    res = model.get_dispersion(
+        DampingParam(s8=0.0, a1=0.42, a2=5.65, s9=2.0), grad=False
+    )
+
+    assert approx(res.get("energy"), abs=thr) == -0.008016697276824889
+
+    res = model.get_dispersion(
+        DampingParam(s8=0.0, a1=0.42, a2=5.65, s9=2.0), grad=True
+    )
+
+    assert approx(res.get("energy"), abs=thr) == -0.008016697276824889
 
-    assert approx(res.get_energy(), abs=thr) == -0.008016697276824889
 
-    res = model.get_dispersion(DampingParam(s8=0.0, a1=0.42, a2=5.65, s9=2.0), grad=True)
+def test_pair_resolved():
+    """Calculate pairwise resolved dispersion energy for a molecule"""
+    thr = 1.0e-8
+
+    numbers = np.array([16, 16, 16, 16, 16, 16, 16, 16])
+    positions = np.array(
+        [
+            [-4.15128787379191, +1.71951973863958, -0.93066267097296],
+            [-4.15128787379191, -1.71951973863958, +0.93066267097296],
+            [-1.71951973863958, -4.15128787379191, -0.93066267097296],
+            [+1.71951973863958, -4.15128787379191, +0.93066267097296],
+            [+4.15128787379191, -1.71951973863958, -0.93066267097296],
+            [+4.15128787379191, +1.71951973863958, +0.93066267097296],
+            [+1.71951973863958, +4.15128787379191, -0.93066267097296],
+            [-1.71951973863958, +4.15128787379191, +0.93066267097296],
+        ]
+    )
+    pair_disp2 = np.array(
+        [
+            [
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+            ],
+            [
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+            ],
+            [
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+            ],
+            [
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+            ],
+            [
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+            ],
+            [
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+                -4.74689854e-4,
+            ],
+            [
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+                -5.80599854e-4,
+            ],
+            [
+                -5.80599854e-4,
+                -4.74689854e-4,
+                -2.11149449e-4,
+                -1.63163128e-4,
+                -2.11149449e-4,
+                -4.74689854e-4,
+                -5.80599854e-4,
+                -0.00000000e-0,
+            ],
+        ]
+    )
+    pair_disp3 = np.array(
+        [
+            [
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+            ],
+            [
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+            ],
+            [
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+            ],
+            [
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+            ],
+            [
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+            ],
+            [
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+                8.74462839e-7,
+            ],
+            [
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+                3.39353850e-7,
+            ],
+            [
+                3.39353850e-7,
+                8.74462839e-7,
+                1.17634100e-6,
+                9.86937310e-7,
+                1.17634100e-6,
+                8.74462839e-7,
+                3.39353850e-7,
+                0.00000000e-0,
+            ],
+        ]
+    )
+
+    model = DispersionModel(numbers, positions)
+
+    res = model.get_pairwise_dispersion(
+        DampingParam(s8=1.20065498, a1=0.40085597, a2=5.02928789)
+    )
 
-    assert approx(res.get_energy(), abs=thr) == -0.008016697276824889
+    assert approx(res.get("additive pairwise energy"), abs=thr) == pair_disp2
+    assert approx(res.get("non-additive pairwise energy"), abs=thr) == pair_disp3
diff --git a/python/dftd4/test_qcschema.py b/python/dftd4/test_qcschema.py
index a467f850..c75d4d62 100644
--- a/python/dftd4/test_qcschema.py
+++ b/python/dftd4/test_qcschema.py
@@ -193,6 +193,7 @@ def test_gradient_tpss_d4():
                 "a1": 0.42822303,
                 "a2": 4.54257102,
             },
+            "pair_resolved": True,
         },
     )
     gradient = np.array(
@@ -211,6 +212,16 @@ def test_gradient_tpss_d4():
 
     assert atomic_result.success
     assert approx(atomic_result.return_result, abs=thr) == gradient
+    assert "energy" in atomic_result.extras["dftd4"]
+    assert "gradient" in atomic_result.extras["dftd4"]
+    assert "virial" in atomic_result.extras["dftd4"]
+    assert "additive pairwise energy" in atomic_result.extras["dftd4"]
+    assert "non-additive pairwise energy" in atomic_result.extras["dftd4"]
+    assert (
+        approx(atomic_result.extras["dftd4"]["energy"])
+        == atomic_result.extras["dftd4"]["additive pairwise energy"].sum()
+        + atomic_result.extras["dftd4"]["non-additive pairwise energy"].sum()
+    )
 
 
 def test_error_noargs():
diff --git a/test/api/example.c b/test/api/example.c
index d60e876c..71b492f9 100644
--- a/test/api/example.c
+++ b/test/api/example.c
@@ -34,6 +34,8 @@ main (void)
        1.92825631079613, 0.00000000000000,-2.53624948351102,
        0.00000000000000, 0.00000000000000, 5.23010455462158};
    double energy;
+   double pair_disp2[49];
+   double pair_disp3[49];
    double gradient[21];
    double sigma[9];
    double c6[49];
@@ -68,6 +70,8 @@ main (void)
    if (dftd4_check_error(error)) {return 1;}
    dftd4_get_dispersion(error, mol, disp, param, &energy, gradient, sigma);
    if (dftd4_check_error(error)) {return 1;}
+   dftd4_get_pairwise_dispersion(error, mol, disp, param, pair_disp2, pair_disp3);
+   if (dftd4_check_error(error)) {return 1;}
    dftd4_delete_param(&param);
 
    // DSD-BLYP-D4-ATM
diff --git a/test/unit/main.f90 b/test/unit/main.f90
index 11ccb273..7e6e8ad1 100644
--- a/test/unit/main.f90
+++ b/test/unit/main.f90
@@ -23,6 +23,7 @@ program tester
    use test_dftd4, only : collect_dftd4
    use test_model, only : collect_model
    use test_ncoord, only : collect_ncoord
+   use test_pairwise, only : collect_pairwise
    use test_param, only : collect_param
    use test_periodic, only : collect_periodic
    implicit none
@@ -38,7 +39,8 @@ program tester
       & new_testsuite("model", collect_model), &
       & new_testsuite("dftd4", collect_dftd4), &
       & new_testsuite("param", collect_param), &
-      & new_testsuite("periodic", collect_periodic) &
+      & new_testsuite("periodic", collect_periodic), &
+      & new_testsuite("pairwise", collect_pairwise) &
       & ]
 
    call get_argument(1, suite_name)
diff --git a/test/unit/meson.build b/test/unit/meson.build
index 74a5686c..2a8b5615 100644
--- a/test/unit/meson.build
+++ b/test/unit/meson.build
@@ -33,6 +33,7 @@ tests = [
   'ncoord',
   'model',
   'dftd4',
+  'pairwise',
   'param',
   'periodic',
 ]
diff --git a/test/unit/test_pairwise.f90 b/test/unit/test_pairwise.f90
new file mode 100644
index 00000000..0fd48581
--- /dev/null
+++ b/test/unit/test_pairwise.f90
@@ -0,0 +1,130 @@
+! This file is part of dftd4.
+! SPDX-Identifier: LGPL-3.0-or-later
+!
+! dftd4 is free software: you can redistribute it and/or modify it under
+! the terms of the Lesser GNU General Public License as published by
+! the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! dftd4 is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! Lesser GNU General Public License for more details.
+!
+! You should have received a copy of the Lesser GNU General Public License
+! along with dftd4.  If not, see <https://www.gnu.org/licenses/>.
+
+module test_pairwise
+   use mctc_env, only : wp
+   use mctc_env_testing, only : new_unittest, unittest_type, error_type, check, &
+      & test_failed
+   use mctc_io, only : structure_type
+   use mstore, only : get_structure
+   use dftd4
+   implicit none
+   private
+
+   public :: collect_pairwise
+
+   real(wp), parameter :: thr = 100*epsilon(1.0_wp)
+   real(wp), parameter :: thr2 = sqrt(epsilon(1.0_wp))
+
+   type(realspace_cutoff), parameter :: cutoff = &
+      & realspace_cutoff(cn=30_wp, disp2=60.0_wp, disp3=15.0_wp)
+
+
+contains
+
+
+!> Collect all exported unit tests
+subroutine collect_pairwise(testsuite)
+
+   !> Collection of tests
+   type(unittest_type), allocatable, intent(out) :: testsuite(:)
+
+   testsuite = [ &
+      & new_unittest("PBE-D4", test_pbed4_mb01), &
+      & new_unittest("B97-D4", test_b97d4_mb02), &
+      & new_unittest("TPSS-D4", test_tpssd4_ammonia) &
+      & ]
+
+end subroutine collect_pairwise
+
+
+subroutine test_dftd4_pairwise(error, mol, param)
+
+   !> Error handling
+   type(error_type), allocatable, intent(out) :: error
+
+   !> Molecular structure data
+   type(structure_type), intent(in) :: mol
+
+   !> Damping parameters
+   class(damping_param), intent(in) :: param
+
+   type(d4_model) :: d4
+   real(wp) :: energy
+   real(wp), allocatable :: energy2(:, :), energy3(:, :)
+
+   allocate(energy2(mol%nat, mol%nat), energy3(mol%nat, mol%nat))
+   call new_d4_model(d4, mol)
+   call get_dispersion(mol, d4, param, cutoff, energy)
+   call get_pairwise_dispersion(mol, d4, param, cutoff, energy2, energy3)
+
+   call check(error, energy, sum(energy2) + sum(energy3), thr=thr)
+   if (allocated(error)) then
+      print*,energy, sum(energy2) + sum(energy3)
+   end if
+
+end subroutine test_dftd4_pairwise
+
+
+subroutine test_pbed4_mb01(error)
+
+   !> Error handling
+   type(error_type), allocatable, intent(out) :: error
+
+   type(structure_type) :: mol
+   type(rational_damping_param) :: param = rational_damping_param(&
+      & s6 = 1.0_wp, s9 = 0.0_wp, alp = 16.0_wp, &
+      & s8 = 0.95948085_wp, a1 = 0.38574991_wp, a2 = 4.80688534_wp)
+
+   call get_structure(mol, "MB16-43", "01")
+   call test_dftd4_pairwise(error, mol, param)
+
+end subroutine test_pbed4_mb01
+
+
+subroutine test_b97d4_mb02(error)
+
+   !> Error handling
+   type(error_type), allocatable, intent(out) :: error
+
+   type(structure_type) :: mol
+   type(rational_damping_param) :: param = rational_damping_param(&
+      & s6 = 1.0_wp, s9 = 1.0_wp, alp = 16.0_wp, &
+      & s8 = 1.69460052_wp, a1 = 0.28904684_wp, a2 = 4.13407323_wp)
+
+   call get_structure(mol, "MB16-43", "02")
+   call test_dftd4_pairwise(error, mol, param)
+
+end subroutine test_b97d4_mb02
+
+
+subroutine test_tpssd4_ammonia(error)
+
+   !> Error handling
+   type(error_type), allocatable, intent(out) :: error
+
+   type(structure_type) :: mol
+   type(rational_damping_param) :: param = rational_damping_param(&
+      & s6 = 1.0_wp, s9 = 1.0_wp, alp = 16.0_wp, &
+      & s8 = 1.76596355_wp, a1 = 0.42822303_wp, a2 = 4.54257102_wp )
+
+   call get_structure(mol, "X23", "ammonia")
+   call test_dftd4_pairwise(error, mol, param)
+
+end subroutine test_tpssd4_ammonia
+
+
+end module test_pairwise