dftd3 / simple-dftd3

reimplementation of the DFT-D3 program
https://dftd3.readthedocs.io
GNU Lesser General Public License v3.0
51 stars 24 forks source link

Complete example source codes with build scripts #88

Open shahmoradi opened 2 weeks ago

shahmoradi commented 2 weeks ago

Having fully functional concrete examples with the relevant input data and build scripts would be a great addition to this project, making it more accessible and user-friendly. It would be great to add such examples to the project.

AlexBuccheri commented 2 weeks ago

I second this, although I would be fine if they exist in the way of tests, and the docs point to them. Currently, I'm only aware of test/api, which tests the C API.

On the minimal example provided on the front page of the docs simple-dftd3/_docs/index.html:

program main
contains
subroutine calc_dftd3(mol, method, energy, gradient, sigma, error)
   use mctc_env
   use mctc_io
   use dftd3
   type(structure_type), intent(in) :: mol
   character(len=*), intent(in) :: method
   real(wp), intent(out) :: energy
   real(wp), intent(out) :: gradient(:, :)
   real(wp), intent(out) :: sigma(:, :)
   type(error_type), allocatable, intent(out) :: error
   type(d3_model) :: disp
   type(d3_param) :: inp
   class(damping_param), allocatable :: param

   call get_rational_damping(inp, method, error, s9=1.0_wp)
   if (allocated(error)) return
   call new_rational_damping(param, inp, mol)

   call new_d3_model(disp, mol)

   call get_dispersion(mol, disp, param, realspace_cutoff(), energy, &
      & gradient, sigma)

end subroutine calc_dftd3
end program main

the docs have fallen out of sync with the code. I had to make the minor change:

 type(rational_damping_param), allocatable :: param
     .
     .
     .
  call new_rational_damping(param, inp)

for the build and linking to succeed.