20#include "../base/base_uses.f90"
26 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: minima => null()
27 INTEGER :: max_iter = 0
28 INTEGER :: nreplica = 0
29 REAL(kind=
dp) :: kb = 0.0_dp
55 FUNCTION derivative(fes, pos0, iperd, ndim, ngrid, dp_grid)
RESULT(der)
56 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: fes
57 INTEGER,
DIMENSION(:),
INTENT(IN) :: pos0, iperd
58 INTEGER,
INTENT(IN) :: ndim
59 INTEGER,
DIMENSION(:),
INTENT(IN) :: ngrid
60 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: dp_grid
61 REAL(kind=
dp),
DIMENSION(ndim) :: der
64 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: pos
73 der(i) = der(i) + real(j, kind=
dp)*(-fes(pnt))
76 der(i) = der(i)/(2.0_dp*dp_grid(i))
95 FUNCTION point_pbc(pos, iperd, ngrid, ndim)
RESULT(pnt)
96 INTEGER,
DIMENSION(:),
INTENT(IN) :: pos, iperd, ngrid
97 INTEGER,
INTENT(IN) :: ndim
100 INTEGER :: idim, lpnt
104 IF (iperd(idim) == 1)
THEN
106 lpnt = 1000*ngrid(idim) + lpnt
107 lpnt = mod(lpnt, ngrid(idim))
108 IF (lpnt == 0) lpnt = ngrid(idim)
113 IF (iperd(idim) == 1)
THEN
114 lpnt = 1000*ngrid(idim) + lpnt
115 lpnt = mod(lpnt, ngrid(idim))
116 IF (lpnt == 0) lpnt = ngrid(idim)
118 pnt = pnt + (lpnt - 1)*product(ngrid(1:idim - 1))
135 SUBROUTINE pbc(pos, iperd, ngrid, ndim)
136 INTEGER,
DIMENSION(:),
INTENT(INOUT) :: pos
137 INTEGER,
DIMENSION(:),
INTENT(IN) :: iperd, ngrid
138 INTEGER,
INTENT(IN) :: ndim
140 INTEGER :: idim, lpnt
143 IF (iperd(idim) == 1)
THEN
145 lpnt = 1000*ngrid(idim) + lpnt
146 lpnt = mod(lpnt, ngrid(idim))
147 IF (lpnt == 0) lpnt = ngrid(idim)
166 INTEGER,
DIMENSION(:),
INTENT(IN) :: pos, ngrid
167 INTEGER,
INTENT(IN) :: ndim
174 pnt = pnt + (pos(i) - 1)*product(ngrid(1:i - 1))
192 SUBROUTINE get_val_res(unit, section, keyword, subsection, i_val, r_val)
193 INTEGER,
INTENT(IN) :: unit
194 CHARACTER(len=*) :: section
195 CHARACTER(len=*),
OPTIONAL :: keyword, subsection
196 INTEGER,
INTENT(OUT),
OPTIONAL :: i_val
197 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: r_val
199 CHARACTER(len=512) :: line
200 INTEGER :: my_ind, stat
203 CALL search(unit, trim(section), line, stat=stat)
206 WRITE (*, *)
"Pattern: "//trim(section)//
" not found in input file!"
207 cpabort(
"Search failed!")
210 IF (
PRESENT(keyword))
THEN
211 CALL search(unit, trim(keyword), line, stat)
214 IF (
PRESENT(i_val)) i_val = -huge(1)
215 IF (
PRESENT(r_val)) r_val = -huge(0.0_dp)
218 my_ind = index(line, trim(keyword)) + len_trim(keyword) + 1
219 IF (
PRESENT(i_val))
READ (line(my_ind:), *) i_val
220 IF (
PRESENT(r_val))
READ (line(my_ind:), *) r_val
224 IF (
PRESENT(subsection))
THEN
225 CALL search(unit, trim(subsection), line, stat)
238 SUBROUTINE search(unit, key, line, stat)
239 INTEGER,
INTENT(in) :: unit
240 CHARACTER(LEN=*),
INTENT(IN) :: key
241 CHARACTER(LEN=512),
INTENT(OUT) :: line
242 INTEGER,
INTENT(out) :: stat
246 READ (unit,
'(A)', err=100,
END=100) line
247 IF (index(line, trim(key)) /= 0)
THEN
253 END SUBROUTINE search
Module containing utils for mapping FESs.
real(kind=dp) function, dimension(ndim), public derivative(fes, pos0, iperd, ndim, ngrid, dp_grid)
computes the derivative of the FES w.r.t CVs
subroutine, public get_val_res(unit, section, keyword, subsection, i_val, r_val)
Parser informations from the cp2k input/restart.
integer function, public point_no_pbc(pos, ngrid, ndim)
Computes the pointer to the 1D array given the n-dimensional position non-PBC version.
subroutine, public pbc(pos, iperd, ngrid, ndim)
Computes the pointer to the 1D array given the n-dimensional position PBC version.
integer function, public point_pbc(pos, iperd, ngrid, ndim)
Computes the pointer to the 1D array given the n-dimensional position PBC version.
Defines the basic variable types.
integer, parameter, public dp