(git:b279b6b)
pint_types.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
8 MODULE pint_types
9 
10  USE cp_log_handling, ONLY: cp_logger_type
11  USE gle_system_types, ONLY: gle_type
12  USE input_section_types, ONLY: section_vals_type
13  USE kinds, ONLY: dp
15  rng_stream_type
16  USE replica_types, ONLY: replica_env_type
17  USE simpar_types, ONLY: simpar_type
18 #include "../base/base_uses.f90"
19 
20  IMPLICIT NONE
21 
22  PRIVATE
23 
24  ! Energy contributions - symbolic names for indexing energy arrays
25  INTEGER, PARAMETER, PUBLIC :: e_conserved_id = 1, &
26  e_potential_id = 2, &
27  e_kin_thermo_id = 3, &
28  e_kin_virial_id = 4
29 
30  ! Number of energy contributions for static array allocation
31  INTEGER, PARAMETER, PUBLIC :: e_num_ids = 4
32 
33  INTEGER, PARAMETER, PUBLIC :: thermostat_none = 0, &
34  thermostat_nose = 1, &
35  thermostat_gle = 2, &
36  thermostat_pile = 3, &
37  thermostat_piglet = 4, &
38  thermostat_qtb = 5
39 
40  PUBLIC :: pint_env_type
41  PUBLIC :: normalmode_env_type
42  PUBLIC :: staging_env_type
43  PUBLIC :: pile_therm_type
44  PUBLIC :: piglet_therm_type
45  PUBLIC :: qtb_therm_type
46 
47  ! ***************************************************************************
48  !> \brief environment for a path integral run
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 (fictitious) 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 fictitious 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 :: p = 0, nnos = 0, nrespa = 0, iter = 0, ndim = 0, transform = 0
114  INTEGER :: first_step = 0, last_step = 0, num_steps = 0, first_propagated_mode = 0
115  INTEGER :: pimd_thermostat = 0, harm_integrator = 0, thermostat_rng_seed = 0
116  REAL(kind=dp) :: t_tol = 0.0_dp, v_tol = 0.0_dp, kt = 0.0_dp, beta = 0.0_dp, dt = 0.0_dp, &
117  e_gle = 0.0_dp, e_pile = 0.0_dp, e_piglet = 0.0_dp, e_qtb = 0.0_dp, e_pot_h = 0.0_dp, &
118  e_kin_beads = 0.0_dp, e_pot_t = 0.0_dp, e_kin_t = 0.0_dp, t = 0.0_dp, time_per_step = 0.0_dp
119  REAL(kind=dp) :: link_action = 0.0_dp, pot_action = 0.0_dp
120  TYPE(cp_logger_type), POINTER :: logger => null()
121  TYPE(replica_env_type), POINTER :: replicas => null()
122  TYPE(section_vals_type), POINTER :: input => null()
123  TYPE(staging_env_type), POINTER :: staging_env => null()
124  TYPE(normalmode_env_type), POINTER :: normalmode_env => null()
125  TYPE(rng_stream_type) :: randomg = rng_stream_type()
126  TYPE(gle_type), POINTER :: gle => null()
127  REAL(kind=dp), DIMENSION(e_num_ids) :: energy = 0.0_dp
128  REAL(kind=dp), DIMENSION(:), POINTER :: mass => null(), e_pot_bead => null()
129  REAL(kind=dp), DIMENSION(:, :), POINTER :: x => null(), v => null(), f => null(), mass_beads => null(), &
130  mass_fict => null(), ux => null(), ux_t => null(), uv => null(), uv_t => null(), &
131  uv_new => null(), uf => null(), uf_h => null(), external_f => null()
132  REAL(kind=dp), DIMENSION(:), POINTER :: centroid => null()
133  REAL(kind=dp), DIMENSION(:, :, :), POINTER :: tx => null(), tv => null(), tv_t => null(), &
134  tv_old => null(), tv_new => null(), tf => null()
135  REAL(kind=dp), DIMENSION(:), POINTER :: q => null() ! dim p, make it (p,ndim)?
136  REAL(kind=dp), DIMENSION(:), POINTER :: rtmp_ndim => null(), rtmp_natom => null()
137  REAL(kind=dp), DIMENSION(:), POINTER :: iwsinex => null(), wsinex => null(), cosex => null()
138  TYPE(pile_therm_type), POINTER :: pile_therm => null()
139  TYPE(piglet_therm_type), POINTER :: piglet_therm => null()
140  TYPE(qtb_therm_type), POINTER :: qtb_therm => null()
141  TYPE(pint_propagator_type), POINTER :: propagator => null()
142  TYPE(simpar_type), POINTER :: simpar => null()
143  INTEGER :: n_atoms_constraints = 0
144  INTEGER, DIMENSION(:), POINTER :: atoms_constraints => null()
145  LOGICAL :: beadwise_constraints = .false.
146  REAL(kind=dp) :: ktcorr = 0.0_dp
147 
148  END TYPE pint_env_type
149 
150  ! ***************************************************************************
151  !> \brief data to perform the normalmode transformation
152  !> \note
153  !> p - number of beads
154  !> Q_bead - thermostat mass for a non-centroid bead
155  !> Q_centroid - thermostat mass for a centroid degree of freedom
156  !> modefactor - mass scale factor for non-centroid degrees of freedom
157  !> harm - factor for harmonic potential ( w_p^2/modefactor )
158  !> x2u - transformation matrix real coord to normal mode space
159  !> u2x - transformation matrix normal mode coord to real space
160  !> lambda - propagator frequencies of the ring polymer
161  !>
162  !> This could be done via FFT calls as well, but for now...
163  !> \author hforbert
164  ! ***************************************************************************
165  TYPE normalmode_env_type
166  INTEGER :: p = 0
167  REAL(kind=dp) :: q_bead = 0.0_dp, q_centroid = 0.0_dp, modefactor = 0.0_dp, harm = 0.0_dp
168  REAL(kind=dp), DIMENSION(:, :), POINTER :: x2u => null(), u2x => null()
169  REAL(kind=dp), DIMENSION(:), POINTER :: lambda => null()
170  END TYPE normalmode_env_type
171 
172  ! ***************************************************************************
173  !> \brief data to perform the staging transformation
174  !> \note
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 :: nseg = 0, j = 0, p = 0
186  REAL(kind=dp) :: w_p = 0.0_dp, w_j = 0.0_dp, q_stage = 0.0_dp, q_end = 0.0_dp
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  REAL(kind=dp) :: lamb = 0.0_dp, tau = 0.0_dp, thermostat_energy = 0.0_dp
204  REAL(kind=dp), DIMENSION(:), POINTER :: c1 => null()
205  REAL(kind=dp), DIMENSION(:), POINTER :: c2 => null()
206  REAL(kind=dp), DIMENSION(:), POINTER :: g_fric => null()
207  REAL(kind=dp), DIMENSION(:, :), POINTER :: massfact => null()
208  TYPE(rng_stream_type) :: gaussian_rng_stream = rng_stream_type()
209  END TYPE pile_therm_type
210 
211  ! ***************************************************************************
212  !> \brief data to use the piglet thermostat
213  !> \note
214  !> ndim - number of degrees of freedom
215  !> p - trotter number
216  !> nsp1 - number of additional degrees of freedom for Markovian
217  !dynamics + 1
218  !> thermostat_energy - energy difference for conxerved quantity
219  !> a_mat - A matrices (9,9,P)
220  !> c_mat - C matrices (9,9,P)
221  !> gle_t - Deterministic part of propagator
222  !> gle_s - Stochastic part of propagator
223  !> smalls - Keeps a copy of momenta and additional degrees of
224  !freedom
225  !> to ensure Markovian dynamics
226  !> temp1 - Big storage array that is needed on the way
227  !> temp2 - vector to store the random numbers
228  !> sqrtmass - contains the squareroot of the dynamical masses
229  !> gaussian_rng_stream - random number generator
230  !> \author Felix Uhl
231  ! ***************************************************************************
232  TYPE piglet_therm_type
233  INTEGER :: ndim = 0, p = 0, nsp1 = 0
234  REAL(kind=dp) :: thermostat_energy = 0.0_dp
235  REAL(kind=dp), DIMENSION(:, :, :), POINTER :: a_mat => null(), c_mat => null()
236  REAL(kind=dp), DIMENSION(:, :, :), POINTER :: gle_s => null(), gle_t => null()
237  REAL(kind=dp), DIMENSION(:, :), POINTER :: smalls => null()
238  REAL(kind=dp), DIMENSION(:, :), POINTER :: temp1 => null()
239  REAL(kind=dp), DIMENSION(:, :), POINTER :: temp2 => null()
240  REAL(kind=dp), DIMENSION(:, :), POINTER :: sqrtmass => null()
241  TYPE(rng_stream_type) :: gaussian_rng_stream = rng_stream_type()
242  END TYPE piglet_therm_type
243 
244  ! ***************************************************************************
245  !> \brief data to use the qtb thermostat
246  !> \note
247  !> tau - time constant (1/friction) for centroid mode
248  !> lamb - scaling of time constants to the ring polymer NM freq.
249  !> taucut - inverse of frequency cutoff for QTB forces
250  !> lambcut - scaling of the cutoff angular freq. to the ring polymer
251  !> c1 - scaling of the old momenta
252  !> c2 - scaling of the friction term
253  !> g_fric - mode specific friction
254  !> massfact - Mass prefactor to get units right
255  !> rf - stores the QTB forces
256  !> h - filter for computation of QTB forces
257  !> r - store random numbers for computation of QTB forces
258  !> - NM freq.
259  !> step - update QTB forces every qtb_step
260  !> cpt - to know when to draw new random forces (every qtb_step)
261  !> fp - defines if we use f_P^(0) or f_P^(1)
262  !> nf - nb of points used for the convolution product (memory)
263  !> gaussian_rng_stream - random number generator
264  !> rng_status - keep track of rng status for restart purposes
265  !> thermostat_energy - energy difference for conserved quantity
266  !> \author Fabien Brieuc
267  ! ***************************************************************************
268  TYPE qtb_therm_type
269  REAL(kind=dp) :: tau = 0.0_dp, lamb = 0.0_dp
270  REAL(kind=dp) :: taucut = 0.0_dp, lambcut = 0.0_dp
271  REAL(kind=dp), DIMENSION(:), POINTER :: c1 => null()
272  REAL(kind=dp), DIMENSION(:), POINTER :: c2 => null()
273  REAL(kind=dp), DIMENSION(:), POINTER :: g_fric => null()
274  REAL(kind=dp), DIMENSION(:, :), POINTER :: massfact => null()
275  REAL(kind=dp), DIMENSION(:, :), POINTER :: rf => null()
276  REAL(kind=dp), DIMENSION(:, :), POINTER :: h => null()
277  REAL(kind=dp), DIMENSION(:, :, :), POINTER :: r => null()
278  INTEGER, DIMENSION(:), POINTER :: step => null()
279  INTEGER, DIMENSION(:), POINTER :: cpt => null()
280  INTEGER :: fp = 0
281  INTEGER :: nf = 0
282  REAL(kind=dp) :: thermostat_energy = 0.0_dp
283  TYPE(rng_stream_type) :: gaussian_rng_stream = rng_stream_type()
284  CHARACTER(LEN=rng_record_length), DIMENSION(:), POINTER :: rng_status => null()
285  END TYPE qtb_therm_type
286 
287  ! ***************************************************************************
288  !> \brief data for the use of different Path Integral propagators
289  !> \note
290  !> prop_kind - selects a hamiltonian for the equations of motion
291  !> temp_sim2phys - conversion factor for simulation to physical temperature
292  !> temp_phys2sim - conversion factor for physical to simulation temperature
293  !> physpotscale - factor to scale the physical interaction potential
294  !> \author Felix Uhl
295  ! ***************************************************************************
296  TYPE pint_propagator_type
297  INTEGER :: prop_kind = 0
298  REAL(kind=dp) :: temp_phys2sim = 0.0_dp
299  REAL(kind=dp) :: temp_sim2phys = 0.0_dp
300  REAL(kind=dp) :: physpotscale = 0.0_dp
301  END TYPE pint_propagator_type
302 
303 END MODULE pint_types
various routines to log and control the output. The idea is that decisions about where to log should ...
objects that represent the structure of input sections and the data contained in an input section
Defines the basic variable types.
Definition: kinds.F:23
integer, parameter, public dp
Definition: kinds.F:34
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
integer, parameter, public rng_record_length
integer, parameter, public e_kin_thermo_id
Definition: pint_types.F:25
integer, parameter, public e_conserved_id
Definition: pint_types.F:25
integer, parameter, public e_num_ids
Definition: pint_types.F:31
integer, parameter, public thermostat_none
Definition: pint_types.F:33
integer, parameter, public thermostat_gle
Definition: pint_types.F:33
integer, parameter, public e_potential_id
Definition: pint_types.F:25
integer, parameter, public thermostat_pile
Definition: pint_types.F:33
integer, parameter, public thermostat_piglet
Definition: pint_types.F:33
integer, parameter, public thermostat_nose
Definition: pint_types.F:33
integer, parameter, public e_kin_virial_id
Definition: pint_types.F:25
integer, parameter, public thermostat_qtb
Definition: pint_types.F:33
types used to handle many replica of the same system that differ only in atom positions,...
Definition: replica_types.F:21
Type for storing MD parameters.
Definition: simpar_types.F:14