Debian Codegraph @

doc/libmbd.md

raw
1 ---
2 project: libMBD
3 summary: Many-body dispersion library
4 license: by
5 src_dir: ../src
6 css: tweaks.css
7 favicon: _static/favicon-32.png
8 hide_undoc: true
9 preprocessor: gfortran -cpp -E -P -DWITH_MPI -DWITH_SCALAPACK
10 exclude:
11 mbd_blacs.f90
12 mbd_c_api.F90
13 mbd_coulomb.f90
14 mbd_density.f90
15 mbd_lapack.f90
16 mbd_linalg.F90
17 mbd_matrix.F90
18 mbd_mpi.F90
19 mbd_scalapack.f90
20 mbd_vdw_param.f90
21 ---
22
23 At the moment the documentation consists of an automatically generated API reference and a miniature of a user guide in the following paragraph. All mathematical formulas used in the code are documented directly in the source code and rendered in [Procedures](lists/procedures.html). Installation instructions can be found in the [Readme](https://github.com/libmbd/libmbd/blob/master/README.md).
24
25 The user-facing Fortran API of libMBD is contained in the [[mbd]] module and consists of the [[mbd_input_t]] and [[mbd_calc_t]] derived types. A [[mbd_input_t]] object serves to set various options for the calculation and is used to initialize a [[mbd_calc_t]] object, which is then used to actually perform the MBD calculation.
26
27 ```fortran
28 use mbd, only: mbd_input_t, mbd_calc_t
29
30 type(mbd_input_t) :: inp
31 type(mbd_calc_t) :: calc
32 real(8) :: energy, gradients(3, 2)
33 integer :: code
34 character(200) :: origin, msg
35
36 inp%atom_types = ['Ar', 'Ar']
37 inp%coords = reshape([0d0, 0d0, 0d0, 0d0, 0d0, 7.5d0], [3, 2])
38 inp%xc = 'pbe'
39 call calc%init(inp)
40 call calc%get_exception(code, origin, msg)
41 if (code > 0) then
42 print *, msg
43 stop
44 end if
45 call calc%update_vdw_params_from_ratios([0.98d0, 0.98d0])
46 call calc%evaluate_vdw_method(energy)
47 call calc%get_gradients(gradients)
48 call calc%destroy()
49 ```