@@ -51,9 +51,10 @@ subroutine run_driver(config, error)
5151 class(damping_param), allocatable :: param
5252 type (d3_param) :: inp
5353 type (d3_model) :: d3
54- real (wp), allocatable :: energy , gradient(:, :), sigma(:, :)
54+ real (wp), allocatable :: energies(:) , gradient(:, :), sigma(:, :)
5555 real (wp), allocatable :: pair_disp2(:, :), pair_disp3(:, :)
5656 real (wp), allocatable :: s9
57+ real (wp) :: energy
5758 integer :: stat, unit
5859 logical :: exist
5960
@@ -163,7 +164,7 @@ subroutine run_driver(config, error)
163164 end if
164165
165166 if (allocated (param)) then
166- energy = 0.0_wp
167+ allocate (energies(mol % nat))
167168 if (config% grad) then
168169 allocate (gradient(3 , mol% nat), sigma(3 , 3 ))
169170 end if
@@ -176,14 +177,19 @@ subroutine run_driver(config, error)
176177 end if
177178
178179 if (allocated (param)) then
179- call get_dispersion(mol, d3, param, realspace_cutoff(), energy, gradient, &
180- & sigma)
180+ call get_dispersion(mol, d3, param, realspace_cutoff(), energies, &
181+ & gradient, sigma)
182+ energy = sum (energies)
183+
181184 if (config% pair_resolved) then
182185 allocate (pair_disp2(mol% nat, mol% nat), pair_disp3(mol% nat, mol% nat))
183186 call get_pairwise_dispersion(mol, d3, param, realspace_cutoff(), pair_disp2, &
184187 & pair_disp3)
185188 end if
186189 if (config% verbosity > 0 ) then
190+ if (config% verbosity > 2 ) then
191+ call ascii_energy_atom(output_unit, mol, energies)
192+ end if
187193 call ascii_results(output_unit, mol, energy, gradient, sigma)
188194 if (config% pair_resolved) then
189195 call ascii_pairwise(output_unit, mol, pair_disp2, pair_disp3)
0 commit comments