(git:98357aa)
Loading...
Searching...
No Matches
replica_methods.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief methods to setup replicas of the same system differing only by atom
10!> positions and velocities (as used in path integral or nudged elastic
11!> band for example)
12!> \par History
13!> 09.2005 created [fawzi]
14!> \author fawzi
15! **************************************************************************************************
18 USE cp_files, ONLY: close_file,&
30 USE f77_interface, ONLY: calc_force,&
36 get_pos,&
45 USE kinds, ONLY: default_path_length,&
46 dp
47 USE message_passing, ONLY: mp_comm_null,&
56 USE replica_types, ONLY: rep_env_sync,&
61#include "./base/base_uses.f90"
62
63 IMPLICIT NONE
64 PRIVATE
65
66 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .true.
67 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'replica_methods'
68 INTEGER, SAVE, PRIVATE :: last_rep_env_id = 0
69
71
72CONTAINS
73
74! **************************************************************************************************
75!> \brief creates a replica environment together with its force environment
76!> \param rep_env the replica environment that will be created
77!> \param para_env the parallel environment that will contain the replicas
78!> \param input the input used to initialize the force environment
79!> \param input_declaration ...
80!> \param nrep the number of replicas to calculate
81!> \param prep the number of processors for each replica
82!> \param sync_v if the velocity should be synchronized (defaults to false)
83!> \param keep_wf_history if wf history should be kept on a per replica
84!> basis (defaults to true for QS jobs)
85!> \param row_force to use the new mapping to the cart with rows
86!> working on force instead of columns.
87!> \author fawzi
88! **************************************************************************************************
89 SUBROUTINE rep_env_create(rep_env, para_env, input, input_declaration, nrep, prep, &
90 sync_v, keep_wf_history, row_force)
91 TYPE(replica_env_type), POINTER :: rep_env
92 TYPE(mp_para_env_type), POINTER :: para_env
93 TYPE(section_vals_type), POINTER :: input
94 TYPE(section_type), POINTER :: input_declaration
95 INTEGER :: nrep, prep
96 LOGICAL, INTENT(in), OPTIONAL :: sync_v, keep_wf_history, row_force
97
98 CHARACTER(len=default_path_length) :: input_file_path, output_file_path
99 INTEGER :: forcedim, i, i0, ierr, ip, ir, irep, lp, &
100 my_prep, new_env_id, nparticle, &
101 nrep_local, unit_nr
102 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: gridinfo
103 INTEGER, DIMENSION(2) :: dims, pos
104 TYPE(cp_logger_type), POINTER :: logger
105 TYPE(mp_para_cart_type), POINTER :: cart
106 TYPE(mp_para_env_type), POINTER :: para_env_f, para_env_full, &
107 para_env_inter_rep
108
109 cpassert(.NOT. ASSOCIATED(rep_env))
110 cpassert(ASSOCIATED(input_declaration))
111
112 NULLIFY (cart, para_env_f, para_env_inter_rep)
113 logger => cp_get_default_logger()
114 unit_nr = cp_logger_get_default_io_unit(logger)
115 new_env_id = -1
116 forcedim = 1
117 IF (PRESENT(row_force)) THEN
118 IF (row_force) forcedim = 2
119 END IF
120 my_prep = min(prep, para_env%num_pe)
121 dims(3 - forcedim) = min(para_env%num_pe/my_prep, nrep)
122 dims(forcedim) = my_prep
123 IF ((dims(1)*dims(2) /= para_env%num_pe) .AND. (unit_nr > 0)) THEN
124 WRITE (unit_nr, fmt="(T2,A)") "REPLICA| WARNING: number of processors is not divisible by the number of replicas"
125 WRITE (unit_nr, fmt="(T2,A,I0,A)") "REPLICA| ", para_env%num_pe - dims(1)*dims(2), " MPI process(es) will be idle"
126 END IF
127 ALLOCATE (cart)
128 CALL cart%create(comm_old=para_env, ndims=2, dims=dims)
129 IF (cart /= mp_comm_null) THEN
130 pos = cart%mepos_cart
131 ALLOCATE (para_env_full)
132 para_env_full = cart
133 ALLOCATE (para_env_f)
134 CALL para_env_f%from_split(cart, pos(3 - forcedim))
135 ALLOCATE (para_env_inter_rep)
136 CALL para_env_inter_rep%from_split(cart, pos(forcedim))
137 ALLOCATE (rep_env)
138 ELSE
139 pos = -1
140 DEALLOCATE (cart)
141 END IF
142 ALLOCATE (gridinfo(2, 0:para_env%num_pe - 1))
143 gridinfo = 0
144 gridinfo(:, para_env%mepos) = pos
145 CALL para_env%sum(gridinfo)
146 IF (unit_nr > 0) THEN
147 WRITE (unit_nr, fmt="(T2,A,T71,I10)") "REPLICA| layout of the replica grid, number of groups ", para_env_inter_rep%num_pe
148 WRITE (unit_nr, fmt="(T2,A,T71,I10)") "REPLICA| layout of the replica grid, size of each group", para_env_f%num_pe
149 WRITE (unit_nr, fmt="(T2,A)", advance="NO") "REPLICA| MPI process to grid (group,rank) correspondence:"
150 DO i = 0, para_env%num_pe - 1
151 IF (modulo(i, 4) == 0) WRITE (unit_nr, *)
152 WRITE (unit_nr, fmt='(A3,I4,A3,I4,A1,I4,A1)', advance="NO") &
153 " (", i, " : ", gridinfo(3 - forcedim, i), ",", &
154 gridinfo(forcedim, i), ")"
155 END DO
156 WRITE (unit_nr, *)
157 END IF
158 DEALLOCATE (gridinfo)
159 IF (ASSOCIATED(rep_env)) THEN
160 last_rep_env_id = last_rep_env_id + 1
161 rep_env%id_nr = last_rep_env_id
162 rep_env%ref_count = 1
163 rep_env%nrep = nrep
164 rep_env%sync_v = .false.
165 IF (PRESENT(sync_v)) rep_env%sync_v = sync_v
166 rep_env%keep_wf_history = .true.
167 IF (PRESENT(keep_wf_history)) rep_env%keep_wf_history = keep_wf_history
168 NULLIFY (rep_env%wf_history)
169 NULLIFY (rep_env%results)
170
171 rep_env%force_dim = forcedim
172 rep_env%my_rep_group = cart%mepos_cart(3 - forcedim)
173 ALLOCATE (rep_env%inter_rep_rank(0:para_env_inter_rep%num_pe - 1), &
174 rep_env%force_rank(0:para_env_f%num_pe - 1))
175 rep_env%inter_rep_rank = 0
176 rep_env%inter_rep_rank(rep_env%my_rep_group) = para_env_inter_rep%mepos
177 CALL para_env_inter_rep%sum(rep_env%inter_rep_rank)
178 rep_env%force_rank = 0
179 rep_env%force_rank(cart%mepos_cart(forcedim)) = para_env_f%mepos
180 CALL para_env_f%sum(rep_env%force_rank)
181
182 CALL section_vals_val_get(input, "GLOBAL%PROJECT_NAME", &
183 c_val=input_file_path)
184 rep_env%original_project_name = input_file_path
185 ! By default replica_env handles files for each replica
186 ! with the structure PROJECT_NAME-r-N where N is the
187 ! number of the local replica..
188 lp = len_trim(input_file_path)
189 input_file_path(lp + 1:len(input_file_path)) = "-r-"// &
190 adjustl(cp_to_string(rep_env%my_rep_group))
191 lp = len_trim(input_file_path)
192 ! Setup new project name
193 CALL section_vals_val_set(input, "GLOBAL%PROJECT_NAME", &
194 c_val=input_file_path)
195 ! Redirect the output of each replica on a same local file
196 output_file_path = input_file_path(1:lp)//".out"
197 CALL section_vals_val_set(input, "GLOBAL%OUTPUT_FILE_NAME", &
198 c_val=trim(output_file_path))
199
200 ! Dump an input file to warm-up new force_eval structures and
201 ! delete them immediately afterwards..
202 input_file_path(lp + 1:len(input_file_path)) = ".inp"
203 IF (para_env_f%is_source()) THEN
204 CALL open_file(file_name=trim(input_file_path), file_status="UNKNOWN", &
205 file_form="FORMATTED", file_action="WRITE", &
206 unit_number=unit_nr)
207 CALL section_vals_write(input, unit_nr, hide_root=.true.)
208 CALL close_file(unit_nr)
209 END IF
210 CALL create_force_env(new_env_id, input_declaration, input_file_path, &
211 output_file_path, para_env_f, ierr=ierr)
212 cpassert(ierr == 0)
213
214 ! Delete input files..
215 IF (para_env_f%is_source()) THEN
216 CALL open_file(file_name=trim(input_file_path), file_status="OLD", &
217 file_form="FORMATTED", file_action="READ", unit_number=unit_nr)
218 CALL close_file(unit_number=unit_nr, file_status="DELETE")
219 END IF
220
221 rep_env%f_env_id = new_env_id
222 CALL get_nparticle(new_env_id, nparticle, ierr)
223 cpassert(ierr == 0)
224 rep_env%nparticle = nparticle
225 rep_env%ndim = 3*nparticle
226 ALLOCATE (rep_env%replica_owner(nrep))
227
228 i0 = nrep/para_env_inter_rep%num_pe
229 ir = modulo(nrep, para_env_inter_rep%num_pe)
230 DO ip = 0, para_env_inter_rep%num_pe - 1
231 DO i = i0*ip + min(ip, ir) + 1, i0*(ip + 1) + min(ip + 1, ir)
232 rep_env%replica_owner(i) = ip
233 END DO
234 END DO
235
236 nrep_local = i0
237 IF (rep_env%my_rep_group < ir) nrep_local = nrep_local + 1
238 ALLOCATE (rep_env%local_rep_indices(nrep_local), &
239 rep_env%rep_is_local(nrep))
240 nrep_local = 0
241 rep_env%rep_is_local = .false.
242 DO irep = 1, nrep
243 IF (rep_env%replica_owner(irep) == rep_env%my_rep_group) THEN
244 nrep_local = nrep_local + 1
245 rep_env%local_rep_indices(nrep_local) = irep
246 rep_env%rep_is_local(irep) = .true.
247 END IF
248 END DO
249 cpassert(nrep_local == SIZE(rep_env%local_rep_indices))
250
251 rep_env%cart => cart
252 rep_env%para_env => para_env_full
253 rep_env%para_env_f => para_env_f
254 rep_env%para_env_inter_rep => para_env_inter_rep
255
256 ALLOCATE (rep_env%r(rep_env%ndim, nrep), rep_env%v(rep_env%ndim, nrep), &
257 rep_env%f(rep_env%ndim + 1, nrep))
258
259 rep_env%r = 0._dp
260 rep_env%f = 0._dp
261 rep_env%v = 0._dp
262 CALL set_vel(rep_env%f_env_id, rep_env%v(:, 1), rep_env%ndim, ierr)
263 cpassert(ierr == 0)
264 DO i = 1, nrep
265 IF (rep_env%rep_is_local(i)) THEN
266 CALL get_pos(rep_env%f_env_id, rep_env%r(:, i), rep_env%ndim, ierr)
267 cpassert(ierr == 0)
268 END IF
269 END DO
270 END IF
271 IF (ASSOCIATED(rep_env)) THEN
272 CALL rep_envs_add_rep_env(rep_env)
273 CALL rep_env_init_low(rep_env%id_nr, ierr)
274 cpassert(ierr == 0)
275 END IF
276 END SUBROUTINE rep_env_create
277
278! **************************************************************************************************
279!> \brief finishes the low level initialization of the replica env
280!> \param rep_env_id id_nr of the replica environment that should be initialized
281!> \param ierr will be non zero if there is an initialization error
282!> \author fawzi
283! **************************************************************************************************
284 SUBROUTINE rep_env_init_low(rep_env_id, ierr)
285 INTEGER, INTENT(in) :: rep_env_id
286 INTEGER, INTENT(out) :: ierr
287
288 INTEGER :: i, in_use, stat
289 LOGICAL :: do_kpoints, has_unit_metric
290 TYPE(cp_logger_type), POINTER :: logger
291 TYPE(cp_subsys_type), POINTER :: subsys
292 TYPE(dft_control_type), POINTER :: dft_control
293 TYPE(f_env_type), POINTER :: f_env
294 TYPE(qs_environment_type), POINTER :: qs_env
295 TYPE(replica_env_type), POINTER :: rep_env
296
297 rep_env => rep_envs_get_rep_env(rep_env_id, ierr=stat)
298 IF (.NOT. ASSOCIATED(rep_env)) THEN
299 cpabort("could not find rep_env with id_nr"//cp_to_string(rep_env_id))
300 END IF
301 NULLIFY (qs_env, dft_control, subsys)
302 CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
303 logger => cp_get_default_logger()
304 logger%iter_info%iteration(1) = rep_env%my_rep_group
305 CALL cp_add_iter_level(iteration_info=logger%iter_info, &
306 level_name="REPLICA_EVAL")
307 !wf interp
308 IF (rep_env%keep_wf_history) THEN
309 CALL force_env_get(f_env%force_env, in_use=in_use)
310 IF (in_use == use_qs_force) THEN
311 CALL force_env_get(f_env%force_env, qs_env=qs_env)
312 CALL get_qs_env(qs_env, dft_control=dft_control)
313 ALLOCATE (rep_env%wf_history(SIZE(rep_env%local_rep_indices)))
314 DO i = 1, SIZE(rep_env%wf_history)
315 NULLIFY (rep_env%wf_history(i)%wf_history)
316 IF (i == 1) THEN
317 CALL get_qs_env(qs_env, &
318 wf_history=rep_env%wf_history(i)%wf_history)
319 CALL wfi_retain(rep_env%wf_history(i)%wf_history)
320 ELSE
321 CALL get_qs_env(qs_env, has_unit_metric=has_unit_metric, &
322 do_kpoints=do_kpoints)
323 CALL wfi_create(rep_env%wf_history(i)%wf_history, &
324 interpolation_method_nr= &
325 dft_control%qs_control%wf_interpolation_method_nr, &
326 extrapolation_order=dft_control%qs_control%wf_extrapolation_order, &
327 has_unit_metric=has_unit_metric)
328 IF (do_kpoints) THEN
329 CALL wfi_create_for_kp(rep_env%wf_history(i)%wf_history)
330 END IF
331 END IF
332 END DO
333 ELSE
334 rep_env%keep_wf_history = .false.
335 END IF
336 END IF
337 ALLOCATE (rep_env%results(rep_env%nrep))
338 DO i = 1, rep_env%nrep
339 NULLIFY (rep_env%results(i)%results)
340 IF (i == 1) THEN
341 CALL force_env_get(f_env%force_env, subsys=subsys)
342 CALL cp_subsys_get(subsys, results=rep_env%results(i)%results)
343 CALL cp_result_retain(rep_env%results(i)%results)
344 ELSE
345 CALL cp_result_create(rep_env%results(i)%results)
346 END IF
347 END DO
348 CALL rep_env_sync(rep_env, rep_env%r)
349 CALL rep_env_sync(rep_env, rep_env%v)
350 CALL rep_env_sync(rep_env, rep_env%f)
351
352 CALL f_env_rm_defaults(f_env, ierr)
353 cpassert(ierr == 0)
354 END SUBROUTINE rep_env_init_low
355
356! **************************************************************************************************
357!> \brief evaluates the forces
358!> \param rep_env the replica environment on which you want to evaluate the
359!> forces
360!> \param calc_f if true calculates also the forces, if false only the
361!> energy
362!> \author fawzi
363!> \note
364!> indirect through f77_int_low to work around fortran madness
365! **************************************************************************************************
366 SUBROUTINE rep_env_calc_e_f(rep_env, calc_f)
367 TYPE(replica_env_type), POINTER :: rep_env
368 LOGICAL, OPTIONAL :: calc_f
369
370 CHARACTER(len=*), PARAMETER :: routinen = 'rep_env_calc_e_f'
371
372 INTEGER :: handle, ierr, my_calc_f
373
374 CALL timeset(routinen, handle)
375 cpassert(ASSOCIATED(rep_env))
376 cpassert(rep_env%ref_count > 0)
377 my_calc_f = 0
378 IF (PRESENT(calc_f)) THEN
379 IF (calc_f) my_calc_f = 1
380 END IF
381 CALL rep_env_calc_e_f_low(rep_env%id_nr, my_calc_f, ierr)
382 cpassert(ierr == 0)
383 CALL timestop(handle)
384 END SUBROUTINE rep_env_calc_e_f
385
386! **************************************************************************************************
387!> \brief calculates energy and force, internal private method
388!> \param rep_env_id the id if the replica environment in which energy and
389!> forces have to be evaluated
390!> \param calc_f if nonzero calculates also the forces along with the
391!> energy
392!> \param ierr if an error happens this will be nonzero
393!> \author fawzi
394!> \note
395!> low level wrapper to export this function in f77_int_low and work
396!> around the handling of circular dependencies in fortran
397! **************************************************************************************************
398 RECURSIVE SUBROUTINE rep_env_calc_e_f_low(rep_env_id, calc_f, ierr)
399 INTEGER, INTENT(in) :: rep_env_id, calc_f
400 INTEGER, INTENT(out) :: ierr
401
402 TYPE(f_env_type), POINTER :: f_env
403 TYPE(replica_env_type), POINTER :: rep_env
404
405 rep_env => rep_envs_get_rep_env(rep_env_id, ierr)
406 IF (ASSOCIATED(rep_env)) THEN
407 CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
408 CALL rep_env_calc_e_f_int(rep_env, calc_f /= 0)
409 CALL f_env_rm_defaults(f_env, ierr)
410 ELSE
411 ierr = 111
412 END IF
413 END SUBROUTINE rep_env_calc_e_f_low
414
415! **************************************************************************************************
416!> \brief calculates energy and force, internal private method
417!> \param rep_env the replica env to update
418!> \param calc_f if the force should be calculated as well (defaults to true)
419!> \author fawzi
420!> \note
421!> this is the where the real work is done
422! **************************************************************************************************
423 SUBROUTINE rep_env_calc_e_f_int(rep_env, calc_f)
424 TYPE(replica_env_type), POINTER :: rep_env
425 LOGICAL, OPTIONAL :: calc_f
426
427 INTEGER :: i, ierr, irep, md_iter, my_calc_f, ndim
428 TYPE(cp_logger_type), POINTER :: logger
429 TYPE(cp_subsys_type), POINTER :: subsys
430 TYPE(f_env_type), POINTER :: f_env
431 TYPE(qs_environment_type), POINTER :: qs_env
432
433 NULLIFY (f_env, qs_env, subsys)
434 cpassert(ASSOCIATED(rep_env))
435 cpassert(rep_env%ref_count > 0)
436 my_calc_f = 3*rep_env%nparticle
437 IF (PRESENT(calc_f)) THEN
438 IF (.NOT. calc_f) my_calc_f = 0
439 END IF
440
441 CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
442 logger => cp_get_default_logger()
443 ! md_iter=logger%iter_info%iteration(2)+1
444 md_iter = logger%iter_info%iteration(2)
445 CALL f_env_rm_defaults(f_env, ierr)
446 cpassert(ierr == 0)
447 DO i = 1, SIZE(rep_env%local_rep_indices)
448 irep = rep_env%local_rep_indices(i)
449 ndim = 3*rep_env%nparticle
450 IF (rep_env%sync_v) THEN
451 CALL set_vel(rep_env%f_env_id, rep_env%v(:, irep), ndim, ierr)
452 cpassert(ierr == 0)
453 END IF
454
455 logger%iter_info%iteration(1) = irep
456 logger%iter_info%iteration(2) = md_iter
457
458 IF (rep_env%keep_wf_history) THEN
459 CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
460 CALL force_env_get(f_env%force_env, qs_env=qs_env)
461 CALL set_qs_env(qs_env, &
462 wf_history=rep_env%wf_history(i)%wf_history)
463 CALL f_env_rm_defaults(f_env, ierr)
464 cpassert(ierr == 0)
465 END IF
466
467 CALL f_env_add_defaults(f_env_id=rep_env%f_env_id, f_env=f_env)
468 CALL force_env_get(f_env%force_env, subsys=subsys)
469 CALL cp_subsys_set(subsys, results=rep_env%results(irep)%results)
470 CALL f_env_rm_defaults(f_env, ierr)
471 cpassert(ierr == 0)
472 CALL calc_force(rep_env%f_env_id, rep_env%r(:, irep), ndim, &
473 rep_env%f(ndim + 1, irep), rep_env%f(:ndim, irep), &
474 my_calc_f, ierr)
475 cpassert(ierr == 0)
476 END DO
477 CALL rep_env_sync(rep_env, rep_env%f)
478 CALL rep_env_sync_results(rep_env, rep_env%results)
479
480 END SUBROUTINE rep_env_calc_e_f_int
481
482END MODULE replica_methods
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:311
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:122
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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...
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
set of type/routines to handle the storage of results in force_envs
subroutine, public cp_result_retain(results)
Retains cp_result type.
subroutine, public cp_result_create(results)
Allocates and intitializes the cp_result.
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell, cell_ref, use_ref_cell)
sets various propreties of the subsys
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
interface to use cp2k as library
subroutine, public set_vel(env_id, new_vel, n_el, ierr)
sets the velocities of the particles
subroutine, public get_nparticle(env_id, n_particle, ierr)
returns the number of particles in the given force env
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 get_pos(env_id, pos, n_el, ierr)
gets the positions of the particles
recursive subroutine, public create_force_env(new_env_id, input_declaration, input_path, output_path, mpi_comm, output_unit, owns_out_unit, input, ierr, work_dir, initial_variables)
creates a new force environment using the given input, and writing the output to the given output uni...
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...
recursive subroutine, public calc_force(env_id, pos, n_el_pos, e_pot, force, n_el_force, ierr)
returns the energy of the configuration given by the positions passed as argument
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, ipi_env)
returns various attributes about the force environment
integer, parameter, public use_qs_force
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
recursive subroutine, public section_vals_write(section_vals, unit_nr, hide_root, hide_defaults)
writes the values in the given section in a way that is suitable to the automatic parsing
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
integer, parameter, public default_path_length
Definition kinds.F:58
Interface to the message passing library MPI.
type(mp_comm_type), parameter, public mp_comm_null
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
Storage of past states of the qs_env. Methods to interpolate (or actually normally extrapolate) the n...
subroutine, public wfi_create_for_kp(wf_history)
Adapts wf_history storage flags for k-point calculations. For ASPC, switches from Gamma WFN storage t...
subroutine, public wfi_create(wf_history, interpolation_method_nr, extrapolation_order, has_unit_metric)
...
interpolate the wavefunctions to speed up the convergence when doing MD
subroutine, public wfi_retain(wf_history)
retains a wf history (see doc/ReferenceCounting.html)
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
subroutine, public rep_env_calc_e_f(rep_env, calc_f)
evaluates the forces
types used to handle many replica of the same system that differ only in atom positions,...
subroutine, public rep_envs_add_rep_env(rep_env)
adds the given rep_env to the list of controlled rep_envs.
type(replica_env_type) function, pointer, public rep_envs_get_rep_env(id_nr, ierr)
returns the replica environment with the given id_nr
subroutine, public rep_env_sync(rep_env, vals)
sends the data from each replica to all the other on replica j/=i data from replica i overwrites val(...
subroutine, public rep_env_sync_results(rep_env, results)
sends the data from each replica to all the other in this case the result type is passed
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represents a system: atoms, molecules, their pos,vel,...
represent a section of the input file
represent a multidimensional parallel environment
stores all the informations relevant to an mpi environment
keeps replicated information about the replicas