|
| 1 | +program test_simple_d3 |
| 2 | + use, intrinsic :: iso_fortran_env, only : r8 => real64 |
| 3 | + use mctc_env, only: error_type |
| 4 | + use mctc_io, only: structure_type, new |
| 5 | + use dftd3, only: d3_model, d3_param, rational_damping_param, get_rational_damping, & |
| 6 | + & new_rational_damping, new_d3_model, get_dispersion, realspace_cutoff |
| 7 | + implicit none |
| 8 | + |
| 9 | + character(len=:), allocatable :: method |
| 10 | + type(structure_type) :: mol |
| 11 | + type(error_type), allocatable :: error |
| 12 | + integer, allocatable :: num(:) |
| 13 | + real(r8), allocatable :: xyz(:, :) |
| 14 | + real(r8) :: energy |
| 15 | + |
| 16 | + type(d3_model) :: disp |
| 17 | + type(d3_param) :: inp |
| 18 | + type(rational_damping_param) :: param |
| 19 | + |
| 20 | + method = 'PBE0' |
| 21 | + num = [6, 1, 1, 1, 1] |
| 22 | + xyz = reshape([ & ! coordinates in Bohr |
| 23 | + & 0.0000000_r8, -0.0000000_r8, 0.0000000_r8, & |
| 24 | + & -1.1922080_r8, 1.1922080_r8, 1.1922080_r8, & |
| 25 | + & 1.1922080_r8, -1.1922080_r8, 1.1922080_r8, & |
| 26 | + & -1.1922080_r8, -1.1922080_r8, -1.1922080_r8, & |
| 27 | + & 1.1922080_r8, 1.1922080_r8, -1.1922080_r8],& |
| 28 | + & [3, size(num)]) |
| 29 | + call new(mol, num, xyz, charge=0.0_r8, uhf=0) |
| 30 | + |
| 31 | + call get_rational_damping(inp, method, error, s9=1.0_r8) |
| 32 | + if (allocated(error)) then |
| 33 | + print '(2a)', "Error: ", error%message |
| 34 | + return |
| 35 | + end if |
| 36 | + call new_rational_damping(param, inp) |
| 37 | + call new_d3_model(disp, mol) |
| 38 | + |
| 39 | + call get_dispersion(mol, disp, param, realspace_cutoff(), energy) |
| 40 | + print '(3a, f13.10, a)', 'Dispersion energy for ', method, '-D3(BJ) is ', energy, ' Hartree' |
| 41 | + |
| 42 | +end program test_simple_d3 |
0 commit comments