21 #include "../base/base_uses.f90"
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'pint_gle'
37 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
41 pint_env%e_gle = 0._dp
42 IF (
ASSOCIATED(pint_env%gle))
THEN
43 DO i = 1, pint_env%gle%loc_num_gle
44 pint_env%e_gle = pint_env%e_gle + pint_env%gle%nvt(i)%thermostat_energy
54 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
56 INTEGER :: i, ib, idim, imap, j
57 REAL(
dp) :: mf, rr(pint_env%gle%ndim), cc(pint_env%gle%ndim, pint_env%gle%ndim)
60 DO i = 1, pint_env%gle%loc_num_gle
61 imap = pint_env%gle%map_info%index(i)
62 ib = 1 + (imap - 1)/pint_env%ndim
63 idim = 1 + mod(imap - 1, pint_env%ndim)
64 mf = 1.0_dp/sqrt(pint_env%mass_fict(ib, idim))
65 DO j = 1, pint_env%gle%ndim
66 rr(j) = pint_env%gle%nvt(i)%gaussian_rng_stream%next()*mf
68 pint_env%gle%nvt(i)%s = matmul(cc, rr)
78 TYPE(pint_env_type),
INTENT(INOUT) :: pint_env
80 CHARACTER(len=*),
PARAMETER :: routinen =
'pint_gle_step'
82 INTEGER :: handle, iadd, ib, ideg, idim, imap, &
84 REAL(
dp) :: alpha, beta, mf, rr
85 REAL(
dp),
DIMENSION(:, :),
POINTER :: a_mat, e_tmp, h_tmp, s_tmp
86 TYPE(gle_type),
POINTER :: gle
88 CALL timeset(routinen, handle)
93 ALLOCATE (s_tmp(ndim, gle%loc_num_gle))
95 ALLOCATE (e_tmp(ndim, gle%loc_num_gle))
96 ALLOCATE (h_tmp(ndim, gle%loc_num_gle))
98 DO ideg = 1, gle%loc_num_gle
99 imap = gle%map_info%index(ideg)
100 ib = 1 + (imap - 1)/pint_env%ndim
101 idim = 1 + mod(imap - 1, pint_env%ndim)
103 gle%nvt(ideg)%s(1) = pint_env%uv_t(ib, idim)
104 gle%nvt(ideg)%thermostat_energy = gle%nvt(ideg)%thermostat_energy &
105 + 0.5_dp*pint_env%mass_fict(ib, idim)*gle%nvt(ideg)%s(1)**2
106 s_tmp(1, imap) = gle%nvt(ideg)%s(1)
107 rr = gle%nvt(ideg)%gaussian_rng_stream%next()
108 mf = 1.0_dp/sqrt(pint_env%mass_fict(ib, idim))
109 e_tmp(1, imap) = rr*mf
111 s_tmp(iadd, imap) = gle%nvt(ideg)%s(iadd)
112 rr = gle%nvt(ideg)%gaussian_rng_stream%next()
113 e_tmp(iadd, imap) = rr*mf
116 num = gle%loc_num_gle
121 CALL dgemm(
'N',
'N', ndim, num, ndim, alpha, a_mat(1, 1), ndim, e_tmp(1, 1), ndim, beta, h_tmp(1, 1), ndim)
125 CALL dgemm(
"N",
"N", ndim, num, ndim, alpha, a_mat(1, 1), ndim, s_tmp(1, 1), ndim, beta, h_tmp(1, 1), ndim)
127 DO ideg = 1, gle%loc_num_gle
128 imap = gle%map_info%index(ideg)
131 gle%nvt(ideg)%s(iadd) = h_tmp(iadd, imap)
133 ib = 1 + (imap - 1)/pint_env%ndim
134 idim = 1 + mod(imap - 1, pint_env%ndim)
135 pint_env%uv_t(ib, idim) = gle%nvt(ideg)%s(1)
136 gle%nvt(ideg)%thermostat_energy = gle%nvt(ideg)%thermostat_energy &
137 - 0.5_dp*pint_env%mass_fict(ib, idim)*gle%nvt(ideg)%s(1)**2
139 pint_env%e_kin_t = 0.0_dp
140 DEALLOCATE (e_tmp, s_tmp, h_tmp)
141 CALL timestop(handle)
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
subroutine, public gle_cholesky_stab(SST, S, n)
...
Defines the basic variable types.
integer, parameter, public dp
Methods to apply GLE to PI runs.
subroutine, public pint_gle_init(pint_env)
...
subroutine, public pint_gle_step(pint_env)
...
elemental subroutine, public pint_calc_gle_energy(pint_env)
...