/
main.f90
67 lines (50 loc) · 2.66 KB
/
main.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!%
!% Description:
!% + Run the Monte Carlo sampler of the ParaMonte library given the input log-target density function `getLogFunc()`.
!% Output:
!% + The simulation output files.
!% Author:
!% + Computational Data Science Lab, Monday 9:03 AM, May 16 2016, ICES, UT Austin
!% Visit:
!% + https://www.cdslab.org/paramonte
!%
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Keep in mind that Fortran is case-insensitive, except for character values and string values.
! So, feel free to use upper-case or lower-case for the Fortran syntax and entity names.
! The ParaMonte library uses camelCase convention for variable naming.
#if defined IS_COMPATIBLE_COMPILER
program main
! This is the Object-Oriented-Programming (OOP) style interface to the ParaMonte routines.
! This is more flexible but less portable, as its compilation requires the same compiler
! brand and version with which the ParaMonte library has been built.
use paramonte, only: ParaDRAM, IK
use LogFunc_mod, only: getLogFunc, NDIM
implicit none
type(ParaDRAM) :: pmpd
call pmpd%runSampler( ndim = NDIM &
, getLogFunc = getLogFunc &
, inputFile = "./paramonte.in" & ! this is optional argument
! You can also specify simulation specifications as input arguments, like
! the following. This is possible only from the OOP interface to ParaDRAM.
, greedyAdaptationCount = 0_IK & ! this is optional argument
, description = "an example run" & ! this is optional argument
! More optional arguments can appear here.
! See the ParaDRAM routine's list of input arguments.
)
end program main
#else
! This is the default simple procedural interface to the ParaMonte routines.
! The first two arguments to the sampler routines are mandatory.
! The inputFile argument is optional.
program main
use paramonte, only: runParaDRAM
use LogFunc_mod, only: getLogFunc, NDIM
implicit none
call runParaDRAM( NDIM &
, getLogFunc &
, "./paramonte.in" & ! this is optional argument
)
end program main
#endif
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%