Parameters through parsing of hamiltonian files
As Florian suggested, it would probably make sense to parse the source code to automatically retrieve the parameters of a hamiltonian. This way, one would have a single place to define all parameters of a model, including defaults and even a description. This information could also be used to automatically write a subroutine for the MPI communication etc. I've written a python script that can parse the following code:
!#PARAMETERS START#
Character (len=64) :: Lattice_type = 'Square' ! Possible Values: 'Square', 'Honeycomb'
!logical :: symm = .false.
!logical :: projector = .false.
logical :: Mz = .true. ! If true: HS-field couples to spin degree of freedom
Integer :: L1 = 4
Integer :: L2 = 4
!Integer :: N_SUN = 2
real(dp) :: dtau = 0.1d0
real(dp) :: beta = 10.d0
real(dp) :: ham_t = 1.d0
real(dp) :: Ham_h = 3.d0
real(dp) :: Ham_J = 1.d0
real(dp) :: Ham_xi = 1.d0
real(dp) :: some_vector(2) = [1.d0, 3.5d0]
!#PARAMETERS END#
The commented out parameters are those that would already be defined in ham_base
, but should still be exposed as parameters.
I wrote real(dp)
(with the definintion integer, parameter :: dp=kind(0.d0)
) out of convenience. Something like Real (Kind=Kind(0.d0))
is also possible.