1!--------------------------------------------------------------------------------------------------! 2! CP2K: A general program to perform molecular dynamics simulations ! 3! Copyright (C) 2000 - 2019 CP2K developers group ! 4!--------------------------------------------------------------------------------------------------! 5 6MODULE pint_types 7 8 USE cp_log_handling, ONLY: cp_logger_type 9 USE gle_system_types, ONLY: gle_type 10 USE input_section_types, ONLY: section_vals_type 11 USE kinds, ONLY: dp 12 USE parallel_rng_types, ONLY: rng_record_length,& 13 rng_stream_type 14 USE replica_types, ONLY: replica_env_type 15 USE simpar_types, ONLY: simpar_type 16#include "../base/base_uses.f90" 17 18 IMPLICIT NONE 19 20 PRIVATE 21 22 ! Energy contributions - symbolic names for indexing energy arrays 23 INTEGER, PARAMETER, PUBLIC :: e_conserved_id = 1, & 24 e_potential_id = 2, & 25 e_kin_thermo_id = 3, & 26 e_kin_virial_id = 4 27 28 ! Number of energy contributions for static array allocation 29 INTEGER, PARAMETER, PUBLIC :: e_num_ids = 4 30 31 INTEGER, PARAMETER, PUBLIC :: thermostat_none = 0, & 32 thermostat_nose = 1, & 33 thermostat_gle = 2, & 34 thermostat_pile = 3, & 35 thermostat_piglet = 4, & 36 thermostat_qtb = 5 37 38 PUBLIC :: pint_env_type 39 PUBLIC :: normalmode_env_type 40 PUBLIC :: staging_env_type 41 PUBLIC :: pile_therm_type 42 PUBLIC :: piglet_therm_type 43 PUBLIC :: qtb_therm_type 44 45 ! *************************************************************************** 46 !> \brief environment for a path integral run 47 !> \param ref_count reference count of this data structure 48 !> \param id_nr identification number of this data structure 49 !> \param p number of replicas/beads 50 !> \param nnos nose hoover chain length 51 !> \param nrespa number of respa steps 52 !> \param nsteps - number of PIMD steps to be performed 53 !> \param iter current iteration number 54 !> \param ndim number of coordinates per replica/bead 55 !> \param transform type of transform (normalmode or staging) 56 !> \param t_tol temperature tolerance for rescaling 57 !> \param v_tol velocity tolerance for rescaling 58 !> \param kT boltzmann factor times temperature (simulation temperature 59 !> \param not necessarily the physical temperature) 60 !> \param beta 1/kT (physical temperature) 61 !> \param dt time step for dynamic 62 !> \param e_pot_h potential energy in harmonic springs 63 !> \param e_kin_beads (fictious) kinetic energy of the beads 64 !> \param e_pot_t potential energy of thermostats 65 !> \param e_kin_t kinetic energy of thermostats 66 !> \param energy - energy contributions updated every step REAL(e_num_ids) 67 !> \param e_kin_virial_id - virial estimator of the (real) kinetic energy 68 !> \param t current simulation time 69 !> \param replicas replica environment for force calculations 70 !> \param input input data structure 71 !> \param staging_env description for the staging transformation 72 !> \param normalmode_env description for the normal mode transformation 73 !> \param randomG random number stream descriptor 74 !> \param mass real masses 75 !> \param e_pot_bead array with last energies from QS per replica 76 !> \param x array with real space coordinates (P, 3*N) 77 !> \param v array with real space velocities 78 !> \param f array with real space forces 79 !> \param mass_beads masses of the beads for harmonic forces (harmonic mass) 80 !> \param mass_fict fictious mass of the beads for dynamics (kinetic mass) 81 !> \param ux array with transformed space coordinates (P, 3*N) 82 !> \param uv array with transformed velocities 83 !> \param uv_t array with temporary transformed velocities 84 !> \param uv_new array with new transformed velocities 85 !> \param uf array with transformed accelerations (QS part) 86 !> \param uf_h array with harmonic part transformed forces 87 !> \param tx nose hoover chain positions (pint_env%nnos,pint_env%p,pint_env%ndim) 88 !> \param tv nose hoover chain velocities 89 !> \param tv_t nose hoover chain velocities (temporary) 90 !> \param tv_old nose hoover chain velocities (older) 91 !> \param tv_new nose hoover chain velocities (newer) 92 !> \param tf nose hoover chain forces (?) 93 !> \param Q nose hoover chain masses 94 !> \param time_per_step - time per step in seconds (updated every step) 95 !> \param pile_therm data used for the pile thermostat 96 !> \param wsinex omega*sin(omega*deltat) for exact harminic integrator 97 !> \param iwsinex 1/omega*sin(omega*deltat) for exact harminic integrator 98 !> \param cosex cos(omega*deltat) for exact harminic integrator 99 !> \param propagator contains propagator related constants 100 !> \param harm_integrator selects between numeric and exact harmonic integrator scheme 101 !> \param first_propagated_mode if 1 - propagate all normal modes, 102 !> if 2 - keep centoid fixed 103 !> \author fawzi 104 !> \par History 105 !> Added some comments - hforbert 106 !> Added normal mode transformation - hforbert 107 !> 2009-06-15 helium_solvent_type object is no longer a member of 108 !> pint_env_type [lwalewski] 109 !> 2014-10-23 added pile_therm [Felix Uhl] 110 !> 2018-02-13 added qtb_therm [Fabien Brieuc] 111 ! *************************************************************************** 112 TYPE pint_env_type 113 INTEGER :: ref_count, id_nr, p, nnos, nrespa, iter, ndim, transform 114 INTEGER :: first_step, last_step, num_steps, first_propagated_mode 115 INTEGER :: pimd_thermostat, harm_integrator, thermostat_rng_seed 116 REAL(KIND=dp) :: t_tol, v_tol, kT, beta, dt, & 117 e_gle, e_pile, e_piglet, e_qtb, e_pot_h, e_kin_beads, e_pot_t, e_kin_t, t, time_per_step 118 REAL(KIND=dp) :: link_action, pot_action 119 TYPE(cp_logger_type), POINTER :: logger 120 TYPE(replica_env_type), POINTER :: replicas 121 TYPE(section_vals_type), POINTER :: input 122 TYPE(staging_env_type), POINTER :: staging_env 123 TYPE(normalmode_env_type), POINTER :: normalmode_env 124 TYPE(rng_stream_type), POINTER :: randomG 125 TYPE(gle_type), POINTER :: gle 126 REAL(KIND=dp), DIMENSION(e_num_ids) :: energy 127 REAL(KIND=dp), DIMENSION(:), POINTER :: mass, e_pot_bead 128 REAL(KIND=dp), DIMENSION(:, :), POINTER :: x, v, f, mass_beads, & 129 mass_fict, ux, ux_t, uv, uv_t, uv_new, uf, uf_h, external_f 130 REAL(KIND=dp), DIMENSION(:), POINTER :: centroid 131 REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: tx, tv, tv_t, tv_old, tv_new, tf 132 REAL(KIND=dp), DIMENSION(:), POINTER :: Q ! dim p, make it (p,ndim)? 133 REAL(KIND=dp), DIMENSION(:), POINTER :: rtmp_ndim, rtmp_natom 134 REAL(KIND=dp), DIMENSION(:), POINTER :: iwsinex, wsinex, cosex 135 TYPE(pile_therm_type), POINTER :: pile_therm 136 TYPE(piglet_therm_type), POINTER :: piglet_therm 137 TYPE(qtb_therm_type), POINTER :: qtb_therm 138 TYPE(pint_propagator_type), POINTER :: propagator 139 TYPE(simpar_type), POINTER :: simpar 140 INTEGER :: n_atoms_constraints 141 INTEGER, DIMENSION(:), POINTER :: atoms_constraints 142 REAL(KIND=dp) :: kTcorr 143 144 END TYPE pint_env_type 145 146 ! *************************************************************************** 147 !> \brief data to perform the normalmode transformation 148 !> \note 149 !> ref_count - reference count of this data structure 150 !> id_nr - identification number of this data structure 151 !> p - number of beads 152 !> Q_bead - thermostat mass for a non-centroid bead 153 !> Q_centroid - thermostat mass for a centroid degree of freedom 154 !> modefactor - mass scale factor for non-centroid degrees of freedom 155 !> harm - factor for harmonic potential ( w_p^2/modefactor ) 156 !> x2u - transformation matrix real coord to normal mode space 157 !> u2x - transformation matrix normal mode coord to real space 158 !> lambda - propagator frequencies of the ring polymer 159 !> 160 !> This could be done via FFT calls as well, but for now... 161 !> \author hforbert 162 ! *************************************************************************** 163 TYPE normalmode_env_type 164 INTEGER :: id_nr, ref_count, p 165 REAL(KIND=dp) :: Q_bead, Q_centroid, modefactor, harm 166 REAL(KIND=dp), DIMENSION(:, :), POINTER :: x2u, u2x 167 REAL(KIND=dp), DIMENSION(:), POINTER :: lambda 168 END TYPE normalmode_env_type 169 170 ! *************************************************************************** 171 !> \brief data to perform the staging transformation 172 !> \note 173 !> ref_count - reference count of this data structure 174 !> id_nr - identification number of this data structure 175 !> nseg 176 !> j 177 !> p 178 !> w_p 179 !> w_j 180 !> Q_stage 181 !> Q_end 182 !> \author fawzi 183 ! *************************************************************************** 184 TYPE staging_env_type 185 INTEGER :: id_nr, ref_count, nseg, j, p 186 REAL(KIND=dp) w_p, w_j, Q_stage, Q_end 187 END TYPE staging_env_type 188 189 ! *************************************************************************** 190 !> \brief data to use the pile thermostat 191 !> \note 192 !> lamb - coupling constant of pile to the normal modes 193 !> tau - time constant for centroid mode 194 !> thermostat_energy - energy difference for conxerved quantity 195 !> c1 - scaling of the old momenta 196 !> c2 - scaling of the friction term 197 !> g_fric - mode specific friction 198 !> massfact - Mass prefactor to get units right 199 !> gaussian_rng_stream - random number generator 200 !> \author Felix Uhl 201 ! *************************************************************************** 202 TYPE pile_therm_type 203 INTEGER :: ref_count 204 REAL(KIND=dp) :: lamb, tau, thermostat_energy 205 REAL(KIND=dp), DIMENSION(:), POINTER :: c1 206 REAL(KIND=dp), DIMENSION(:), POINTER :: c2 207 REAL(KIND=dp), DIMENSION(:), POINTER :: g_fric 208 REAL(KIND=dp), DIMENSION(:, :), POINTER :: massfact 209 TYPE(rng_stream_type), POINTER :: gaussian_rng_stream 210 END TYPE pile_therm_type 211 212 ! *************************************************************************** 213 !> \brief data to use the piglet thermostat 214 !> \note 215 !> ndim - number of degrees of freedom 216 !> p - trotter number 217 !> nsp1 - number of additional degrees of freedom for Markovian 218 !dynamics + 1 219 !> thermostat_energy - energy difference for conxerved quantity 220 !> a_mat - A matrices (9,9,P) 221 !> c_mat - C matrices (9,9,P) 222 !> gle_t - Deterministic part of propagator 223 !> gle_s - Stochastic part of propagator 224 !> smalls - Keeps a copy of momenta and additional degrees of 225 !freedom 226 !> to ensure Markovian dynamics 227 !> temp1 - Big storage array that is needed on the way 228 !> temp2 - vector to store the random numbers 229 !> sqrtmass - contains the squareroot of the dynamical masses 230 !> gaussian_rng_stream - random number generator 231 !> \author Felix Uhl 232 ! *************************************************************************** 233 TYPE piglet_therm_type 234 INTEGER :: ref_count 235 INTEGER :: ndim, p, nsp1 236 REAL(KIND=dp) :: thermostat_energy 237 REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: a_mat, c_mat 238 REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: gle_s, gle_t 239 REAL(KIND=dp), DIMENSION(:, :), POINTER :: smalls 240 REAL(KIND=dp), DIMENSION(:, :), POINTER :: temp1 241 REAL(KIND=dp), DIMENSION(:, :), POINTER :: temp2 242 REAL(KIND=dp), DIMENSION(:, :), POINTER :: sqrtmass 243 TYPE(rng_stream_type), POINTER :: gaussian_rng_stream 244 END TYPE piglet_therm_type 245 246 ! *************************************************************************** 247 !> \brief data to use the qtb thermostat 248 !> \note 249 !> tau - time constant (1/friction) for centroid mode 250 !> lamb - scaling of time constants to the ring polymer NM freq. 251 !> taucut - inverse of frequency cutoff for QTB forces 252 !> lambcut - scaling of the cutoff angular freq. to the ring polymer 253 !> c1 - scaling of the old momenta 254 !> c2 - scaling of the friction term 255 !> g_fric - mode specific friction 256 !> massfact - Mass prefactor to get units right 257 !> rf - stores the QTB forces 258 !> h - filter for computation of QTB forces 259 !> r - store random numbers for computation of QTB forces 260 !> - NM freq. 261 !> step - update QTB forces every qtb_step 262 !> cpt - to know when to draw new random forces (every qtb_step) 263 !> fp - defines if we use f_P^(0) or f_P^(1) 264 !> nf - nb of points used for the convolution product (memory) 265 !> gaussian_rng_stream - random number generator 266 !> rng_status - keep track of rng status for restart purposes 267 !> thermostat_energy - energy difference for conserved quantity 268 !> \author Fabien Brieuc 269 ! *************************************************************************** 270 TYPE qtb_therm_type 271 INTEGER :: ref_count 272 REAL(KIND=dp) :: tau, lamb 273 REAL(KIND=dp) :: taucut, lambcut 274 REAL(KIND=dp), DIMENSION(:), POINTER :: c1 275 REAL(KIND=dp), DIMENSION(:), POINTER :: c2 276 REAL(KIND=dp), DIMENSION(:), POINTER :: g_fric 277 REAL(KIND=dp), DIMENSION(:, :), POINTER :: massfact 278 REAL(KIND=dp), DIMENSION(:, :), POINTER :: rf 279 REAL(KIND=dp), DIMENSION(:, :), POINTER :: h 280 REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: r 281 INTEGER, DIMENSION(:), POINTER :: step 282 INTEGER, DIMENSION(:), POINTER :: cpt 283 INTEGER :: fp 284 INTEGER :: nf 285 REAL(KIND=dp) :: thermostat_energy 286 TYPE(rng_stream_type), POINTER :: gaussian_rng_stream 287 CHARACTER(LEN=rng_record_length), DIMENSION(:), POINTER :: rng_status 288 END TYPE qtb_therm_type 289 290 ! *************************************************************************** 291 !> \brief data for the use of different Path Integral propagators 292 !> \note 293 !> prop_kind - selects a hamiltonian for the equations of motion 294 !> temp_sim2phys - conversion factor for simulation to physical temperature 295 !> temp_phys2sim - conversion factor for physical to simulation temperature 296 !> physpotscale - factor to scale the physical interaction potential 297 !> \author Felix Uhl 298 ! *************************************************************************** 299 TYPE pint_propagator_type 300 INTEGER :: prop_kind 301 REAL(KIND=dp) :: temp_phys2sim 302 REAL(KIND=dp) :: temp_sim2phys 303 REAL(KIND=dp) :: physpotscale 304 END TYPE pint_propagator_type 305 306END MODULE pint_types 307