(git:ccc2433)
neb_methods.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 ! **************************************************************************************************
9 !> \brief Module performing a Nudged Elastic Band Calculation
10 !> \note
11 !> Numerical accuracy for parallel runs:
12 !> Each replica starts the SCF run from the one optimized
13 !> in a previous run. It may happen then energies and derivatives
14 !> of a serial run and a parallel run could be slightly different
15 !> 'cause of a different starting density matrix.
16 !> Exact results are obtained using:
17 !> EXTRAPOLATION USE_GUESS in QS section (Teo 09.2006)
18 !> \author Teodoro Laino 09.2006
19 !> \par History
20 !> - Teodoro Laino 10.2008 [tlaino] - University of Zurich
21 !> Extension to a subspace of collective variables
22 ! **************************************************************************************************
27  cp_logger_type,&
28  cp_to_string
30  cp_iterate,&
34  USE cp_subsys_types, ONLY: cp_subsys_type
37  f_env_type
39  USE global_types, ONLY: global_environment_type
40  USE header, ONLY: band_header
41  USE input_constants, ONLY: band_diis_opt,&
42  band_md_opt,&
44  do_sm
45  USE input_section_types, ONLY: section_type,&
47  section_vals_type,&
49  USE kinds, ONLY: dp
50  USE message_passing, ONLY: mp_para_env_type
51  USE neb_io, ONLY: dump_neb_info,&
54  USE neb_md_utils, ONLY: control_vels_a,&
56  USE neb_opt_utils, ONLY: accept_diis_step,&
57  neb_ls
58  USE neb_types, ONLY: neb_type,&
61  neb_var_type
62  USE neb_utils, ONLY: build_replica_coords,&
67  USE particle_types, ONLY: particle_type
68  USE physcon, ONLY: massunit
70  USE replica_types, ONLY: rep_env_release,&
71  replica_env_type
72 #include "../base/base_uses.f90"
73 
74  IMPLICIT NONE
75  PRIVATE
76  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'neb_methods'
77  LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .false.
78  PUBLIC :: neb
79 
80 CONTAINS
81 
82 ! **************************************************************************************************
83 !> \brief Real subroutine for NEB calculations
84 !> \param input ...
85 !> \param input_declaration ...
86 !> \param para_env ...
87 !> \param globenv ...
88 !> \author Teodoro Laino 09.2006
89 !> \note
90 !> Based on the use of replica_env
91 ! **************************************************************************************************
92  SUBROUTINE neb(input, input_declaration, para_env, globenv)
93  TYPE(section_vals_type), POINTER :: input
94  TYPE(section_type), POINTER :: input_declaration
95  TYPE(mp_para_env_type), POINTER :: para_env
96  TYPE(global_environment_type), POINTER :: globenv
97 
98  CHARACTER(len=*), PARAMETER :: routinen = 'neb'
99 
100  INTEGER :: handle, ierr, iw, iw2, nrep, &
101  output_unit, prep, proc_dist_type
102  LOGICAL :: check, row_force
103  TYPE(cp_logger_type), POINTER :: logger
104  TYPE(cp_subsys_type), POINTER :: subsys
105  TYPE(f_env_type), POINTER :: f_env
106  TYPE(neb_type), POINTER :: neb_env
107  TYPE(neb_var_type), POINTER :: coords, forces, vels
108  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
109  TYPE(replica_env_type), POINTER :: rep_env
110  TYPE(section_vals_type), POINTER :: diis_section, force_env_section, &
111  md_section, motion_section, &
112  neb_section, print_section
113 
114  CALL timeset(routinen, handle)
115  NULLIFY (logger, subsys, f_env, rep_env)
116  NULLIFY (forces, coords, vels, neb_env)
117  logger => cp_get_default_logger()
118  CALL cp_add_iter_level(logger%iter_info, "BAND")
119  motion_section => section_vals_get_subs_vals(input, "MOTION")
120  print_section => section_vals_get_subs_vals(motion_section, "PRINT")
121  neb_section => section_vals_get_subs_vals(motion_section, "BAND")
122  output_unit = cp_print_key_unit_nr(logger, neb_section, "PROGRAM_RUN_INFO", &
123  extension=".nebLog")
124  CALL section_vals_val_get(neb_section, "NPROC_REP", i_val=prep)
125  CALL section_vals_val_get(neb_section, "PROC_DIST_TYPE", i_val=proc_dist_type)
126  row_force = (proc_dist_type == do_rep_blocked)
127  nrep = max(1, para_env%num_pe/prep)
128  IF (nrep*prep /= para_env%num_pe .AND. output_unit > 0) THEN
129  CALL cp_warn(__location__, &
130  "Number of totally requested processors ("//trim(adjustl(cp_to_string(para_env%num_pe)))//") "// &
131  "is not compatible with the number of processors requested per replica ("// &
132  trim(adjustl(cp_to_string(prep)))//") and the number of replicas ("// &
133  trim(adjustl(cp_to_string(nrep)))//") . ["// &
134  trim(adjustl(cp_to_string(para_env%num_pe - nrep*prep)))//"] processors will be wasted!")
135  END IF
136  force_env_section => section_vals_get_subs_vals(input, "FORCE_EVAL")
137  ! Create Replica Environments
138  IF (output_unit > 0) WRITE (output_unit, '(T2,"NEB|",A)') " Replica_env Setup. START"
139  CALL rep_env_create(rep_env, para_env=para_env, input=input, &
140  input_declaration=input_declaration, nrep=nrep, prep=prep, row_force=row_force)
141  IF (output_unit > 0) WRITE (output_unit, '(T2,"NEB|",A)') " Replica_env Setup. END"
142  IF (ASSOCIATED(rep_env)) THEN
143  cpassert(SIZE(rep_env%local_rep_indices) == 1)
144  CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
145  CALL force_env_get(f_env%force_env, subsys=subsys)
146  particle_set => subsys%particles%els
147  ! Read NEB controlling parameters
148  ALLOCATE (neb_env)
149  neb_env%force_env => f_env%force_env
150  neb_env%root_section => input
151  neb_env%force_env_section => force_env_section
152  neb_env%motion_print_section => print_section
153  neb_env%neb_section => neb_section
154  neb_env%nsize_xyz = rep_env%ndim
155  neb_env%nsize_int = number_of_colvar(f_env%force_env)
156  check = (neb_env%nsize_xyz >= neb_env%nsize_int)
157  cpassert(check)
158  ! Check that the used colvar are uniquely determined
159  check = (number_of_colvar(f_env%force_env) == &
160  number_of_colvar(f_env%force_env, unique=.true.))
161  cpassert(check)
162  CALL read_neb_section(neb_env, neb_section)
163  ! Print BAND header
164  iw2 = cp_print_key_unit_nr(logger, neb_section, "BANNER", extension=".nebLog")
165  CALL band_header(iw2, neb_env%number_of_replica, nrep, prep)
166  CALL cp_print_key_finished_output(iw2, logger, neb_section, "BANNER")
167  ! Allocate the principal vectors used in the BAND calculation
168  CALL neb_var_create(coords, neb_env, full_allocation=.true.)
169  CALL neb_var_create(forces, neb_env)
170  CALL neb_var_create(vels, neb_env)
171  ! Collecting the coordinates of the starting replicas of the BAND calculation
172  IF (output_unit > 0) WRITE (output_unit, '(T2,"NEB|",A)') " Building initial set of coordinates. START"
173  iw = cp_print_key_unit_nr(logger, neb_section, "PROGRAM_RUN_INFO/INITIAL_CONFIGURATION_INFO", &
174  extension=".nebLog")
175  CALL build_replica_coords(neb_section, particle_set, coords, vels, neb_env, iw, globenv, &
176  rep_env%para_env)
177  CALL cp_print_key_finished_output(iw, logger, neb_section, &
178  "PROGRAM_RUN_INFO/INITIAL_CONFIGURATION_INFO")
179  IF (output_unit > 0) WRITE (output_unit, '(T2,"NEB|",A)') " Building initial set of coordinates. END"
180  ! Print some additional info in the replica_env initialization file
181  CALL neb_rep_env_map_info(rep_env, neb_env)
182  ! Perform NEB optimization
183  SELECT CASE (neb_env%opt_type)
184  CASE (band_md_opt)
185  neb_env%opt_type_label = "MOLECULAR DYNAMICS"
186  md_section => section_vals_get_subs_vals(neb_section, "OPTIMIZE_BAND%MD")
187  CALL neb_md(rep_env, neb_env, coords, vels, forces, particle_set, output_unit, &
188  md_section, logger, globenv)
189  CASE (band_diis_opt)
190  neb_env%opt_type_label = "DIIS"
191  diis_section => section_vals_get_subs_vals(neb_section, "OPTIMIZE_BAND%DIIS")
192  CALL neb_diis(rep_env, neb_env, coords, vels, forces, particle_set, output_unit, &
193  diis_section, logger, globenv)
194  END SELECT
195  ! Release force_eval
196  CALL f_env_rm_defaults(f_env, ierr)
197  ! Release coords, vels and forces
198  CALL neb_var_release(coords)
199  CALL neb_var_release(forces)
200  CALL neb_var_release(vels)
201  ! At the end let's destroy the environment of the BAND calculation
202  DEALLOCATE (neb_env)
203  END IF
204  CALL rep_env_release(rep_env)
205  CALL cp_print_key_finished_output(output_unit, logger, neb_section, &
206  "PROGRAM_RUN_INFO")
207  CALL cp_rm_iter_level(logger%iter_info, "BAND")
208  CALL timestop(handle)
209  END SUBROUTINE neb
210 
211 ! **************************************************************************************************
212 !> \brief MD type optimization NEB
213 !> \param rep_env ...
214 !> \param neb_env ...
215 !> \param coords ...
216 !> \param vels ...
217 !> \param forces ...
218 !> \param particle_set ...
219 !> \param output_unit ...
220 !> \param md_section ...
221 !> \param logger ...
222 !> \param globenv ...
223 !> \author Teodoro Laino 09.2006
224 ! **************************************************************************************************
225  SUBROUTINE neb_md(rep_env, neb_env, coords, vels, forces, particle_set, output_unit, &
226  md_section, logger, globenv)
227  TYPE(replica_env_type), POINTER :: rep_env
228  TYPE(neb_type), OPTIONAL, POINTER :: neb_env
229  TYPE(neb_var_type), POINTER :: coords, vels, forces
230  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
231  INTEGER, INTENT(IN) :: output_unit
232  TYPE(section_vals_type), POINTER :: md_section
233  TYPE(cp_logger_type), POINTER :: logger
234  TYPE(global_environment_type), POINTER :: globenv
235 
236  CHARACTER(len=*), PARAMETER :: routinen = 'neb_md'
237 
238  INTEGER :: handle, iatom, ic, is, istep, iw, &
239  max_steps, natom, shell_index
240  LOGICAL :: converged, should_stop
241  REAL(kind=dp) :: dt
242  REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: distances, energies
243  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: mass
244  TYPE(neb_var_type), POINTER :: dcoords
245  TYPE(section_vals_type), POINTER :: tc_section, vc_section
246 
247  CALL timeset(routinen, handle)
248  NULLIFY (dcoords, tc_section, vc_section)
249  cpassert(ASSOCIATED(coords))
250  cpassert(ASSOCIATED(vels))
251  ! MD band for string methods type does not make anywa sense. Stop calculation.
252  IF (neb_env%id_type == do_sm) THEN
253  cpwarn("MD band optimization and String Method incompatible.")
254  END IF
255  ! Output unit
256  iw = cp_print_key_unit_nr(logger, neb_env%neb_section, "REPLICA_INFO", &
257  extension=".replicaLog")
258  tc_section => section_vals_get_subs_vals(md_section, "TEMP_CONTROL")
259  vc_section => section_vals_get_subs_vals(md_section, "VEL_CONTROL")
260  CALL section_vals_val_get(md_section, "TIMESTEP", r_val=dt)
261  CALL section_vals_val_get(md_section, "MAX_STEPS", i_val=max_steps)
262  ! Initial setup for MD
263  CALL neb_var_create(dcoords, neb_env)
264  ALLOCATE (mass(SIZE(coords%wrk, 1), neb_env%number_of_replica))
265  ALLOCATE (energies(neb_env%number_of_replica))
266  ALLOCATE (distances(neb_env%number_of_replica - 1))
267  ! Setting up the mass array
268  IF (neb_env%use_colvar) THEN
269  mass(:, :) = 0.5_dp*dt/massunit
270  ELSE
271  natom = SIZE(particle_set)
272  DO iatom = 1, natom
273  ic = 3*(iatom - 1)
274  shell_index = particle_set(iatom)%shell_index
275  IF (shell_index == 0) THEN
276  mass(ic + 1:ic + 3, :) = 0.5_dp*dt/particle_set(iatom)%atomic_kind%mass
277  ELSE
278  is = 3*(natom + shell_index - 1)
279  mass(ic + 1:ic + 3, :) = 0.5_dp*dt/particle_set(iatom)%atomic_kind%shell%mass_core
280  mass(is + 1:is + 3, :) = 0.5_dp*dt/particle_set(iatom)%atomic_kind%shell%mass_shell
281  END IF
282  END DO
283  END IF
284  ! Initializing forces array
285  CALL reorient_images(neb_env%rotate_frames, particle_set, coords, vels, &
286  output_unit, distances, neb_env%number_of_replica)
287  neb_env%avg_distance = sqrt(sum(distances*distances)/real(SIZE(distances), kind=dp))
288  CALL neb_calc_energy_forces(rep_env, neb_env, coords, energies, forces, &
289  particle_set, iw)
290 
291  CALL dump_neb_info(neb_env=neb_env, &
292  coords=coords, &
293  vels=vels, &
294  forces=forces, &
295  particle_set=particle_set, &
296  logger=logger, &
297  istep=0, &
298  energies=energies, &
299  distances=distances, &
300  output_unit=output_unit)
301  md_opt_loop: DO istep = 1, max_steps
302  CALL cp_iterate(logger%iter_info, iter_nr=istep)
303  ! Save the optimization step counter
304  neb_env%istep = istep
305  ! Velocity Verlet (first part)
306  vels%wrk(:, :) = vels%wrk(:, :) + mass(:, :)*forces%wrk(:, :)
307  ! Control on velocity - I part [rescale, annealing]
308  CALL control_vels_a(vels, particle_set, tc_section, vc_section, output_unit, &
309  istep)
310  ! Coordinate step
311  dcoords%wrk(:, :) = dt*vels%wrk(:, :)
312  coords%wrk(:, :) = coords%wrk(:, :) + dcoords%wrk(:, :)
313 
314  CALL reorient_images(neb_env%rotate_frames, particle_set, coords, vels, &
315  output_unit, distances, neb_env%number_of_replica)
316  neb_env%avg_distance = sqrt(sum(distances*distances)/real(SIZE(distances), kind=dp))
317  CALL neb_calc_energy_forces(rep_env, neb_env, coords, energies, forces, &
318  particle_set, iw)
319  ! Check for an external exit command
320  CALL external_control(should_stop, "NEB", globenv=globenv)
321  IF (should_stop) EXIT
322  ! Control on velocity - II part [check vels VS forces, Steepest Descent like]
323  CALL control_vels_b(vels, forces, vc_section)
324  ! Velocity Verlet (second part)
325  vels%wrk(:, :) = vels%wrk(:, :) + mass(:, :)*forces%wrk(:, :)
326  ! Dump Infos
327  CALL dump_neb_info(neb_env=neb_env, &
328  coords=coords, &
329  vels=vels, &
330  forces=forces, &
331  particle_set=particle_set, &
332  logger=logger, &
333  istep=istep, &
334  energies=energies, &
335  distances=distances, &
336  output_unit=output_unit)
337  converged = check_convergence(neb_env, dcoords, forces)
338  IF (converged) EXIT
339  END DO md_opt_loop
340 
341  DEALLOCATE (mass)
342  DEALLOCATE (energies)
343  DEALLOCATE (distances)
344  CALL neb_var_release(dcoords)
345  CALL cp_print_key_finished_output(iw, logger, neb_env%neb_section, &
346  "REPLICA_INFO")
347  CALL timestop(handle)
348 
349  END SUBROUTINE neb_md
350 
351 ! **************************************************************************************************
352 !> \brief DIIS type optimization NEB
353 !> \param rep_env ...
354 !> \param neb_env ...
355 !> \param coords ...
356 !> \param vels ...
357 !> \param forces ...
358 !> \param particle_set ...
359 !> \param output_unit ...
360 !> \param diis_section ...
361 !> \param logger ...
362 !> \param globenv ...
363 !> \author Teodoro Laino 09.2006
364 ! **************************************************************************************************
365  SUBROUTINE neb_diis(rep_env, neb_env, coords, vels, forces, particle_set, output_unit, &
366  diis_section, logger, globenv)
367  TYPE(replica_env_type), POINTER :: rep_env
368  TYPE(neb_type), OPTIONAL, POINTER :: neb_env
369  TYPE(neb_var_type), POINTER :: coords, vels, forces
370  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
371  INTEGER, INTENT(IN) :: output_unit
372  TYPE(section_vals_type), POINTER :: diis_section
373  TYPE(cp_logger_type), POINTER :: logger
374  TYPE(global_environment_type), POINTER :: globenv
375 
376  CHARACTER(len=*), PARAMETER :: routinen = 'neb_diis'
377 
378  INTEGER :: handle, istep, iw, iw2, max_sd_steps, &
379  max_steps, n_diis
380  INTEGER, DIMENSION(:), POINTER :: set_err
381  LOGICAL :: check_diis, converged, diis_on, do_ls, &
382  should_stop, skip_ls
383  REAL(kind=dp) :: max_stepsize, norm, stepsize, stepsize0
384  REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: distances, energies
385  REAL(kind=dp), DIMENSION(:, :), POINTER :: crr, err
386  TYPE(neb_var_type), POINTER :: sline
387 
388  CALL timeset(routinen, handle)
389  NULLIFY (sline, crr, err)
390  neb_env%opt_type_label = "SD"
391  do_ls = .true.
392  cpassert(ASSOCIATED(coords))
393  cpassert(ASSOCIATED(vels))
394  cpassert(ASSOCIATED(forces))
395  iw = cp_print_key_unit_nr(logger, neb_env%neb_section, "REPLICA_INFO", &
396  extension=".replicaLog")
397  CALL section_vals_val_get(diis_section, "MAX_STEPS", i_val=max_steps)
398  CALL section_vals_val_get(diis_section, "N_DIIS", i_val=n_diis)
399  CALL section_vals_val_get(diis_section, "STEPSIZE", r_val=stepsize0)
400  CALL section_vals_val_get(diis_section, "MAX_STEPSIZE", r_val=max_stepsize)
401  CALL section_vals_val_get(diis_section, "NO_LS", l_val=skip_ls)
402  CALL section_vals_val_get(diis_section, "MAX_SD_STEPS", i_val=max_sd_steps)
403  CALL section_vals_val_get(diis_section, "CHECK_DIIS", l_val=check_diis)
404  iw2 = cp_print_key_unit_nr(logger, diis_section, "DIIS_INFO", &
405  extension=".diisLog")
406  ! Initial setup for DIIS
407  stepsize = stepsize0
408  ! Allocate type for Line Search direction
409  CALL neb_var_create(sline, neb_env, full_allocation=.true.)
410  ! Array of error vectors
411  ALLOCATE (err(product(coords%size_wrk), n_diis))
412  ALLOCATE (crr(product(coords%size_wrk), n_diis))
413  ALLOCATE (set_err(n_diis))
414  ALLOCATE (energies(neb_env%number_of_replica))
415  ALLOCATE (distances(neb_env%number_of_replica - 1))
416  ! Initializing forces array
417  CALL reorient_images(neb_env%rotate_frames, particle_set, coords, vels, &
418  output_unit, distances, neb_env%number_of_replica)
419  CALL reparametrize_images(neb_env%reparametrize_frames, neb_env%spline_order, &
420  neb_env%smoothing, coords%wrk, sline%wrk, distances)
421  neb_env%avg_distance = sqrt(sum(distances*distances)/real(SIZE(distances), kind=dp))
422  CALL neb_calc_energy_forces(rep_env, neb_env, coords, energies, forces, &
423  particle_set, iw)
424  ! Dump Infos
425  CALL dump_neb_info(neb_env=neb_env, &
426  coords=coords, &
427  forces=forces, &
428  particle_set=particle_set, &
429  logger=logger, &
430  istep=0, &
431  energies=energies, &
432  distances=distances, &
433  vels=vels, &
434  output_unit=output_unit)
435  ! If rotation is requested let's apply it at the beginning of the
436  ! Geometry optimization and then let's disable it
437  neb_env%rotate_frames = .false.
438  ! Main SD/DIIS loop
439  set_err = -1
440  DO istep = 1, max_steps
441  CALL cp_iterate(logger%iter_info, iter_nr=istep)
442  neb_env%opt_type_label = "SD"
443  ! Save the optimization step counter
444  neb_env%istep = istep
445  ! Perform one step of SD with line search
446  norm = sqrt(sum(forces%wrk*forces%wrk))
447  IF (norm < epsilon(0.0_dp)) THEN
448  ! Let's handle the case in which the band is already fully optimized
449  converged = .true.
450  EXIT
451  END IF
452  sline%wrk = forces%wrk/norm
453  IF (do_ls .AND. (.NOT. skip_ls)) THEN
454  CALL neb_ls(stepsize, sline, rep_env, neb_env, coords, energies, forces, &
455  vels, particle_set, iw, output_unit, distances, diis_section, iw2)
456  IF (iw2 > 0) &
457  WRITE (iw2, '(T2,A,T69,F12.6)') "SD| Stepsize in SD after linesearch", &
458  stepsize
459  ELSE
460  stepsize = min(norm*stepsize0, max_stepsize)
461  IF (iw2 > 0) &
462  WRITE (iw2, '(T2,A,T69,F12.6)') "SD| Stepsize in SD no linesearch performed", &
463  stepsize
464  END IF
465  sline%wrk = stepsize*sline%wrk
466  diis_on = accept_diis_step(istep > max_sd_steps, n_diis, err, crr, set_err, sline, coords, &
467  check_diis, iw2)
468  IF (diis_on) THEN
469  neb_env%opt_type_label = "DIIS"
470  END IF
471  do_ls = .true.
472  IF (count(set_err == -1) == 1) do_ls = .false.
473  coords%wrk = coords%wrk + sline%wrk
474  ! Compute forces
475  CALL reorient_images(neb_env%rotate_frames, particle_set, coords, vels, &
476  output_unit, distances, neb_env%number_of_replica)
477  CALL reparametrize_images(neb_env%reparametrize_frames, neb_env%spline_order, &
478  neb_env%smoothing, coords%wrk, sline%wrk, distances)
479  neb_env%avg_distance = sqrt(sum(distances*distances)/real(SIZE(distances), kind=dp))
480  CALL neb_calc_energy_forces(rep_env, neb_env, coords, energies, forces, &
481  particle_set, iw)
482  ! Check for an external exit command
483  CALL external_control(should_stop, "NEB", globenv=globenv)
484  IF (should_stop) EXIT
485  ! Dump Infos
486  CALL dump_neb_info(neb_env=neb_env, &
487  coords=coords, &
488  forces=forces, &
489  particle_set=particle_set, &
490  logger=logger, &
491  istep=istep, &
492  energies=energies, &
493  distances=distances, &
494  vels=vels, &
495  output_unit=output_unit)
496 
497  converged = check_convergence(neb_env, sline, forces)
498  IF (converged) EXIT
499  END DO
500  DEALLOCATE (energies)
501  DEALLOCATE (distances)
502  DEALLOCATE (err)
503  DEALLOCATE (crr)
504  DEALLOCATE (set_err)
505  CALL neb_var_release(sline)
506  CALL timestop(handle)
507  END SUBROUTINE neb_diis
508 
509 END MODULE neb_methods
evaluations of colvar for internal coordinates schemes
Definition: colvar_utils.F:14
integer function, public number_of_colvar(force_env, only_intra_colvar, unique)
Gives back the number of colvar defined for a force_eval.
Definition: colvar_utils.F:70
Routines to handle the external control of CP2K.
subroutine, public external_control(should_stop, flag, globenv, target_time, start_time, force_check)
External manipulations during a run : when the <PROJECT_NAME>.EXIT_$runtype command is sent the progr...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
types that represent a subsys, i.e. a part of the system
interface to use cp2k as library
Definition: f77_interface.F:20
subroutine, public f_env_add_defaults(f_env_id, f_env, handle)
adds the default environments of the f_env to the stack of the defaults, and returns a new error and ...
subroutine, public f_env_rm_defaults(f_env, ierr, handle)
removes the default environments of the f_env to the stack of the defaults, and sets ierr accordingly...
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env)
returns various attributes about the force environment
Define type storing the global information of a run. Keep the amount of stored data small....
Definition: global_types.F:21
Definition: header.F:13
subroutine, public band_header(iw, ni, nr, np)
...
Definition: header.F:336
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public band_md_opt
integer, parameter, public do_rep_blocked
integer, parameter, public do_sm
integer, parameter, public band_diis_opt
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition: kinds.F:23
integer, parameter, public dp
Definition: kinds.F:34
Interface to the message passing library MPI.
I/O Module for Nudged Elastic Band Calculation.
Definition: neb_io.F:20
subroutine, public read_neb_section(neb_env, neb_section)
Read data from the NEB input section.
Definition: neb_io.F:92
subroutine, public neb_rep_env_map_info(rep_env, neb_env)
Print some mapping infos in the replica_env setup output files i.e. prints in which files one can fin...
Definition: neb_io.F:529
subroutine, public dump_neb_info(neb_env, coords, vels, forces, particle_set, logger, istep, energies, distances, output_unit)
dump print info of a NEB run
Definition: neb_io.F:169
Module with utility to perform MD Nudged Elastic Band Calculation.
Definition: neb_md_utils.F:20
subroutine, public control_vels_a(vels, particle_set, tc_section, vc_section, output_unit, istep)
Control on velocities - I part.
Definition: neb_md_utils.F:169
subroutine, public control_vels_b(vels, forces, vc_section)
Control on velocities - II part.
Definition: neb_md_utils.F:228
Module performing a Nudged Elastic Band Calculation.
Definition: neb_methods.F:23
subroutine, public neb(input, input_declaration, para_env, globenv)
Real subroutine for NEB calculations.
Definition: neb_methods.F:93
Module with utility to perform MD Nudged Elastic Band Calculation.
Definition: neb_opt_utils.F:20
logical function, public accept_diis_step(apply_diis, n_diis, err, crr, set_err, sline, coords, check_diis, iw2)
Performs few basic operations for the NEB DIIS optimization.
Definition: neb_opt_utils.F:64
subroutine, public neb_ls(stepsize, sline, rep_env, neb_env, coords, energies, forces, vels, particle_set, iw, output_unit, distances, diis_section, iw2)
Perform a line minimization search in optimizing a NEB with DIIS.
Typo for Nudged Elastic Band Calculation.
Definition: neb_types.F:20
subroutine, public neb_var_release(neb_var)
Releases a variable type for BAND calculation.
Definition: neb_types.F:127
subroutine, public neb_var_create(neb_var, neb_env, full_allocation)
Creates a variable type for BAND calculation.
Definition: neb_types.F:84
Module with utility for Nudged Elastic Band Calculation.
Definition: neb_utils.F:20
subroutine, public neb_calc_energy_forces(rep_env, neb_env, coords, energies, forces, particle_set, output_unit)
Driver to compute energy and forces within a NEB, Based on the use of the replica_env.
Definition: neb_utils.F:367
logical function, public check_convergence(neb_env, Dcoords, forces)
Checks for convergence criteria during a NEB run.
Definition: neb_utils.F:994
subroutine, public build_replica_coords(neb_section, particle_set, coords, vels, neb_env, iw, globenv, para_env)
Constructs or Read the coordinates for all replica.
Definition: neb_utils.F:140
subroutine, public reorient_images(rotate_frames, particle_set, coords, vels, iw, distances, number_of_replica)
Reorient iteratively all images of the NEB chain in order to have always the smaller RMSD between two...
Definition: neb_utils.F:877
subroutine, public reparametrize_images(reparametrize_frames, spline_order, smoothing, coords, sline, distances)
Reparametrization of the replica for String Method with splines.
Definition: neb_utils.F:930
Define the data structure for the particle information.
Definition of physical constants:
Definition: physcon.F:68
real(kind=dp), parameter, public massunit
Definition: physcon.F:141
methods to setup replicas of the same system differing only by atom positions and velocities (as used...
subroutine, public rep_env_create(rep_env, para_env, input, input_declaration, nrep, prep, sync_v, keep_wf_history, row_force)
creates a replica environment together with its force environment
types used to handle many replica of the same system that differ only in atom positions,...
Definition: replica_types.F:21
subroutine, public rep_env_release(rep_env)
releases the given replica environment