@@ -27,13 +27,46 @@ module metropolis
2727
2828 private
2929
30- public :: metropolis_simulated_annealing, &
31- metropolis_decorrelated_samples, &
30+ public :: metropolis_main, &
3231 monte_carlo_step_nbr, &
3332 monte_carlo_step_lattice
3433
3534 contains
3635
36+ ! > @brief Subroutine for selecting the Metropolis subroutine to use
37+ ! >
38+ ! > @author C. D. Woodgate
39+ ! > @date 2026
40+ ! >
41+ ! > @param setup Derived type containing simulation parameters
42+ ! > @param metropolis Derived type containing Metropolis MC parameters
43+ ! > @param my_rank Rank of this process
44+ ! >
45+ ! > @return None
46+ subroutine metropolis_main (setup , metropolis , my_rank )
47+
48+ ! Rank of this processor
49+ integer , intent (in ) :: my_rank
50+
51+ ! Derived type describing simulation setup
52+ type (run_params) :: setup
53+ type (metropolis_params) :: metropolis
54+
55+ ! Select the relevant mode, exit cleanly if unrecognised
56+ if (trim (metropolis% mode) .eq. ' simulated_annealing' ) then
57+ call metropolis_simulated_annealing(setup, metropolis, my_rank)
58+ else if (trim (metropolis% mode) .eq. ' decorrelated_samples' ) then
59+ call metropolis_decorrelated_samples(setup, metropolis, my_rank)
60+ else
61+ if (my_rank .eq. 1 ) then
62+ print * , ' Unrecognised Metropolis mode' , metropolis% mode
63+ end if
64+ call comms_finalise()
65+ stop ' Exiting as unrecognised Metropolis mode requested'
66+ end if
67+
68+ end subroutine metropolis_main
69+
3770 ! > @brief Subroutine for performing simulated annealing using
3871 ! > the Metropolis Monte Carlo algorithm
3972 ! >
0 commit comments